diff --git a/src/pocketmine/block/TNT.php b/src/pocketmine/block/TNT.php index 76a2bd3f2e..5dc758ac94 100644 --- a/src/pocketmine/block/TNT.php +++ b/src/pocketmine/block/TNT.php @@ -41,7 +41,7 @@ class TNT extends Solid{ public function onActivate(Item $item, Player $player = null){ if($item->getID() === Item::FLINT_STEEL){ $item->useOn($this); - $this->getLevel()->setBlock($this, new Air(), false, false, true); + $this->getLevel()->setBlock($this, new Air(), true); $mot = (new Random())->nextSignedFloat() * M_PI * 2; $tnt = new PrimedTNT($this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [ diff --git a/src/pocketmine/entity/Arrow.php b/src/pocketmine/entity/Arrow.php index e431097078..5a010f2118 100644 --- a/src/pocketmine/entity/Arrow.php +++ b/src/pocketmine/entity/Arrow.php @@ -85,7 +85,7 @@ class Arrow extends Projectile{ $this->motionY -= $this->gravity; - $this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z); + $this->keepMovement = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z); $moveVector = new Vector3($this->x + $this->motionX, $this->y + $this->motionY, $this->z + $this->motionZ); diff --git a/src/pocketmine/entity/DroppedItem.php b/src/pocketmine/entity/DroppedItem.php index 0f8367a36e..79d5b5ae8b 100644 --- a/src/pocketmine/entity/DroppedItem.php +++ b/src/pocketmine/entity/DroppedItem.php @@ -93,7 +93,7 @@ class DroppedItem extends Entity{ $this->motionY -= $this->gravity; - $this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z); + $this->keepMovement = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z); $this->move($this->motionX, $this->motionY, $this->motionZ); $friction = 1 - $this->drag; @@ -126,7 +126,7 @@ class DroppedItem extends Entity{ $this->timings->stopTiming(); - return $hasUpdate or !$this->onGround or ($this->motionX == 0 and $this->motionY == 0 and $this->motionZ == 0); + return $hasUpdate or !$this->onGround or $this->motionX != 0 or $this->motionY != 0 or $this->motionZ != 0; } public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 476ec0c643..c55c183c0e 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -122,7 +122,7 @@ abstract class Entity extends Location implements Metadatable{ protected $ySize = 0; protected $stepHeight = 0; - public $keepMovement = true; + public $keepMovement = false; public $fallDistance; public $ticksLived; @@ -777,12 +777,11 @@ abstract class Entity extends Location implements Metadatable{ return true; } - //if($this->inBlock){ //TODO: noclip - // $this->boundingBox->offset($dx, $dy, $dz); - // $this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2; - // $this->y = $this->boundingBox->minY/* + $this->height*/; - // $this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2; - //}else{ + if($this->keepMovement){ + $this->boundingBox->offset($dx, $dy, $dz); + $pos = new Vector3(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY - $this->ySize, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2); + $this->setPosition($pos); + }else{ Timings::$entityMoveTimer->startTiming(); @@ -841,7 +840,7 @@ abstract class Entity extends Location implements Metadatable{ $this->boundingBox->offset(0, $dy, 0); - if(!$this->keepMovement and $movY != $dy){ + if($movY != $dy){ $dx = 0; $dy = 0; $dz = 0; @@ -855,7 +854,7 @@ abstract class Entity extends Location implements Metadatable{ $this->boundingBox->offset($dx, 0, 0); - if(!$this->keepMovement and $movX != $dx){ + if($movX != $dx){ $dx = 0; $dy = 0; $dz = 0; @@ -867,7 +866,7 @@ abstract class Entity extends Location implements Metadatable{ $this->boundingBox->offset(0, 0, $dz); - if(!$this->keepMovement and $movZ != $dz){ + if($movZ != $dz){ $dx = 0; $dy = 0; $dz = 0; @@ -893,7 +892,7 @@ abstract class Entity extends Location implements Metadatable{ } $this->boundingBox->offset(0, $dy, 0); - if(!$this->keepMovement and $movY != $dy){ + if($movY != $dy){ $dx = 0; $dy = 0; $dz = 0; @@ -904,7 +903,7 @@ abstract class Entity extends Location implements Metadatable{ } $this->boundingBox->offset($dx, 0, 0); - if(!$this->keepMovement and $movX != $dx){ + if($movX != $dx){ $dx = 0; $dy = 0; $dz = 0; @@ -915,13 +914,13 @@ abstract class Entity extends Location implements Metadatable{ } $this->boundingBox->offset(0, 0, $dz); - if(!$this->keepMovement and $movZ != $dz){ + if($movZ != $dz){ $dx = 0; $dy = 0; $dz = 0; } - if(!$this->keepMovement and $movY != $dy){ + if($movY != $dy){ $dx = 0; $dy = 0; $dz = 0; @@ -990,7 +989,7 @@ abstract class Entity extends Location implements Metadatable{ Timings::$entityMoveTimer->stopTiming(); return $result; - //} + } } protected function checkBlockCollision(){ diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index fc4c690009..a9c5535c1b 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1105,7 +1105,7 @@ class Level implements ChunkManager, Metadatable{ } } - if(!($player instanceof Player) or ($player->getGamemode() & 0x01) === 0){ + if(!($player instanceof Player) or $player->isSurvival() === 0){ foreach($drops as $drop){ if($drop[2] > 0){ $this->dropItem($vector->add(0.5, 0.5, 0.5), Item::get(...$drop));