From 49eb0eb0505b47af65e7d7dbc846501a4e066b2a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 4 May 2017 17:48:39 +0100 Subject: [PATCH] Fixed falling sand glitching on landing, minor logic improvements --- src/pocketmine/block/Fallable.php | 1 + src/pocketmine/entity/FallingSand.php | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/pocketmine/block/Fallable.php b/src/pocketmine/block/Fallable.php index bd5898164..8fb55c630 100644 --- a/src/pocketmine/block/Fallable.php +++ b/src/pocketmine/block/Fallable.php @@ -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), diff --git a/src/pocketmine/entity/FallingSand.php b/src/pocketmine/entity/FallingSand.php index 945892eb4..9467dd013 100644 --- a/src/pocketmine/entity/FallingSand.php +++ b/src/pocketmine/entity/FallingSand.php @@ -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);