From 68b585fba77abafc31c1f1375c80220f79f8eea6 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 7 Jun 2022 18:19:35 -0700 Subject: [PATCH] Fix cook speed patch --- .../0263-Implement-furnace-cook-speed-multiplier-API.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch index 4fa61122bf..ef1f41e68e 100644 --- a/patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch @@ -11,7 +11,7 @@ to the nearest Integer when updating its current cook time. Modified by: Eric Su diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index bbccb2f97ee88fe43af4eec30fbb2ecea1ebb1b4..a46b2ab813d17b56761e562a49c3cd4112b9def7 100644 +index bbccb2f97ee88fe43af4eec30fbb2ecea1ebb1b4..d3a9b42fd4fa487e0acb1c95d57f78ccfbefbdff 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java @@ -76,11 +76,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -84,9 +84,9 @@ index bbccb2f97ee88fe43af4eec30fbb2ecea1ebb1b4..a46b2ab813d17b56761e562a49c3cd41 - private static int getTotalCookTime(Level world, AbstractFurnaceBlockEntity furnace) { - return (world != null) ? (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map(AbstractCookingRecipe::getCookingTime).orElse(200) : 200; // CraftBukkit - SPIGOT-4302 + // Paper start -+ public static int getTotalCookTime(Level world, RecipeType recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { ++ public static int getTotalCookTime(@Nullable Level world, RecipeType recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { + /* Scale the recipe's cooking time to the current cookSpeedMultiplier */ -+ int cookTime = world == null ? furnace.quickCheck.getRecipeFor(furnace, world).map(AbstractCookingRecipe::getCookingTime).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(AbstractCookingRecipe::getCookingTime).orElse(200)); ++ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(AbstractCookingRecipe::getCookingTime).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(AbstractCookingRecipe::getCookingTime).orElse(200)); + return (int) Math.ceil (cookTime / cookSpeedMultiplier); } + // Paper end