From 7c2140bc63ce8098d6ecdd161d88834bad149d88 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 22 Jun 2021 12:26:03 -0700 Subject: [PATCH] Fix NPE when setting cook multiplier (#5956) --- build-data/paper.at | 2 ++ .../server/Implement-furnace-cook-speed-multiplier-API.patch | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build-data/paper.at b/build-data/paper.at index e3c2910ea1..bc8ecf325f 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -223,3 +223,5 @@ public net.minecraft.world.entity.animal.Fox setDefending(Z)V public net.minecraft.world.entity.animal.Fox isFaceplanted()Z public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V +# Cook speed multipler API +public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipeType diff --git a/patches/server/Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch index c1705faa6c..837e4e19b6 100644 --- a/patches/server/Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch @@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + com.google.common.base.Preconditions.checkArgument(multiplier <= 200, "Furnace speed multiplier cannot more than 200"); + T snapshot = this.getSnapshot(); + snapshot.cookSpeedMultiplier = multiplier; -+ snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.world.getHandle(), snapshot.getCurrentRecipe().getType(), ((CraftInventoryFurnace) this.getInventory()).getInventory(), snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier ++ snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.world.getHandle(), snapshot.recipeType, snapshot, snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier + } + // Paper end }