1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Fixed Enhanced Furnace not dropping any items when broken

This commit is contained in:
TheBusyBiscuit 2021-03-19 00:39:41 +01:00
parent 44dbb34d9a
commit 8161b9ee6d
2 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,8 @@
#### Fixes #### Fixes
* Fixed #2862 * Fixed #2862
* Fixed #2887
* Fixed items getting deleted when breaking enhanced furnaces
## Release Candidate 21 (14 Mar 2021) ## Release Candidate 21 (14 Mar 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21 https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21

View File

@ -2,12 +2,15 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.blocks;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nonnull;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace; import org.bukkit.block.Furnace;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.handlers.VanillaInventoryDropHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult; import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult;
@ -41,6 +44,8 @@ public class EnhancedFurnace extends SimpleSlimefunItem<BlockTicker> {
this.speed = speed - 1; this.speed = speed - 1;
this.efficiency = efficiency - 1; this.efficiency = efficiency - 1;
this.fortuneLevel = fortune - 1; this.fortuneLevel = fortune - 1;
addItemHandler(new VanillaInventoryDropHandler<>(Furnace.class));
} }
/** /**
@ -100,7 +105,7 @@ public class EnhancedFurnace extends SimpleSlimefunItem<BlockTicker> {
}; };
} }
private void setProgress(Furnace furnace) { private void setProgress(@Nonnull Furnace furnace) {
// Update the cooktime // Update the cooktime
int cookTime = furnace.getCookTime() + getProcessingSpeed() * 10; int cookTime = furnace.getCookTime() + getProcessingSpeed() * 10;
furnace.setCookTime((short) Math.min(cookTime, furnace.getCookTimeTotal() - 1)); furnace.setCookTime((short) Math.min(cookTime, furnace.getCookTimeTotal() - 1));