Paper/Spigot-Server-Patches/0406-Fix-zero-tick-instant-grow-farms-MC-113809.patch
Shane Freeder f8fd607e04
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

Bukkit Changes:
bbfd13dd Hyperlink 'Events' in raid event package documentation
b2095bed SPIGOT-5413: Add TrustedPlayer API for foxes
1bf1f3f4 Block trace methods do not require hash sets
abf0cfdc Javadoc improvements per checkstyle
c4a2b425 Add TimeSkipEvent

CraftBukkit Changes:
817116de SPIGOT-5413: Add TrustedPlayer API for foxes
062680a8 SPIGOT-5467: Calm down bees that cannot exit hive
75fac431 SPIGOT-5472: Spurious warning when using clone command on tile entities
85106731 SPIGOT-5471: Allow empty title/author for books
2d9db47f Add TimeSkipEvent
384225c2 Add thread name to TerminalConsoleWriterThread

Spigot Changes:
05bb8bcf Postpone stopping the watchdog until the server is completely stopped
18e2b9be Add package-info.java for Spigot APIs
2019-12-23 02:37:47 +00:00

100 Zeilen
5.6 KiB
Diff

From 9503a0663360f9ef64ac72b5b8799aa15a9d709c Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Sun, 15 Sep 2019 11:32:32 -0500
Subject: [PATCH] Fix zero-tick instant grow farms MC-113809
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 33e251c87..c0af1aaf3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -564,6 +564,11 @@ public class PaperWorldConfig {
disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
}
+ public boolean fixZeroTickInstantGrowFarms = true;
+ private void fixZeroTickInstantGrowFarms() {
+ fixZeroTickInstantGrowFarms = getBoolean("fix-zero-tick-instant-grow-farms", fixZeroTickInstantGrowFarms);
+ }
+
public boolean altItemDespawnRateEnabled;
public Map<Material, Integer> altItemDespawnRateMap;
private void altItemDespawnRate() {
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 540fcce1d..e29ec958b 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -46,6 +46,7 @@ public class Block implements IMaterial {
private final float g;
protected final BlockStateList<Block, IBlockData> blockStateList;
private IBlockData blockData;
+ public boolean randomTick = false; // Paper - fix MC-113809
protected final boolean v;
private final boolean i;
private final boolean j;
diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java
index c482aad3e..02c548dd9 100644
--- a/src/main/java/net/minecraft/server/BlockBamboo.java
+++ b/src/main/java/net/minecraft/server/BlockBamboo.java
@@ -85,6 +85,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
if (!iblockdata.canPlace(worldserver, blockposition)) {
worldserver.b(blockposition, true);
} else if ((Integer) iblockdata.get(BlockBamboo.f) == 0) {
+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot
int i = this.b(worldserver, blockposition) + 1;
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index e0974e256..3524fcb92 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -21,6 +21,7 @@ public class BlockCactus extends Block {
if (!iblockdata.canPlace(worldserver, blockposition)) {
worldserver.b(blockposition, true);
} else {
+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
BlockPosition blockposition1 = blockposition.up();
if (worldserver.isEmpty(blockposition1)) {
diff --git a/src/main/java/net/minecraft/server/BlockChorusFlower.java b/src/main/java/net/minecraft/server/BlockChorusFlower.java
index d70b52cad..b624cf380 100644
--- a/src/main/java/net/minecraft/server/BlockChorusFlower.java
+++ b/src/main/java/net/minecraft/server/BlockChorusFlower.java
@@ -22,6 +22,7 @@ public class BlockChorusFlower extends Block {
if (!iblockdata.canPlace(worldserver, blockposition)) {
worldserver.b(blockposition, true);
} else {
+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
BlockPosition blockposition1 = blockposition.up();
if (worldserver.isEmpty(blockposition1) && blockposition1.getY() < 256) {
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 55b07444e..3bc3c5aa2 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -23,6 +23,7 @@ public class BlockReed extends Block {
if (!iblockdata.canPlace(worldserver, blockposition)) {
worldserver.b(blockposition, true);
} else if (worldserver.isEmpty(blockposition.up())) {
+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
int i;
for (i = 1; worldserver.getType(blockposition.down(i)).getBlock() == this; ++i) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index f2d9392a0..70cbff313 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -590,7 +590,9 @@ public class WorldServer extends World {
IBlockData iblockdata = chunksection.getType(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k);
if (iblockdata.q()) {
+ iblockdata.getBlock().randomTick = true; // Paper - fix MC-113809
iblockdata.b(this, blockposition2, this.random);
+ iblockdata.getBlock().randomTick = false; // Paper - fix MC-113809
}
Fluid fluid = iblockdata.getFluid();
--
2.24.1