diff --git a/src/pocketmine/block/Anvil.php b/src/pocketmine/block/Anvil.php index b88af41a0..5a3010804 100644 --- a/src/pocketmine/block/Anvil.php +++ b/src/pocketmine/block/Anvil.php @@ -75,10 +75,10 @@ class Anvil extends Fallable{ return true; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $direction = ($player !== null ? $player->getDirection() : 0) & 0x03; $this->meta = ($this->meta & 0x0c) | $direction; - return $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } public function getDrops(Item $item) : array{ diff --git a/src/pocketmine/block/Bed.php b/src/pocketmine/block/Bed.php index a6aa3fd8e..7465bc192 100644 --- a/src/pocketmine/block/Bed.php +++ b/src/pocketmine/block/Bed.php @@ -175,21 +175,21 @@ class Bed extends Transparent{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if(!$down->isTransparent()){ $meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03; $next = $this->getSide(self::getOtherHalfSide($meta)); if($next->canBeReplaced() === true and !$next->getSide(Vector3::SIDE_DOWN)->isTransparent()){ - $this->getLevel()->setBlock($block, BlockFactory::get($this->id, $meta), true, true); + $this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->id, $meta), true, true); $this->getLevel()->setBlock($next, BlockFactory::get($this->id, $meta | self::BITFLAG_HEAD), true, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::BED), new ByteTag("color", $item->getDamage() & 0x0f), - new IntTag("x", $block->x), - new IntTag("y", $block->y), - new IntTag("z", $block->z) + new IntTag("x", $blockReplace->x), + new IntTag("y", $blockReplace->y), + new IntTag("z", $blockReplace->z) ]); $nbt2 = clone $nbt; diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 727352c39..48facec70 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -140,15 +140,15 @@ class Block extends Position implements BlockIds, Metadatable{ * Places the Block, using block space and block target, and side. Returns if the block has been placed. * * @param Item $item - * @param Block $block - * @param Block $target + * @param Block $blockReplace + * @param Block $blockClicked * @param int $face * @param Vector3 $facePos * @param Player|null $player * * @return bool */ - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ return $this->getLevel()->setBlock($this, $this, true, true); } diff --git a/src/pocketmine/block/BoneBlock.php b/src/pocketmine/block/BoneBlock.php index eef5c517f..58472e77e 100644 --- a/src/pocketmine/block/BoneBlock.php +++ b/src/pocketmine/block/BoneBlock.php @@ -49,9 +49,9 @@ class BoneBlock extends Solid{ return Tool::TYPE_PICKAXE; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face); - return $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } public function getVariantBitmask() : int{ diff --git a/src/pocketmine/block/BurningFurnace.php b/src/pocketmine/block/BurningFurnace.php index e245c2a31..806ac3702 100644 --- a/src/pocketmine/block/BurningFurnace.php +++ b/src/pocketmine/block/BurningFurnace.php @@ -59,7 +59,7 @@ class BurningFurnace extends Solid{ return 13; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $faces = [ 0 => 4, 1 => 2, @@ -67,7 +67,7 @@ class BurningFurnace extends Solid{ 3 => 3 ]; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0]; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::FURNACE), diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index 1dad05c66..e9a04ada7 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -112,7 +112,7 @@ class Cactus extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::SAND or $down->getId() === self::CACTUS){ $block0 = $this->getSide(Vector3::SIDE_NORTH); diff --git a/src/pocketmine/block/Cake.php b/src/pocketmine/block/Cake.php index d85702d51..65ef59040 100644 --- a/src/pocketmine/block/Cake.php +++ b/src/pocketmine/block/Cake.php @@ -62,10 +62,10 @@ class Cake extends Transparent implements FoodSource{ ); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() !== self::AIR){ - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Carpet.php b/src/pocketmine/block/Carpet.php index 1b58fbef0..40ab5b90c 100644 --- a/src/pocketmine/block/Carpet.php +++ b/src/pocketmine/block/Carpet.php @@ -62,10 +62,10 @@ class Carpet extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() !== self::AIR){ - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index c6312e8fc..31640b3ee 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -67,7 +67,7 @@ class Chest extends Transparent{ ); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $faces = [ 0 => 4, 1 => 2, @@ -94,7 +94,7 @@ class Chest extends Transparent{ } } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::CHEST), diff --git a/src/pocketmine/block/Crops.php b/src/pocketmine/block/Crops.php index 1e340c62f..216b69ea9 100644 --- a/src/pocketmine/block/Crops.php +++ b/src/pocketmine/block/Crops.php @@ -32,9 +32,9 @@ use pocketmine\Server; abstract class Crops extends Flowable{ - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - if($block->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){ - $this->getLevel()->setBlock($block, $this, true, true); + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + if($blockReplace->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){ + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Dandelion.php b/src/pocketmine/block/Dandelion.php index 8ccbab968..640748a57 100644 --- a/src/pocketmine/block/Dandelion.php +++ b/src/pocketmine/block/Dandelion.php @@ -41,10 +41,10 @@ class Dandelion extends Flowable{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){ - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Door.php b/src/pocketmine/block/Door.php index 3c74cba2b..3d291f08a 100644 --- a/src/pocketmine/block/Door.php +++ b/src/pocketmine/block/Door.php @@ -216,7 +216,7 @@ abstract class Door extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($face === Vector3::SIDE_UP){ $blockUp = $this->getSide(Vector3::SIDE_UP); $blockDown = $this->getSide(Vector3::SIDE_DOWN); @@ -238,7 +238,7 @@ abstract class Door extends Transparent{ } $this->setDamage($player->getDirection() & 0x03); - $this->getLevel()->setBlock($block, $this, true, true); //Bottom + $this->getLevel()->setBlock($blockReplace, $this, true, true); //Bottom $this->getLevel()->setBlock($blockUp, $b = BlockFactory::get($this->getId(), $metaUp), true); //Top return true; } diff --git a/src/pocketmine/block/DoublePlant.php b/src/pocketmine/block/DoublePlant.php index 4050536c6..5637fda4c 100644 --- a/src/pocketmine/block/DoublePlant.php +++ b/src/pocketmine/block/DoublePlant.php @@ -54,11 +54,11 @@ class DoublePlant extends Flowable{ return $names[$this->meta & 0x07] ?? ""; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - $id = $block->getSide(Vector3::SIDE_DOWN)->getId(); - if(($id === Block::GRASS or $id === Block::DIRT) and $block->getSide(Vector3::SIDE_UP)->canBeReplaced()){ - $this->getLevel()->setBlock($block, $this, false, false); - $this->getLevel()->setBlock($block->getSide(Vector3::SIDE_UP), BlockFactory::get($this->id, $this->meta | self::BITFLAG_TOP), false, false); + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + $id = $blockReplace->getSide(Vector3::SIDE_DOWN)->getId(); + if(($id === Block::GRASS or $id === Block::DIRT) and $blockReplace->getSide(Vector3::SIDE_UP)->canBeReplaced()){ + $this->getLevel()->setBlock($blockReplace, $this, false, false); + $this->getLevel()->setBlock($blockReplace->getSide(Vector3::SIDE_UP), BlockFactory::get($this->id, $this->meta | self::BITFLAG_TOP), false, false); return true; } diff --git a/src/pocketmine/block/EnchantingTable.php b/src/pocketmine/block/EnchantingTable.php index 3cbcbe36d..581e181e5 100644 --- a/src/pocketmine/block/EnchantingTable.php +++ b/src/pocketmine/block/EnchantingTable.php @@ -41,8 +41,8 @@ class EnchantingTable extends Transparent{ $this->meta = $meta; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - $this->getLevel()->setBlock($block, $this, true, true); + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + $this->getLevel()->setBlock($blockReplace, $this, true, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::ENCHANT_TABLE), new IntTag("x", $this->x), diff --git a/src/pocketmine/block/EndRod.php b/src/pocketmine/block/EndRod.php index af4964635..38e4da8f6 100644 --- a/src/pocketmine/block/EndRod.php +++ b/src/pocketmine/block/EndRod.php @@ -40,17 +40,17 @@ class EndRod extends Flowable{ return "End Rod"; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($face === Vector3::SIDE_UP or $face === Vector3::SIDE_DOWN){ $this->meta = $face; }else{ $this->meta = $face ^ 0x01; } - if($target instanceof EndRod and $target->getDamage() === $this->meta){ + if($blockClicked instanceof EndRod and $blockClicked->getDamage() === $this->meta){ $this->meta ^= 0x01; } - return $this->level->setBlock($block, $this, true, true); + return $this->level->setBlock($blockReplace, $this, true, true); } public function isSolid() : bool{ diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index ba463c2d7..0cc922163 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -69,9 +69,9 @@ class FenceGate extends Transparent{ } } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $this->meta = ($player instanceof Player ? ($player->getDirection() - 1) & 0x03 : 0); - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Flower.php b/src/pocketmine/block/Flower.php index 80a0b36fd..ae69eadea 100644 --- a/src/pocketmine/block/Flower.php +++ b/src/pocketmine/block/Flower.php @@ -60,10 +60,10 @@ class Flower extends Flowable{ return $names[$this->meta] ?? "Unknown"; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){ - $this->getLevel()->setBlock($block, $this, true); + $this->getLevel()->setBlock($blockReplace, $this, true); return true; } diff --git a/src/pocketmine/block/FlowerPot.php b/src/pocketmine/block/FlowerPot.php index 0e1c4bef5..d7e6f771f 100644 --- a/src/pocketmine/block/FlowerPot.php +++ b/src/pocketmine/block/FlowerPot.php @@ -63,18 +63,18 @@ class FlowerPot extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){ return false; } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::FLOWER_POT), - new IntTag("x", $block->x), - new IntTag("y", $block->y), - new IntTag("z", $block->z), + new IntTag("x", $blockReplace->x), + new IntTag("y", $blockReplace->y), + new IntTag("z", $blockReplace->z), new ShortTag("item", 0), new IntTag("mData", 0) ]); diff --git a/src/pocketmine/block/GlazedTerracotta.php b/src/pocketmine/block/GlazedTerracotta.php index 47199c496..36ab5aa46 100644 --- a/src/pocketmine/block/GlazedTerracotta.php +++ b/src/pocketmine/block/GlazedTerracotta.php @@ -39,7 +39,7 @@ class GlazedTerracotta extends Solid{ return Tool::TYPE_PICKAXE; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($player !== null){ $faces = [ 0 => 4, @@ -50,7 +50,7 @@ class GlazedTerracotta extends Solid{ $this->meta = $faces[(~($player->getDirection() - 1)) & 0x03]; } - return $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } public function getVariantBitmask() : int{ diff --git a/src/pocketmine/block/HayBale.php b/src/pocketmine/block/HayBale.php index b13bfdd4e..4299bff15 100644 --- a/src/pocketmine/block/HayBale.php +++ b/src/pocketmine/block/HayBale.php @@ -43,7 +43,7 @@ class HayBale extends Solid{ return 0.5; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $faces = [ 0 => 0, 1 => 0, @@ -54,7 +54,7 @@ class HayBale extends Solid{ ]; $this->meta = ($this->meta & 0x03) | $faces[$face]; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/ItemFrame.php b/src/pocketmine/block/ItemFrame.php index d92e16a3a..23e8fc7f2 100644 --- a/src/pocketmine/block/ItemFrame.php +++ b/src/pocketmine/block/ItemFrame.php @@ -105,7 +105,7 @@ class ItemFrame extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($face === Vector3::SIDE_DOWN or $face === Vector3::SIDE_UP){ return false; } @@ -118,13 +118,13 @@ class ItemFrame extends Flowable{ ]; $this->meta = $faces[$face]; - $this->level->setBlock($block, $this, true, true); + $this->level->setBlock($blockReplace, $this, true, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::ITEM_FRAME), - new IntTag("x", $block->x), - new IntTag("y", $block->y), - new IntTag("z", $block->z), + new IntTag("x", $blockReplace->x), + new IntTag("y", $blockReplace->y), + new IntTag("z", $blockReplace->z), new FloatTag("ItemDropChance", 1.0), new ByteTag("ItemRotation", 0) ]); diff --git a/src/pocketmine/block/Ladder.php b/src/pocketmine/block/Ladder.php index c118d78be..0dd8221f2 100644 --- a/src/pocketmine/block/Ladder.php +++ b/src/pocketmine/block/Ladder.php @@ -110,8 +110,8 @@ class Ladder extends Transparent{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - if($target->isTransparent() === false){ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + if($blockClicked->isTransparent() === false){ $faces = [ 2 => 2, 3 => 3, @@ -120,7 +120,7 @@ class Ladder extends Transparent{ ]; if(isset($faces[$face])){ $this->meta = $faces[$face]; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Lava.php b/src/pocketmine/block/Lava.php index d5001c9e6..e92fb7759 100644 --- a/src/pocketmine/block/Lava.php +++ b/src/pocketmine/block/Lava.php @@ -63,7 +63,7 @@ class Lava extends Liquid{ $entity->resetFallDistance(); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $ret = $this->getLevel()->setBlock($this, $this, true, false); $this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate()); diff --git a/src/pocketmine/block/Leaves.php b/src/pocketmine/block/Leaves.php index 2d4b01955..5b0047330 100644 --- a/src/pocketmine/block/Leaves.php +++ b/src/pocketmine/block/Leaves.php @@ -164,7 +164,7 @@ class Leaves extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $this->meta |= 0x04; return $this->getLevel()->setBlock($this, $this, true); } diff --git a/src/pocketmine/block/NetherWartPlant.php b/src/pocketmine/block/NetherWartPlant.php index f34068a5a..ab2e88090 100644 --- a/src/pocketmine/block/NetherWartPlant.php +++ b/src/pocketmine/block/NetherWartPlant.php @@ -44,10 +44,10 @@ class NetherWartPlant extends Flowable{ return true; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === Block::SOUL_SAND){ - $this->getLevel()->setBlock($block, $this, false, true); + $this->getLevel()->setBlock($blockReplace, $this, false, true); return true; } diff --git a/src/pocketmine/block/Pumpkin.php b/src/pocketmine/block/Pumpkin.php index 9d5c4cf20..0bd5ae1aa 100644 --- a/src/pocketmine/block/Pumpkin.php +++ b/src/pocketmine/block/Pumpkin.php @@ -48,11 +48,11 @@ class Pumpkin extends Solid{ return "Pumpkin"; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($player instanceof Player){ $this->meta = ((int) $player->getDirection() + 1) % 4; } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Quartz.php b/src/pocketmine/block/Quartz.php index dbf249fd0..a9f96a56b 100644 --- a/src/pocketmine/block/Quartz.php +++ b/src/pocketmine/block/Quartz.php @@ -54,11 +54,11 @@ class Quartz extends Solid{ return $names[$this->meta & 0x03] ?? "Unknown"; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($this->meta !== self::QUARTZ_NORMAL){ $this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face); } - return $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } public function getToolType() : int{ diff --git a/src/pocketmine/block/Rail.php b/src/pocketmine/block/Rail.php index 61a21b5bd..723a9d20c 100644 --- a/src/pocketmine/block/Rail.php +++ b/src/pocketmine/block/Rail.php @@ -55,9 +55,9 @@ class Rail extends Flowable{ return 0.7; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - if(!$block->getSide(Vector3::SIDE_DOWN)->isTransparent()){ - return $this->getLevel()->setBlock($block, $this, true, true); + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + if(!$blockReplace->getSide(Vector3::SIDE_DOWN)->isTransparent()){ + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } return false; diff --git a/src/pocketmine/block/RedMushroom.php b/src/pocketmine/block/RedMushroom.php index 3ca78e08b..0af15d796 100644 --- a/src/pocketmine/block/RedMushroom.php +++ b/src/pocketmine/block/RedMushroom.php @@ -56,10 +56,10 @@ class RedMushroom extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->isTransparent() === false){ - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index 7034ba4ce..719afa6a1 100644 --- a/src/pocketmine/block/RedstoneOre.php +++ b/src/pocketmine/block/RedstoneOre.php @@ -46,7 +46,7 @@ class RedstoneOre extends Solid{ return 3; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ return $this->getLevel()->setBlock($this, $this, true, false); } diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index 8601354e9..9597a6d96 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -61,10 +61,10 @@ class Sapling extends Flowable{ return true; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::FARMLAND){ - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/SignPost.php b/src/pocketmine/block/SignPost.php index a453ccbd2..2f08dfb94 100644 --- a/src/pocketmine/block/SignPost.php +++ b/src/pocketmine/block/SignPost.php @@ -60,13 +60,13 @@ class SignPost extends Transparent{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($face !== Vector3::SIDE_DOWN){ $nbt = new CompoundTag("", [ new StringTag("id", Tile::SIGN), - new IntTag("x", $block->x), - new IntTag("y", $block->y), - new IntTag("z", $block->z), + new IntTag("x", $blockReplace->x), + new IntTag("y", $blockReplace->y), + new IntTag("z", $blockReplace->z), new StringTag("Text1", ""), new StringTag("Text2", ""), new StringTag("Text3", ""), @@ -85,10 +85,10 @@ class SignPost extends Transparent{ if($face === Vector3::SIDE_UP){ $this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0f; - $this->getLevel()->setBlock($block, $this, true); + $this->getLevel()->setBlock($blockReplace, $this, true); }else{ $this->meta = $face; - $this->getLevel()->setBlock($block, new WallSign($this->meta), true); + $this->getLevel()->setBlock($blockReplace, new WallSign($this->meta), true); } Tile::createTile(Tile::SIGN, $this->getLevel(), $nbt); diff --git a/src/pocketmine/block/Skull.php b/src/pocketmine/block/Skull.php index 7f20eb678..2a75e3c45 100644 --- a/src/pocketmine/block/Skull.php +++ b/src/pocketmine/block/Skull.php @@ -64,7 +64,7 @@ class Skull extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ if($face !== Vector3::SIDE_DOWN){ $this->meta = $face; if($face === Vector3::SIDE_UP){ @@ -72,7 +72,7 @@ class Skull extends Flowable{ }else{ $rot = $face; } - $this->getLevel()->setBlock($block, $this, true); + $this->getLevel()->setBlock($blockReplace, $this, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::SKULL), new ByteTag("SkullType", $item->getDamage()), diff --git a/src/pocketmine/block/SnowLayer.php b/src/pocketmine/block/SnowLayer.php index 631862724..8b602161d 100644 --- a/src/pocketmine/block/SnowLayer.php +++ b/src/pocketmine/block/SnowLayer.php @@ -58,10 +58,10 @@ class SnowLayer extends Flowable{ return true; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - if($block->getSide(Vector3::SIDE_DOWN)->isSolid()){ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + if($blockReplace->getSide(Vector3::SIDE_DOWN)->isSolid()){ //TODO: fix placement - $this->getLevel()->setBlock($block, $this, true); + $this->getLevel()->setBlock($blockReplace, $this, true); return true; } diff --git a/src/pocketmine/block/Stair.php b/src/pocketmine/block/Stair.php index c3302f074..4b7bc6b8c 100644 --- a/src/pocketmine/block/Stair.php +++ b/src/pocketmine/block/Stair.php @@ -130,7 +130,7 @@ abstract class Stair extends Transparent{ } } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $faces = [ 0 => 0, 1 => 2, @@ -141,7 +141,7 @@ abstract class Stair extends Transparent{ if(($facePos->y > 0.5 and $face !== Vector3::SIDE_UP) or $face === Vector3::SIDE_DOWN){ $this->meta |= 0x04; //Upside-down stairs } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index 304ea7b93..6512fbd4a 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -106,10 +106,10 @@ class Sugarcane extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::SUGARCANE_BLOCK){ - $this->getLevel()->setBlock($block, BlockFactory::get(Block::SUGARCANE_BLOCK), true); + $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::SUGARCANE_BLOCK), true); return true; }elseif($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::SAND){ @@ -118,7 +118,7 @@ class Sugarcane extends Flowable{ $block2 = $down->getSide(Vector3::SIDE_WEST); $block3 = $down->getSide(Vector3::SIDE_EAST); if(($block0 instanceof Water) or ($block1 instanceof Water) or ($block2 instanceof Water) or ($block3 instanceof Water)){ - $this->getLevel()->setBlock($block, BlockFactory::get(Block::SUGARCANE_BLOCK), true); + $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::SUGARCANE_BLOCK), true); return true; } diff --git a/src/pocketmine/block/TallGrass.php b/src/pocketmine/block/TallGrass.php index 9caeaee52..d9836d395 100644 --- a/src/pocketmine/block/TallGrass.php +++ b/src/pocketmine/block/TallGrass.php @@ -50,10 +50,10 @@ class TallGrass extends Flowable{ return $names[$this->meta & 0x03] ?? "Unknown"; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::GRASS){ - $this->getLevel()->setBlock($block, $this, true); + $this->getLevel()->setBlock($blockReplace, $this, true); return true; } diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index b890dd004..02f1fc5fa 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -68,10 +68,10 @@ class Torch extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $below = $this->getSide(Vector3::SIDE_DOWN); - if($target->isTransparent() === false and $face !== Vector3::SIDE_DOWN){ + if($blockClicked->isTransparent() === false and $face !== Vector3::SIDE_DOWN){ $faces = [ Vector3::SIDE_UP => 5, Vector3::SIDE_NORTH => 4, @@ -80,12 +80,12 @@ class Torch extends Flowable{ Vector3::SIDE_EAST => 1 ]; $this->meta = $faces[$face]; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; }elseif($below->isTransparent() === false or $below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL){ $this->meta = 0; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Trapdoor.php b/src/pocketmine/block/Trapdoor.php index 34243452c..104b5c383 100644 --- a/src/pocketmine/block/Trapdoor.php +++ b/src/pocketmine/block/Trapdoor.php @@ -124,7 +124,7 @@ class Trapdoor extends Transparent{ return $bb; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $directions = [ 0 => 1, 1 => 3, @@ -137,7 +137,7 @@ class Trapdoor extends Transparent{ if(($facePos->y > 0.5 and $face !== self::SIDE_UP) or $face === self::SIDE_DOWN){ $this->meta |= self::MASK_UPPER; //top half of block } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Vine.php b/src/pocketmine/block/Vine.php index fe9d4fdf4..e2c6531ef 100644 --- a/src/pocketmine/block/Vine.php +++ b/src/pocketmine/block/Vine.php @@ -136,9 +136,9 @@ class Vine extends Transparent{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ //TODO: multiple sides - if($target->isSolid()){ + if($blockClicked->isSolid()){ $faces = [ 2 => self::FLAG_SOUTH, 3 => self::FLAG_NORTH, @@ -147,7 +147,7 @@ class Vine extends Transparent{ ]; if(isset($faces[$face])){ $this->meta = $faces[$face]; - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; } diff --git a/src/pocketmine/block/Water.php b/src/pocketmine/block/Water.php index 4f9ef3e76..df5c729f7 100644 --- a/src/pocketmine/block/Water.php +++ b/src/pocketmine/block/Water.php @@ -53,7 +53,7 @@ class Water extends Liquid{ $entity->resetFallDistance(); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $ret = $this->getLevel()->setBlock($this, $this, true, false); $this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate()); diff --git a/src/pocketmine/block/WaterLily.php b/src/pocketmine/block/WaterLily.php index c2fb17515..a701d6226 100644 --- a/src/pocketmine/block/WaterLily.php +++ b/src/pocketmine/block/WaterLily.php @@ -57,9 +57,9 @@ class WaterLily extends Flowable{ } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ - if($target instanceof Water){ - $up = $target->getSide(Vector3::SIDE_UP); + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ + if($blockClicked instanceof Water){ + $up = $blockClicked->getSide(Vector3::SIDE_UP); if($up->getId() === Block::AIR){ $this->getLevel()->setBlock($up, $this, true, true); return true; diff --git a/src/pocketmine/block/Wood.php b/src/pocketmine/block/Wood.php index f285ae4c9..baaf09303 100644 --- a/src/pocketmine/block/Wood.php +++ b/src/pocketmine/block/Wood.php @@ -55,9 +55,9 @@ class Wood extends Solid{ return $names[$this->meta & 0x03]; } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face); - return $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($blockReplace, $this, true, true); } public function getVariantBitmask() : int{ diff --git a/src/pocketmine/block/WoodenSlab.php b/src/pocketmine/block/WoodenSlab.php index 3df1f3e2c..1fa697d6b 100644 --- a/src/pocketmine/block/WoodenSlab.php +++ b/src/pocketmine/block/WoodenSlab.php @@ -82,34 +82,34 @@ class WoodenSlab extends Transparent{ return $with !== null and $with->getId() === $this->getId() and ($with->getDamage() & 0x07) === ($this->getDamage() & 0x07); } - public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{ + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{ $this->meta &= 0x07; if($face === Vector3::SIDE_DOWN){ - if($target->getId() === $this->id and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === $this->meta){ - $this->getLevel()->setBlock($target, BlockFactory::get($this->doubleId, $this->meta), true); + if($blockClicked->getId() === $this->id and ($blockClicked->getDamage() & 0x08) === 0x08 and ($blockClicked->getDamage() & 0x07) === $this->meta){ + $this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->doubleId, $this->meta), true); return true; - }elseif($block->getId() === $this->id and ($block->getDamage() & 0x07) === $this->meta){ - $this->getLevel()->setBlock($block, BlockFactory::get($this->doubleId, $this->meta), true); + }elseif($blockReplace->getId() === $this->id and ($blockReplace->getDamage() & 0x07) === $this->meta){ + $this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->doubleId, $this->meta), true); return true; }else{ $this->meta |= 0x08; } }elseif($face === Vector3::SIDE_UP){ - if($target->getId() === $this->id and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === $this->meta){ - $this->getLevel()->setBlock($target, BlockFactory::get($this->doubleId, $this->meta), true); + if($blockClicked->getId() === $this->id and ($blockClicked->getDamage() & 0x08) === 0 and ($blockClicked->getDamage() & 0x07) === $this->meta){ + $this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->doubleId, $this->meta), true); return true; - }elseif($block->getId() === $this->id and ($block->getDamage() & 0x07) === $this->meta){ - $this->getLevel()->setBlock($block, BlockFactory::get($this->doubleId, $this->meta), true); + }elseif($blockReplace->getId() === $this->id and ($blockReplace->getDamage() & 0x07) === $this->meta){ + $this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->doubleId, $this->meta), true); return true; } }else{ //TODO: collision - if($block->getId() === $this->id){ - if(($block->getDamage() & 0x07) === $this->meta){ - $this->getLevel()->setBlock($block, BlockFactory::get($this->doubleId, $this->meta), true); + if($blockReplace->getId() === $this->id){ + if(($blockReplace->getDamage() & 0x07) === $this->meta){ + $this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->doubleId, $this->meta), true); return true; } @@ -122,10 +122,10 @@ class WoodenSlab extends Transparent{ } } - if($block->getId() === $this->id and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){ + if($blockReplace->getId() === $this->id and ($blockClicked->getDamage() & 0x07) !== ($this->meta & 0x07)){ return false; } - $this->getLevel()->setBlock($block, $this, true, true); + $this->getLevel()->setBlock($blockReplace, $this, true, true); return true; }