diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index ce7dbc49..1e741b52 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -92,8 +92,10 @@ class PocketMinecraftServer{ "force-20-tps" => false, "enable-mob-pushing" => Living::$entityPushing, "keep-chunks-loaded" => self::$KEEP_CHUNKS_LOADED, - "use-experimental-hotbar" => Player::$experimentalHotbar + "use-experimental-hotbar" => Player::$experimentalHotbar, + "keep-items-on-death" => Entity::$keepInventory ]); + Entity::$keepInventory = $this->extraprops->get("keep-items-on-death"); Player::$experimentalHotbar = $this->extraprops->get("use-experimental-hotbar"); Player::$smallChunks = $this->extraprops->get("16x16x16_chunk_sending"); Living::$despawnMobs = $this->extraprops->get("despawn-mobs"); diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 93aa9de4..c9b794be 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -14,6 +14,7 @@ class Entity extends Position public $fallDistance = 0; public static $updateOnTick, $allowedAI; public static $allowFly = true; + public static $keepInventory = false; public $canBeAttacked; public $moveTime, $lookTime, $idleTime, $knockbackTime = 0; public $attackTimeout = 0; @@ -341,6 +342,9 @@ class Entity extends Position { if($this->class === ENTITY_PLAYER and $this->player instanceof Player and ($this->player->gamemode & 0x01) === 0){ $inv = []; + if(self::$keepInventory){ + return []; + } for($i = 0; $i < PLAYER_SURVIVAL_SLOTS; ++ $i){ $slot = $this->player->getSlot($i); $this->player->setSlot($i, BlockAPI::getItem(AIR, 0, 0)); diff --git a/src/entity/object/Arrow.php b/src/entity/object/Arrow.php index 693b6377..d671113e 100644 --- a/src/entity/object/Arrow.php +++ b/src/entity/object/Arrow.php @@ -188,10 +188,8 @@ class Arrow extends Entity{ $v4 = MovingObjectPosition::fromEntity($bestEnt); } - //TODO entity collisions if($v4 != null){ if($v4->entityHit != null){ - //TODO entity hit $v49 = sqrt($this->speedY*$this->speedY + $this->speedX*$this->speedX + $this->speedZ*$this->speedZ); $damage = ceil($v49+$v49); diff --git a/src/material/block/attachable/TrapdoorBlock.php b/src/material/block/attachable/TrapdoorBlock.php index 5aab66cd..6e932bde 100644 --- a/src/material/block/attachable/TrapdoorBlock.php +++ b/src/material/block/attachable/TrapdoorBlock.php @@ -12,7 +12,7 @@ class TrapdoorBlock extends TransparentBlock{ } $this->hardness = 15; } - //TODO collision box + public function canAttachTo(Block $target){ $id = $target->getID(); return $id === SLAB || $id === GLOWSTONE || $id === SLAB || $id === WOOD_SLAB || (!$target->isTransparent || $target instanceof StairBlock); diff --git a/src/material/block/liquid/LiquidBlockDynamic.php b/src/material/block/liquid/LiquidBlockDynamic.php index 5dc28774..c4028f30 100644 --- a/src/material/block/liquid/LiquidBlockDynamic.php +++ b/src/material/block/liquid/LiquidBlockDynamic.php @@ -6,7 +6,7 @@ class LiquidBlockDynamic extends LiquidBlock{ } public static $blockID = 0; - public static $sourcesAround = 0; //TODO rename + public static $sourcesAround = 0; public static $spread = [0, 0, 0, 0]; public static function getHighest(Level $level, $x, $y, $z, $highest){