2019-10-27 06:55:58 +08:00
|
|
|
From 0bf48165d5c0504425d76d328c1f74a143af541e Mon Sep 17 00:00:00 2001
|
2019-09-28 07:10:20 +08:00
|
|
|
From: Phoenix616 <mail@moep.tv>
|
2019-09-23 12:07:01 +08:00
|
|
|
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
|
2019-10-27 06:55:58 +08:00
|
|
|
index 7723b1c15..af07f9a16 100644
|
2019-09-23 12:07:01 +08:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-10-27 06:55:58 +08:00
|
|
|
@@ -573,6 +573,11 @@ public class PaperWorldConfig {
|
2019-09-23 12:07:01 +08: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
|
2019-10-27 06:55:58 +08:00
|
|
|
index e077359b0..619237d68 100644
|
2019-09-23 12:07:01 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/Block.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Block.java
|
|
|
|
@@ -44,6 +44,7 @@ public class Block implements IMaterial {
|
|
|
|
private final float frictionFactor;
|
|
|
|
protected final BlockStateList<Block, IBlockData> blockStateList;
|
|
|
|
private IBlockData blockData;
|
|
|
|
+ public boolean randomTick = false; // Paper - fix MC-113809
|
|
|
|
protected final boolean v;
|
|
|
|
private final boolean g;
|
|
|
|
@Nullable
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java
|
2019-10-27 06:55:58 +08:00
|
|
|
index ffb65776c..3a9c3b54a 100644
|
2019-09-23 12:07:01 +08: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(world, blockposition)) {
|
|
|
|
world.b(blockposition, true);
|
|
|
|
} else if ((Integer) iblockdata.get(BlockBamboo.f) == 0) {
|
|
|
|
+ if (world.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
|
|
|
|
if (world.random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmpty(blockposition.up()) && world.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot
|
|
|
|
int i = this.b((IBlockAccess) world, blockposition) + 1;
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
|
2019-10-27 06:55:58 +08:00
|
|
|
index 29f9ff6c1..124b4b4b0 100644
|
2019-09-23 12:07:01 +08: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(world, blockposition)) {
|
|
|
|
world.b(blockposition, true);
|
|
|
|
} else {
|
|
|
|
+ if (world.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
|
|
|
|
BlockPosition blockposition1 = blockposition.up();
|
|
|
|
|
|
|
|
if (world.isEmpty(blockposition1)) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockChorusFlower.java b/src/main/java/net/minecraft/server/BlockChorusFlower.java
|
2019-10-27 06:55:58 +08:00
|
|
|
index 74fa4889f..cde2524ca 100644
|
2019-09-23 12:07:01 +08: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(world, blockposition)) {
|
|
|
|
world.b(blockposition, true);
|
|
|
|
} else {
|
|
|
|
+ if (world.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
|
|
|
|
BlockPosition blockposition1 = blockposition.up();
|
|
|
|
|
|
|
|
if (world.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
|
2019-10-27 06:55:58 +08:00
|
|
|
index ff674a9d5..a4850c070 100644
|
2019-09-23 12:07:01 +08: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(world, blockposition)) {
|
|
|
|
world.b(blockposition, true);
|
|
|
|
} else if (world.isEmpty(blockposition.up())) {
|
|
|
|
+ if (world.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1; world.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
|
2019-10-27 06:55:58 +08:00
|
|
|
index bd1e4dbae..5b18f4bd5 100644
|
2019-09-23 12:07:01 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2019-10-20 17:03:39 +08:00
|
|
|
@@ -568,7 +568,9 @@ public class WorldServer extends World {
|
2019-09-23 12:07:01 +08:00
|
|
|
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((World) this, blockposition2, this.random);
|
|
|
|
+ iblockdata.getBlock().randomTick = false; // Paper - fix MC-113809
|
|
|
|
}
|
|
|
|
|
|
|
|
Fluid fluid = iblockdata.p();
|
|
|
|
--
|
2019-10-27 06:55:58 +08:00
|
|
|
2.23.0
|
2019-09-23 12:07:01 +08:00
|
|
|
|