mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Fixed falling sand glitching on landing, minor logic improvements
This commit is contained in:
parent
13fd8b681e
commit
49eb0eb050
@ -37,6 +37,7 @@ abstract class Fallable extends Solid{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||
if($down->getId() === self::AIR or ($down instanceof Liquid)){
|
||||
$this->level->setBlock($this, Block::get(Block::AIR), true, true);
|
||||
$fall = Entity::createEntity("FallingSand", $this->getLevel(), new CompoundTag("", [
|
||||
"Pos" => new ListTag("Pos", [
|
||||
new DoubleTag("", $this->x + 0.5),
|
||||
|
@ -39,6 +39,8 @@ class FallingSand extends Entity{
|
||||
public $length = 0.98;
|
||||
public $height = 0.98;
|
||||
|
||||
protected $baseOffset = 0.49;
|
||||
|
||||
protected $gravity = 0.04;
|
||||
protected $drag = 0.02;
|
||||
protected $blockId = 0;
|
||||
@ -95,17 +97,6 @@ class FallingSand extends Entity{
|
||||
$hasUpdate = $this->entityBaseTick($tickDiff);
|
||||
|
||||
if($this->isAlive()){
|
||||
$pos = (new Vector3($this->x - 0.5, $this->y, $this->z - 0.5))->round();
|
||||
|
||||
if($this->ticksLived === 1){
|
||||
$block = $this->level->getBlock($pos);
|
||||
if($block->getId() !== $this->blockId){
|
||||
$this->kill();
|
||||
return true;
|
||||
}
|
||||
$this->level->setBlock($pos, Block::get(0), true);
|
||||
}
|
||||
|
||||
$this->motionY -= $this->gravity;
|
||||
|
||||
$this->move($this->motionX, $this->motionY, $this->motionZ);
|
||||
|
Loading…
x
Reference in New Issue
Block a user