diff --git a/CHANGELOG.md b/CHANGELOG.md index 02769046b..1066e6b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ #### Fixes * Fixed #2862 +* Fixed #2887 +* Fixed items getting deleted when breaking enhanced furnaces ## Release Candidate 21 (14 Mar 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/EnhancedFurnace.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/EnhancedFurnace.java index 44f16b9cf..2554f1d29 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/EnhancedFurnace.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/EnhancedFurnace.java @@ -2,12 +2,15 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.blocks; import java.util.concurrent.ThreadLocalRandom; +import javax.annotation.Nonnull; + import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Furnace; import org.bukkit.inventory.ItemStack; +import io.github.thebusybiscuit.slimefun4.implementation.handlers.VanillaInventoryDropHandler; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; import io.papermc.lib.PaperLib; import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult; @@ -41,6 +44,8 @@ public class EnhancedFurnace extends SimpleSlimefunItem { this.speed = speed - 1; this.efficiency = efficiency - 1; this.fortuneLevel = fortune - 1; + + addItemHandler(new VanillaInventoryDropHandler<>(Furnace.class)); } /** @@ -100,7 +105,7 @@ public class EnhancedFurnace extends SimpleSlimefunItem { }; } - private void setProgress(Furnace furnace) { + private void setProgress(@Nonnull Furnace furnace) { // Update the cooktime int cookTime = furnace.getCookTime() + getProcessingSpeed() * 10; furnace.setCookTime((short) Math.min(cookTime, furnace.getCookTimeTotal() - 1));