2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-12-13 22:41:00 +00:00
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 928fefb4195bd5d629b59b2b3c7d005b79bdf161..442108555604b06c6217f4330c19b4997451126c 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-05-06 08:35:20 +00:00
|
|
|
@@ -554,6 +554,11 @@ public class PaperWorldConfig {
|
2019-12-13 22:41:00 +00:00
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 540fcce1dd4d64dee51e2594f2199fac5299c6a0..e29ec958b3519d92cda215a50e97e6852d71c684 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- 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
|
2020-05-06 09:48:49 +00:00
|
|
|
index c482aad3e3e255dfe13b622859ed61b780a9e08e..02c548dd9c9a97bfb55d39ba2f6d4ab85ada0573 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- 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
|
2020-05-06 09:48:49 +00:00
|
|
|
index e0974e256f0f10e047b9eb8e362982c6578d2d98..3524fcb927865d7b8754d9fbf85b853f09b94bb8 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- 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
|
2020-05-06 09:48:49 +00:00
|
|
|
index d70b52cadf1b76eff7984127837b0a3aa36f6a0e..b624cf38047e242569d30ee4e3ad971455b5ff0a 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- 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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 55b07444e1d769952f2a411b1b5d1032565af8a1..3bc3c5aa29f45cd2ee1c0401b1ee1b1d49e81926 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- 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
|
2020-06-02 03:15:47 +00:00
|
|
|
index 1838add259a1a2919a80cc5d773ed89ed5d73c01..fe84d8b33733391cf58215d92f8f31d6ac107f0a 100644
|
2019-12-13 22:41:00 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2020-03-19 06:03:32 +00:00
|
|
|
@@ -589,7 +589,9 @@ public class WorldServer extends World {
|
2019-12-13 22:48:40 +00:00
|
|
|
IBlockData iblockdata = chunksection.getType(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k);
|
2019-12-13 22:41:00 +00:00
|
|
|
|
2019-12-13 22:48:40 +00:00
|
|
|
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
|
|
|
|
}
|
2019-12-13 22:41:00 +00:00
|
|
|
|
2019-12-13 22:48:40 +00:00
|
|
|
Fluid fluid = iblockdata.getFluid();
|