From 9ced122cc9adf2538b6fa1a8d16e11b840bc1f70 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 --- .../server/Implement-furnace-cook-speed-multiplier-API.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/server/Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch index 95c1900f44..1138accfb7 100644 --- a/patches/server/Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch @@ -84,9 +84,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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