diff --git a/Spigot-Server-Patches/Cache-burn-durations.patch b/Spigot-Server-Patches/Cache-burn-durations.patch index e938bf64f2..a5e6310e3b 100644 --- a/Spigot-Server-Patches/Cache-burn-durations.patch +++ b/Spigot-Server-Patches/Cache-burn-durations.patch @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - } + // Paper end public static boolean isFuel(ItemStack itemstack) { - return f().containsKey(itemstack.getItem()); diff --git a/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch b/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch index 1d56207860..c4604dccbd 100644 --- a/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch +++ b/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch @@ -5,6 +5,11 @@ Subject: [PATCH] Implement furnace cook speed multiplier API Signed-off-by: Tassu +Fixed an issue where a furnace's cook-speed multiplier rounds down +to the nearest Integer when updating its current cook time. + +Modified by: Eric Su + diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -46,16 +51,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 NBTTagCompound nbttagcompound1 = new NBTTagCompound(); @@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - } if (this.isBurning() && this.canBurn(irecipe)) { -- ++this.cookTime; + ++this.cookTime; - if (this.cookTime == this.cookTimeTotal) { -+ this.cookTime += cookSpeedMultiplier; // Paper - cook speed multiplier API + if (this.cookTime >= this.cookTimeTotal) { // Paper - cook speed multiplier API this.cookTime = 0; this.cookTimeTotal = this.getRecipeCookingTime(); this.burn(irecipe); +@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I + } + } + +- protected int getRecipeCookingTime() { +- return (this.hasWorld()) ? (Integer) this.world.getCraftingManager().craft((Recipes) this.c, this, this.world).map(RecipeCooking::getCookingTime).orElse(200) : 200; // CraftBukkit - SPIGOT-4302 // Eclipse fail ++ // Paper begin - Expose this function so CraftFurnace can correctly scale the total cooking time to a new multiplier ++ public int getRecipeCookingTime() { ++ /* Scale the recipe's cooking time to the current cookSpeedMultiplier */ ++ int cookTime = (this.hasWorld()) ? (Integer) this.world.getCraftingManager().craft((Recipes) this.c, this, this.world).map(RecipeCooking::getCookingTime).orElse(200) : 200; // CraftBukkit - SPIGOT-4302 // Eclipse fail ++ return (int) Math.ceil (cookTime / this.cookSpeedMultiplier); + } ++ // Paper end + + public static boolean isFuel(ItemStack itemstack) { + return f().containsKey(itemstack.getItem()); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -75,7 +94,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setCookSpeedMultiplier(double multiplier) { + com.google.common.base.Preconditions.checkArgument(multiplier >= 0, "Furnace speed multiplier cannot be negative"); + com.google.common.base.Preconditions.checkArgument(multiplier <= 200, "Furnace speed multiplier cannot more than 200"); -+ this.getSnapshot().cookSpeedMultiplier = multiplier; ++ T snapshot = this.getSnapshot(); ++ snapshot.cookSpeedMultiplier = multiplier; ++ snapshot.cookTimeTotal = snapshot.getRecipeCookingTime(); // Update the snapshot's current total cook time to scale with the newly set multiplier + } + // Paper end }