Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
36f34f01c0
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
82 Zeilen
4.0 KiB
Diff
82 Zeilen
4.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tassu <git@tassu.me>
|
|
Date: Thu, 13 Sep 2018 08:45:21 +0300
|
|
Subject: [PATCH] Implement furnace cook speed multiplier API
|
|
|
|
Signed-off-by: Tassu <git@tassu.me>
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
|
index 560e2f42b702c5c4870640ad7da3aa48c3f4b1eb..d5432bfeb727baadd8614384d3e50314de5f8dc4 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
|
@@ -8,6 +8,7 @@ import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import javax.annotation.Nullable;
|
|
// CraftBukkit start
|
|
+import java.util.List;
|
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
@@ -26,6 +27,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
|
protected NonNullList<ItemStack> items;
|
|
public int burnTime;
|
|
private int ticksForCurrentFuel;
|
|
+ public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API
|
|
public int cookTime;
|
|
public int cookTimeTotal;
|
|
protected final IContainerProperties b;
|
|
@@ -212,6 +214,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
|
this.n.put(minecraftkey, j);
|
|
}
|
|
|
|
+ // Paper start - cook speed API
|
|
+ if (nbttagcompound.hasKey("Paper.CookSpeedMultiplier")) {
|
|
+ this.cookSpeedMultiplier = nbttagcompound.getDouble("Paper.CookSpeedMultiplier");
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
@@ -220,6 +227,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
|
nbttagcompound.setShort("BurnTime", (short) this.burnTime);
|
|
nbttagcompound.setShort("CookTime", (short) this.cookTime);
|
|
nbttagcompound.setShort("CookTimeTotal", (short) this.cookTimeTotal);
|
|
+ nbttagcompound.setDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API
|
|
ContainerUtil.a(nbttagcompound, this.items);
|
|
nbttagcompound.setShort("RecipesUsedSize", (short) this.n.size());
|
|
int i = 0;
|
|
@@ -283,8 +291,8 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
|
}
|
|
|
|
if (this.isBurning() && this.canBurn(irecipe)) {
|
|
- ++this.cookTime;
|
|
- if (this.cookTime == this.cookTimeTotal) {
|
|
+ this.cookTime += cookSpeedMultiplier; // Paper - cook speed multiplier API
|
|
+ if (this.cookTime >= this.cookTimeTotal) { // Paper - cook speed multiplier API
|
|
this.cookTime = 0;
|
|
this.cookTimeTotal = this.getRecipeCookingTime();
|
|
this.burn(irecipe);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
|
|
index 9cc67915cacf2920334bc9affede84c786e7172f..1ce10ea049ec86a61bc6179c8606193bc21a7a3f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
|
|
@@ -63,4 +63,18 @@ public class CraftFurnace<T extends TileEntityFurnace> extends CraftContainer<T>
|
|
public void setCookTimeTotal(int cookTimeTotal) {
|
|
this.getSnapshot().cookTimeTotal = cookTimeTotal;
|
|
}
|
|
+
|
|
+ // Paper start - cook speed multiplier API
|
|
+ @Override
|
|
+ public double getCookSpeedMultiplier() {
|
|
+ return this.getSnapshot().cookSpeedMultiplier;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCookSpeedMultiplier(double multiplier) {
|
|
+ com.google.common.base.Preconditions.checkArgument(multiplier >= 0, "Furnace speed multiplier cannot be negative");
|
|
+ com.google.common.base.Preconditions.checkArgument(multiplier <= 200, "Furnace speed multiplier cannot more than 200");
|
|
+ this.getSnapshot().cookSpeedMultiplier = multiplier;
|
|
+ }
|
|
+ // Paper end
|
|
}
|