mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
simplified
This commit is contained in:
parent
d3a47fb6b3
commit
9609a57e0b
1 changed files with 14 additions and 28 deletions
|
|
@ -705,39 +705,17 @@ class Entity extends Position
|
|||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
if($id === LADDER){
|
||||
switch($meta){
|
||||
case 2:
|
||||
if($this->boundingBox->intersectsWith(new AxisAlignedBB($x, $y, $z + 1 - 0.125, $x + 1, $y + 1, $z + 1))){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if($this->boundingBox->intersectsWith(new AxisAlignedBB($x, $y, $z, $x + 1, $y + 1, $z + 0.125))){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if($this->boundingBox->intersectsWith(new AxisAlignedBB($x + 1 - 0.125, $y, $z, $x + 1, $y + 1, $z + 1))){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if($this->boundingBox->intersectsWith(new AxisAlignedBB($x, $y, $z, $x + 0.125, $y + 1, $z + 1))){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->isOnLadder()){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
|
||||
if(!$this->onGround && ($prevGroundState /*|| $this->y > $this->fallStart*/)){
|
||||
$this->fallStart = $this->y;
|
||||
}
|
||||
|
|
@ -772,6 +750,14 @@ class Entity extends Position
|
|||
$this->needsUpdate = $hasUpdate;
|
||||
$this->lastUpdate = $now;
|
||||
}
|
||||
|
||||
public function isOnLadder(){
|
||||
$x = (int)$this->x;
|
||||
$y = (int)$this->boundingBox->minY;
|
||||
$z = (int)$this->z;
|
||||
return $this->level->level->getBlockID($x, $y, $z) === LADDER;
|
||||
}
|
||||
|
||||
public function fall(){
|
||||
if($this->isPlayer()){
|
||||
$dmg = floor($this->fallStart - $this->y) - 3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue