Fix cook speed patch

This commit is contained in:
Jake Potrebic 2022-06-07 18:19:35 -07:00
parent a16970ac1b
commit 68b585fba7
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5

View File

@ -11,7 +11,7 @@ to the nearest Integer when updating its current cook time.
Modified by: Eric Su <ericsu@alumni.usc.edu>
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<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) {
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> 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