diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 20cadfd75..1342eaf08 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -718,6 +718,14 @@ class Block extends Position implements BlockIds, Metadatable{ return $this->getHardness() !== -1; } + /** + * Returns the time in ticks which the block will fuel a furnace for. + * @return int + */ + public function getFuelTime() : int{ + return 0; + } + /** * Returns the Block on the side $side, works like Vector3::side() * diff --git a/src/pocketmine/block/Bookshelf.php b/src/pocketmine/block/Bookshelf.php index 39b47dd57..c110baf21 100644 --- a/src/pocketmine/block/Bookshelf.php +++ b/src/pocketmine/block/Bookshelf.php @@ -52,4 +52,8 @@ class Bookshelf extends Solid{ ]; } + public function getFuelTime() : int{ + return 300; + } + } \ No newline at end of file diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index 9abedb956..e2b7688f6 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -174,4 +174,8 @@ class Chest extends Transparent{ [$this->id, 0, 1], ]; } + + public function getFuelTime() : int{ + return 300; + } } \ No newline at end of file diff --git a/src/pocketmine/block/Coal.php b/src/pocketmine/block/Coal.php index 3ea29656f..c0262577a 100644 --- a/src/pocketmine/block/Coal.php +++ b/src/pocketmine/block/Coal.php @@ -55,4 +55,8 @@ class Coal extends Solid{ return []; } } + + public function getFuelTime() : int{ + return 16000; + } } \ No newline at end of file diff --git a/src/pocketmine/block/CraftingTable.php b/src/pocketmine/block/CraftingTable.php index fea3307e0..658659050 100644 --- a/src/pocketmine/block/CraftingTable.php +++ b/src/pocketmine/block/CraftingTable.php @@ -60,4 +60,8 @@ class CraftingTable extends Solid{ [$this->id, 0, 1], ]; } + + public function getFuelTime() : int{ + return 300; + } } \ No newline at end of file diff --git a/src/pocketmine/block/DaylightSensor.php b/src/pocketmine/block/DaylightSensor.php index 423b65a98..29a2093fd 100644 --- a/src/pocketmine/block/DaylightSensor.php +++ b/src/pocketmine/block/DaylightSensor.php @@ -38,4 +38,8 @@ class DaylightSensor extends Transparent{ public function getHardness(){ return 0.2; } + + public function getFuelTime() : int{ + return 300; + } } diff --git a/src/pocketmine/block/Fence.php b/src/pocketmine/block/Fence.php index a706ea796..34c50949d 100644 --- a/src/pocketmine/block/Fence.php +++ b/src/pocketmine/block/Fence.php @@ -88,4 +88,8 @@ class Fence extends Transparent{ return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent(); } + public function getFuelTime() : int{ + return 300; + } + } diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index ed484d5ed..270c1636d 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -92,4 +92,8 @@ class FenceGate extends Transparent{ $this->level->addSound(new DoorSound($this)); return true; } + + public function getFuelTime() : int{ + return 300; + } } diff --git a/src/pocketmine/block/NoteBlock.php b/src/pocketmine/block/NoteBlock.php index d03c65669..177f9c712 100644 --- a/src/pocketmine/block/NoteBlock.php +++ b/src/pocketmine/block/NoteBlock.php @@ -34,4 +34,8 @@ class NoteBlock extends Solid{ public function getName(){ return "Note Block"; } + + public function getFuelTime() : int{ + return 300; + } } diff --git a/src/pocketmine/block/Planks.php b/src/pocketmine/block/Planks.php index 96237aec7..d54627c35 100644 --- a/src/pocketmine/block/Planks.php +++ b/src/pocketmine/block/Planks.php @@ -59,4 +59,8 @@ class Planks extends Solid{ return $names[$this->meta & 0x07] ?? "Unknown"; } + public function getFuelTime() : int{ + return 300; + } + } diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index 8eedaacb6..7c89d4995 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -112,4 +112,8 @@ class Sapling extends Flowable{ [$this->id, $this->meta & 0x07, 1], ]; } + + public function getFuelTime() : int{ + return 100; + } } \ No newline at end of file diff --git a/src/pocketmine/block/StoneSlab.php b/src/pocketmine/block/StoneSlab.php index 6470b238d..788e013f3 100644 --- a/src/pocketmine/block/StoneSlab.php +++ b/src/pocketmine/block/StoneSlab.php @@ -75,4 +75,8 @@ class StoneSlab extends WoodenSlab{ return []; } } + + public function getFuelTime() : int{ + return 0; + } } \ No newline at end of file diff --git a/src/pocketmine/block/Trapdoor.php b/src/pocketmine/block/Trapdoor.php index 93aa586eb..b65b87260 100644 --- a/src/pocketmine/block/Trapdoor.php +++ b/src/pocketmine/block/Trapdoor.php @@ -156,4 +156,8 @@ class Trapdoor extends Transparent{ public function getToolType(){ return Tool::TYPE_AXE; } + + public function getFuelTime() : int{ + return 300; + } } diff --git a/src/pocketmine/block/Wood.php b/src/pocketmine/block/Wood.php index 5d9e1b605..46c8dac06 100644 --- a/src/pocketmine/block/Wood.php +++ b/src/pocketmine/block/Wood.php @@ -78,4 +78,8 @@ class Wood extends Solid{ public function getToolType(){ return Tool::TYPE_AXE; } + + public function getFuelTime() : int{ + return 300; + } } \ No newline at end of file diff --git a/src/pocketmine/block/WoodenPressurePlate.php b/src/pocketmine/block/WoodenPressurePlate.php index 09be38f71..47e420e10 100644 --- a/src/pocketmine/block/WoodenPressurePlate.php +++ b/src/pocketmine/block/WoodenPressurePlate.php @@ -34,4 +34,8 @@ class WoodenPressurePlate extends StonePressurePlate{ public function getName(){ return "Wooden Pressure Plate"; } + + public function getFuelTime() : int{ + return 300; + } } diff --git a/src/pocketmine/block/WoodenSlab.php b/src/pocketmine/block/WoodenSlab.php index 1e8ec8a2b..067655c8e 100644 --- a/src/pocketmine/block/WoodenSlab.php +++ b/src/pocketmine/block/WoodenSlab.php @@ -134,4 +134,8 @@ class WoodenSlab extends Transparent{ [$this->id, $this->meta & 0x07, 1], ]; } + + public function getFuelTime() : int{ + return 300; + } } \ No newline at end of file diff --git a/src/pocketmine/inventory/Fuel.php b/src/pocketmine/inventory/Fuel.php deleted file mode 100644 index d7862b4c9..000000000 --- a/src/pocketmine/inventory/Fuel.php +++ /dev/null @@ -1,60 +0,0 @@ - 1600, - Item::COAL_BLOCK => 16000, - Item::WOOD => 300, - Item::WOODEN_PLANKS => 300, - Item::SAPLING => 100, - Item::WOODEN_AXE => 200, - Item::WOODEN_PICKAXE => 200, - Item::WOODEN_SWORD => 200, - Item::WOODEN_SHOVEL => 200, - Item::WOODEN_HOE => 200, - Item::STICK => 100, - Item::FENCE => 300, - Item::FENCE_GATE => 300, - Item::SPRUCE_FENCE_GATE => 300, - Item::BIRCH_FENCE_GATE => 300, - Item::JUNGLE_FENCE_GATE => 300, - Item::ACACIA_FENCE_GATE => 300, - Item::DARK_OAK_FENCE_GATE => 300, - Item::WOODEN_STAIRS => 300, - Item::SPRUCE_STAIRS => 300, - Item::BIRCH_STAIRS => 300, - Item::JUNGLE_STAIRS => 300, - Item::TRAPDOOR => 300, - Item::WORKBENCH => 300, - Item::BOOKSHELF => 300, - Item::CHEST => 300, - Item::BUCKET => 20000, - ]; - -} \ No newline at end of file diff --git a/src/pocketmine/item/Boat.php b/src/pocketmine/item/Boat.php index 222a202f1..b2bab71f7 100644 --- a/src/pocketmine/item/Boat.php +++ b/src/pocketmine/item/Boat.php @@ -27,4 +27,8 @@ class Boat extends Item{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::BOAT, $meta, $count, "Boat"); } + + public function getFuelTime() : int{ + return 1200; //400 in PC + } } diff --git a/src/pocketmine/item/Bow.php b/src/pocketmine/item/Bow.php index a407dc715..20051c3b9 100644 --- a/src/pocketmine/item/Bow.php +++ b/src/pocketmine/item/Bow.php @@ -29,4 +29,8 @@ class Bow extends Tool{ parent::__construct(self::BOW, $meta, $count, "Bow"); } + public function getFuelTime() : int{ + return 200; + } + } \ No newline at end of file diff --git a/src/pocketmine/item/Bucket.php b/src/pocketmine/item/Bucket.php index d276d04d1..44b2c5382 100644 --- a/src/pocketmine/item/Bucket.php +++ b/src/pocketmine/item/Bucket.php @@ -39,6 +39,14 @@ class Bucket extends Item{ return 1; } + public function getFuelTime() : int{ + if($this->meta === Block::LAVA or $this->meta === Block::FLOWING_LAVA){ + return 20000; + } + + return 0; + } + public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $targetBlock = Block::get($this->meta); diff --git a/src/pocketmine/item/Coal.php b/src/pocketmine/item/Coal.php index c75f2b708..1dd48ab47 100644 --- a/src/pocketmine/item/Coal.php +++ b/src/pocketmine/item/Coal.php @@ -32,4 +32,8 @@ class Coal extends Item{ } } + public function getFuelTime() : int{ + return 1600; + } + } \ No newline at end of file diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 29902a02c..d79bccfc4 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -28,7 +28,6 @@ namespace pocketmine\item; use pocketmine\block\Block; use pocketmine\entity\Entity; -use pocketmine\inventory\Fuel; use pocketmine\item\enchantment\Enchantment; use pocketmine\level\Level; use pocketmine\nbt\NBT; @@ -917,15 +916,12 @@ class Item implements ItemIds, \JsonSerializable{ return 64; } - final public function getFuelTime(){ - if(!isset(Fuel::$duration[$this->id])){ - return null; - } - if($this->id !== self::BUCKET or $this->meta === 10){ - return Fuel::$duration[$this->id]; - } - - return null; + /** + * Returns the time in ticks which the item will fuel a furnace for. + * @return int + */ + public function getFuelTime() : int{ + return 0; } /** diff --git a/src/pocketmine/item/ItemBlock.php b/src/pocketmine/item/ItemBlock.php index 192c055dd..c7ea32080 100644 --- a/src/pocketmine/item/ItemBlock.php +++ b/src/pocketmine/item/ItemBlock.php @@ -43,4 +43,8 @@ class ItemBlock extends Item{ return $this->block; } + public function getFuelTime() : int{ + return $this->block->getFuelTime(); + } + } \ No newline at end of file diff --git a/src/pocketmine/item/Stick.php b/src/pocketmine/item/Stick.php index 435c2a6e7..fd02c6023 100644 --- a/src/pocketmine/item/Stick.php +++ b/src/pocketmine/item/Stick.php @@ -29,4 +29,8 @@ class Stick extends Item{ parent::__construct(self::STICK, $meta, $count, "Stick"); } + public function getFuelTime() : int{ + return 5; + } + } \ No newline at end of file diff --git a/src/pocketmine/item/WoodenAxe.php b/src/pocketmine/item/WoodenAxe.php index 3321a05cf..5def14b7d 100644 --- a/src/pocketmine/item/WoodenAxe.php +++ b/src/pocketmine/item/WoodenAxe.php @@ -32,4 +32,8 @@ class WoodenAxe extends Tool{ public function isAxe(){ return Tool::TIER_WOODEN; } + + public function getFuelTime() : int{ + return 200; + } } diff --git a/src/pocketmine/item/WoodenHoe.php b/src/pocketmine/item/WoodenHoe.php index d19823164..b9926cc0e 100644 --- a/src/pocketmine/item/WoodenHoe.php +++ b/src/pocketmine/item/WoodenHoe.php @@ -32,4 +32,8 @@ class WoodenHoe extends Tool{ public function isHoe(){ return Tool::TIER_WOODEN; } + + public function getFuelTime() : int{ + return 200; + } } \ No newline at end of file diff --git a/src/pocketmine/item/WoodenPickaxe.php b/src/pocketmine/item/WoodenPickaxe.php index e0f59b3f9..66d28b537 100644 --- a/src/pocketmine/item/WoodenPickaxe.php +++ b/src/pocketmine/item/WoodenPickaxe.php @@ -32,4 +32,8 @@ class WoodenPickaxe extends Tool{ public function isPickaxe(){ return Tool::TIER_WOODEN; } + + public function getFuelTime() : int{ + return 200; + } } diff --git a/src/pocketmine/item/WoodenShovel.php b/src/pocketmine/item/WoodenShovel.php index df85b017b..e12907a47 100644 --- a/src/pocketmine/item/WoodenShovel.php +++ b/src/pocketmine/item/WoodenShovel.php @@ -32,4 +32,8 @@ class WoodenShovel extends Tool{ public function isShovel(){ return Tool::TIER_WOODEN; } + + public function getFuelTime() : int{ + return 200; + } } diff --git a/src/pocketmine/item/WoodenSword.php b/src/pocketmine/item/WoodenSword.php index 4a85a40b5..5a1d52643 100644 --- a/src/pocketmine/item/WoodenSword.php +++ b/src/pocketmine/item/WoodenSword.php @@ -32,4 +32,8 @@ class WoodenSword extends Tool{ public function isSword(){ return Tool::TIER_WOODEN; } + + public function getFuelTime() : int{ + return 200; + } } diff --git a/src/pocketmine/tile/Furnace.php b/src/pocketmine/tile/Furnace.php index 966701a74..57431d39b 100644 --- a/src/pocketmine/tile/Furnace.php +++ b/src/pocketmine/tile/Furnace.php @@ -218,7 +218,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{ $smelt = $this->server->getCraftingManager()->matchFurnaceRecipe($raw); $canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product) and $product->getCount() < $product->getMaxStackSize()) or $product->getId() === Item::AIR)); - if($this->namedtag->BurnTime->getValue() <= 0 and $canSmelt and $fuel->getFuelTime() !== null and $fuel->getCount() > 0){ + if($this->namedtag->BurnTime->getValue() <= 0 and $canSmelt and $fuel->getFuelTime() > 0 and $fuel->getCount() > 0){ $this->checkFuel($fuel); }