f37381ea8a
Removes synchronization from sending packets Makes normal packet sends no longer need to be wrapped and queued like it use to work. Adds more packet queue immunities on top of keep alive to let the following scenarios go out without delay: - Keep Alive - Chat - Kick - All of the packets during the Player Joined World event Hoping that latter one helps join timeout issues more too for slow connections. Removes processing packet queue off of main thread - for the few cases where it is allowed, order is not necessary nor should it even be happening concurrently in first place (handshaking/login/status) Ensures packets sent asynchronously are dispatched on main thread This helps ensure safety for ProtocolLib as packet listeners are commonly accessing world state. This will allow you to schedule a packet to be sent async, but itll be dispatched sync for packet listeners to process. This should solve some deadlock risks This may provide a decent performance improvement because thread synchronization incurs a cache reset so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really hot activity.
100 Zeilen
5.6 KiB
Diff
100 Zeilen
5.6 KiB
Diff
From 448237ec196c32d672999706de094510b261366e 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 928fefb4195..44210855560 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -554,6 +554,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 540fcce1dd4..e29ec958b35 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 c482aad3e3e..02c548dd9c9 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 e0974e256f0..3524fcb9278 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 d70b52cadf1..b624cf38047 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 55b07444e1d..3bc3c5aa29f 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 38c5b721bf1..17560a20fce 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -589,7 +589,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.26.2
|
|
|