Archiviert
13
0

Fix NPE when setting cook multiplier (#5956)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-06-22 12:26:03 -07:00 committet von GitHub
Ursprung 3c58c05c8c
Commit 28aacb44dd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -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 cfa095d39843dd4963c817b824228a4b48a8c1cd..60cbb6616851758c7b8a9c90f4bb7e169358f123 100644
index e43fd7185b4570713d8ee2361d633c94d187fe2b..6c8518cdf768bd2b613f3f2159d977d2035921c1 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
@@ -71,6 +71,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -80,7 +80,7 @@ index cfa095d39843dd4963c817b824228a4b48a8c1cd..60cbb6616851758c7b8a9c90f4bb7e16
this.setChanged();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index 5028a6388f95a14df8d1590cddd7414d8de5bf78..a05704665f7718b189f0c60ae42c615fce408b0c 100644
index 5028a6388f95a14df8d1590cddd7414d8de5bf78..92c156b09cc46e5d70ed7d803683787248495a62 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -63,4 +63,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends
@ -100,7 +100,7 @@ index 5028a6388f95a14df8d1590cddd7414d8de5bf78..a05704665f7718b189f0c60ae42c615f
+ 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
}