mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
collision tweaks, autojump tweaks
This commit is contained in:
parent
fe78ac4ee6
commit
ab03a1883f
4 changed files with 22 additions and 16 deletions
|
|
@ -20,20 +20,23 @@ class MobController
|
|||
$oz = ($z > 0 ? 1 : ($z < 0 ? -1 : 0));
|
||||
$xf = $this->entity->x + ($this->entity->getSpeedModifer() * $ox * $this->entity->getSpeed());
|
||||
$zf = $this->entity->z + ($this->entity->getSpeedModifer() * $oz * $this->entity->getSpeed());
|
||||
$bs = [ //TODO simplify(somehow)
|
||||
$this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), ceil($zf)),
|
||||
$this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)),
|
||||
$this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)),
|
||||
$this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), ceil($zf)),
|
||||
];
|
||||
foreach($bs as $b){
|
||||
if($b->isSolid){
|
||||
if(!$b->getSide(1)->isSolid){
|
||||
$oy = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($this->entity->onGround){
|
||||
$bs = [ //TODO simplify(somehow)
|
||||
$this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), ceil($zf)),
|
||||
$this->entity->level->getBlockWithoutVector(ceil($xf), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)),
|
||||
$this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), $zf - ($oz < 0 ? 1 : 0)),
|
||||
$this->entity->level->getBlockWithoutVector($xf - ($ox < 0 ? 1 : 0), floor($this->entity->y), ceil($zf)),
|
||||
];
|
||||
foreach($bs as $b){
|
||||
if($b->isSolid){
|
||||
if(!$b->getSide(1)->isSolid){
|
||||
$oy = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->entity->knockbackTime <= 0){
|
||||
$this->entity->moveEntityWithOffset($ox, $oy, $oz);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue