mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
tweaked fallingsand physics
This commit is contained in:
parent
21fc67cf1a
commit
16324d32f2
2 changed files with 11 additions and 8 deletions
|
|
@ -27,6 +27,7 @@ class FallingSand extends Entity{
|
|||
$this->close();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->lastX = $this->x;
|
||||
$this->lastY = $this->y;
|
||||
$this->lastZ = $this->z;
|
||||
|
|
@ -42,6 +43,14 @@ class FallingSand extends Entity{
|
|||
$y = floor($this->y);
|
||||
$z = floor($this->z);
|
||||
|
||||
if(($blockAt = $this->level->level->getBlockID($x, $y, $z)) != 0){
|
||||
//TODO vanilla-like checking?
|
||||
if(StaticBlock::getIsTransparent($blockAt) && !StaticBlock::getIsLiquid($blockAt)){
|
||||
$this->close();
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"], 0, 1)); //TODO add metadata
|
||||
return;
|
||||
}
|
||||
}
|
||||
if($this->onGround){
|
||||
$this->speedX *= 0.7;
|
||||
$this->speedZ *= 0.7;
|
||||
|
|
@ -49,12 +58,6 @@ class FallingSand extends Entity{
|
|||
$this->close();
|
||||
//TODO vanilla-like checking?
|
||||
$this->level->fastSetBlockUpdate($x, $y, $z, $this->data["Tile"], 0, true); //TODO add metadata
|
||||
}elseif(($blockAt = $this->level->level->getBlockID($x, $y, $z)) != 0){
|
||||
//TODO vanilla-like checking?
|
||||
if(StaticBlock::getIsTransparent($blockAt) && !StaticBlock::getIsLiquid($blockAt)){
|
||||
$this->close();
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"], 0, 1)); //TODO add metadata
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,4 +94,4 @@ class GenericBlock extends Block{
|
|||
public function onActivate(Item $item, Player $player){
|
||||
return $this->isActivable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue