Paper/Spigot-Server-Patches/0355-Implement-furnace-cook-speed-multiplier-API.patch
Shane Freeder ea855e2b46 Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Developers!: You will need to clean up your work/Minecraft/1.13.2 folder
for this

Also, restore a patch that was dropped in the last upstream

Bukkit Changes:
279eeab3 Fix command description not being set
96e2bb18 Remove debug print from SyntheticEventTest

CraftBukkit Changes:
d3ed1516 Fix dangerously threaded beacons
217a293d Don't relocate joptsimple to allow --help to work.
1be05a21 Prepare for imminent Java 12 release
a49270b2 Mappings Update
5259d80c SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports

Spigot Changes:
e6eb36f2 Rebuild patches
2019-03-20 01:55:16 +00:00

85 lines
3.9 KiB
Diff

From e6278f7b1afddb39628b007f2f651679894c54e9 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 5b6ccfa9f..bfbd35bbe 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -9,6 +9,7 @@ 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;
@@ -25,6 +26,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
private NonNullList<ItemStack> items;
private int burnTime;
private int ticksForCurrentFuel;
+ public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API
private int cookTime;
private int cookTimeTotal;
private IChatBaseComponent l;
@@ -218,6 +220,11 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
this.l = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
}
+ // Paper start - cook speed API
+ if (nbttagcompound.hasKey("Paper.CookSpeedMultiplier")) {
+ this.cookSpeedMultiplier = nbttagcompound.getDouble("Paper.CookSpeedMultiplier");
+ }
+ // Paper end
}
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
@@ -225,6 +232,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
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.m.size());
int i = 0;
@@ -299,8 +307,8 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
}
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.s();
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 c2eea8ce0..429c780ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -84,4 +84,18 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
furnace.setCustomName(null);
}
}
+
+ // 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
}
--
2.21.0