Fix NPE when setting cook multiplier (#5956)

This commit is contained in:
Jake Potrebic 2021-06-22 12:26:03 -07:00
parent 5b8a29a0cc
commit 7c2140bc63
2 changed files with 3 additions and 1 deletions

View file

@ -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

View file

@ -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
}