diff --git a/src/pocketmine/block/Anvil.php b/src/pocketmine/block/Anvil.php index bd1d8e49d..d4b09eae6 100644 --- a/src/pocketmine/block/Anvil.php +++ b/src/pocketmine/block/Anvil.php @@ -112,7 +112,7 @@ class Anvil extends Fallable{ public function getDropsForCompatibleTool(Item $item) : array{ return [ - ItemFactory::get($this->getItemId(), $this->getDamage() & 0x0c) + ItemFactory::get($this->getItemId(), $this->getDamage() >> 2) ]; } } diff --git a/src/pocketmine/item/Anvil.php b/src/pocketmine/item/Anvil.php new file mode 100644 index 000000000..6aa317a6a --- /dev/null +++ b/src/pocketmine/item/Anvil.php @@ -0,0 +1,38 @@ +meta << 2); + } +} diff --git a/src/pocketmine/item/ItemBlock.php b/src/pocketmine/item/ItemBlock.php index 2adcec413..7e49231d2 100644 --- a/src/pocketmine/item/ItemBlock.php +++ b/src/pocketmine/item/ItemBlock.php @@ -47,6 +47,10 @@ class ItemBlock extends Item{ return BlockFactory::get($this->blockId, $this->meta === -1 ? 0 : $this->meta & 0xf); } + public function getVanillaName() : string{ + return $this->getBlock()->getName(); + } + public function getFuelTime() : int{ return $this->getBlock()->getFuelTime(); } diff --git a/src/pocketmine/item/ItemFactory.php b/src/pocketmine/item/ItemFactory.php index 8a8b91d7e..63a03e925 100644 --- a/src/pocketmine/item/ItemFactory.php +++ b/src/pocketmine/item/ItemFactory.php @@ -38,6 +38,8 @@ class ItemFactory{ public static function init(){ self::$list = new \SplFixedArray(65536); + self::registerItem(new Anvil(), true); + self::registerItem(new Shovel(Item::IRON_SHOVEL, 0, "Iron Shovel", TieredTool::TIER_IRON)); self::registerItem(new Pickaxe(Item::IRON_PICKAXE, 0, "Iron Pickaxe", TieredTool::TIER_IRON)); self::registerItem(new Axe(Item::IRON_AXE, 0, "Iron Axe", TieredTool::TIER_IRON));