Fix Village Loading Doors fix, add config option, hopefully fix farms

The patch was previously applied wrong, and still caused chunk loads.

Now, we will prevent it again, but also added a config option to
disable this optimization.

However, I also updated it so that doors are not removed if the chunk
the door is in is unloaded, so this should avoid breaking farms.

Fixes #1506
This commit is contained in:
Aikar 2018-09-29 12:03:11 -04:00
parent 08bb5b49d2
commit c64503c66f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
9 changed files with 96 additions and 50 deletions

View File

@ -0,0 +1,73 @@
From 4845bcc6753c152c5e32d4257e64204cfa31b4db Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 00:32:22 -0400
Subject: [PATCH] Configurable Villages loading chunks for door checks
This avoids villages spam loading chunks sync.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index af6b97708a..a005c8c4ec 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -420,4 +420,12 @@ public class PaperWorldConfig {
disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit);
log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
}
+
+ public boolean villagesLoadChunks = false;
+ private void villagesLoadChunks() {
+ villagesLoadChunks = getBoolean("game-mechanics.villages-load-chunks", false);
+ if (villagesLoadChunks) {
+ log("Villages can load chunks - Warning this can cause intense TPS loss. Strongly consider disabling this.");
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/PersistentVillage.java b/src/main/java/net/minecraft/server/PersistentVillage.java
index d14a9e3a3e..0be1bf0d99 100644
--- a/src/main/java/net/minecraft/server/PersistentVillage.java
+++ b/src/main/java/net/minecraft/server/PersistentVillage.java
@@ -123,7 +123,7 @@ public class PersistentVillage extends PersistentBase {
for(int j = -4; j < 4; ++j) {
for(int k = -16; k < 16; ++k) {
blockposition$mutableblockposition.g(blockposition).d(i, j, k);
- IBlockData iblockdata = this.world.getType(blockposition$mutableblockposition);
+ IBlockData iblockdata = this.world.paperConfig.villagesLoadChunks ? this.world.getType(blockposition$mutableblockposition) : this.world.getTypeIfLoaded(blockposition$mutableblockposition); // Paper
if (this.a(iblockdata)) {
VillageDoor villagedoor = this.c(blockposition$mutableblockposition);
if (villagedoor == null) {
@@ -193,7 +193,7 @@ public class PersistentVillage extends PersistentBase {
}
private boolean a(IBlockData iblockdata) {
- return iblockdata.getBlock() instanceof BlockDoor && iblockdata.getMaterial() == Material.WOOD;
+ return iblockdata != null && iblockdata.getBlock() instanceof BlockDoor && iblockdata.getMaterial() == Material.WOOD; // Paper
}
public void a(NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index bda67faefe..1cc9096f01 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -297,7 +297,7 @@ public class Village {
villagedoor.a();
}
- if (!this.g(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) {
+ if ((!this.g(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) && this.a.isLoaded(villagedoor.getPosition())) { // Paper - don't expire doors unless the chunk is loaded
this.c = this.c.b(villagedoor.d());
flag = true;
villagedoor.a(true);
@@ -312,7 +312,9 @@ public class Village {
}
private boolean g(BlockPosition blockposition) {
- IBlockData iblockdata = this.a.getType(blockposition);
+ IBlockData iblockdata = this.a.paperConfig.villagesLoadChunks ? this.a.getType(blockposition) : this.a.getTypeIfLoaded(blockposition); // Paper
+ if (iblockdata == null) return false; // Paper
+
Block block = iblockdata.getBlock();
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
--
2.19.0

View File

@ -1,27 +0,0 @@
From ce89171a068d36aadae71218295a109b6c1130c1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 00:32:22 -0400
Subject: [PATCH] Don't load chunks for villager door checks
This avoids villages spam loading chunks sync
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index bda67faefe..955041e266 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -313,6 +313,12 @@ public class Village {
private boolean g(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition);
+ // Paper start
+ if (!this.a.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4, true )) {
+ return false;
+ }
+ // Paper end
+
Block block = iblockdata.getBlock();
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
--
2.19.0

View File

@ -1,16 +1,16 @@
From c78f97b134af174507a4cb659970615d89100000 Mon Sep 17 00:00:00 2001 From b9ab361fdf72abfa18a4bf1d59ff06d654c97dfb Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 16 Jun 2018 01:18:16 -0500 Date: Sat, 16 Jun 2018 01:18:16 -0500
Subject: [PATCH] Make shield blocking delay configurable Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index af6b97708a..c0eccc22b7 100644 index a005c8c4ec..bd4cca26c7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -420,4 +420,9 @@ public class PaperWorldConfig { @@ -428,4 +428,9 @@ public class PaperWorldConfig {
disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit); log("Villages can load chunks - Warning this can cause intense TPS loss. Strongly consider disabling this.");
log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); }
} }
+ +
+ public int shieldBlockingDelay = 5; + public int shieldBlockingDelay = 5;

View File

@ -1,14 +1,14 @@
From 8569f8f147058e487d661fa5a4daae699a155bcd Mon Sep 17 00:00:00 2001 From 274b492a435a173f8fb6e7a94480a8326e3d421d Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 22 Jun 2018 10:38:31 -0500 Date: Fri, 22 Jun 2018 10:38:31 -0500
Subject: [PATCH] Add config to disable ender dragon legacy check Subject: [PATCH] Add config to disable ender dragon legacy check
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c0eccc22b7..e5e5d2447d 100644 index bd4cca26c7..85296e48db 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -425,4 +425,9 @@ public class PaperWorldConfig { @@ -433,4 +433,9 @@ public class PaperWorldConfig {
private void shieldBlockingDelay() { private void shieldBlockingDelay() {
shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5);
} }

View File

@ -1,4 +1,4 @@
From b02b8e33cdaf1d11a1a89f8c515cb4cdd8bddea8 Mon Sep 17 00:00:00 2001 From 5f218bd95d6d89e8e06ca7c2e882336bff075021 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 15:22:06 -0400 Date: Wed, 4 Jul 2018 15:22:06 -0400
Subject: [PATCH] Configurable Bed Search Radius Subject: [PATCH] Configurable Bed Search Radius
@ -10,10 +10,10 @@ player at their bed should it of became obstructed.
Defaults to vanilla 1. Defaults to vanilla 1.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e5e5d2447d..99986bac97 100644 index 85296e48db..deb0d4f053 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -430,4 +430,15 @@ public class PaperWorldConfig { @@ -438,4 +438,15 @@ public class PaperWorldConfig {
private void scanForLegacyEnderDragon() { private void scanForLegacyEnderDragon() {
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
} }

View File

@ -1,4 +1,4 @@
From 3d237c508504201a1ea5a957115422891600bb96 Mon Sep 17 00:00:00 2001 From fd4f9ec55426776628f3b5b415f2310988d46435 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 14:27:34 -0400 Date: Sat, 21 Jul 2018 14:27:34 -0400
Subject: [PATCH] Duplicate UUID Resolve Option Subject: [PATCH] Duplicate UUID Resolve Option
@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love. It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 99986bac97..1bfa9ad567 100644 index deb0d4f053..249af8b4c6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -441,4 +441,47 @@ public class PaperWorldConfig { @@ -449,4 +449,47 @@ public class PaperWorldConfig {
log("Bed Search Radius: " + bedSearchRadius); log("Bed Search Radius: " + bedSearchRadius);
} }
} }

View File

@ -1,14 +1,14 @@
From ae7f77a162d760cc7b724fcc9df73c7955b0d838 Mon Sep 17 00:00:00 2001 From 1b717bb84d8f34e7a18f4880d2c0ff5210a08bb7 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Wed, 15 Aug 2018 01:26:09 -0700 Date: Wed, 15 Aug 2018 01:26:09 -0700
Subject: [PATCH] Allow disabling armour stand ticking Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4a89d8bedb..b412d02ada 100644 index 4fbafb5bf2..31b2c71960 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -489,4 +489,10 @@ public class PaperWorldConfig { @@ -497,4 +497,10 @@ public class PaperWorldConfig {
break; break;
} }
} }

View File

@ -1,11 +1,11 @@
From 2346990844cd6dc58d010ecc5387e773d3c772b4 Mon Sep 17 00:00:00 2001 From 7849249a2aa766c3b1d3e35b7cf3c5f21dd2a9a1 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com> From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200 Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray Subject: [PATCH] Anti-Xray
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index cfeba61a32..fec0a7cc36 100644 index d818d39039..cc8fdedd5b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,10 @@ @@ -1,7 +1,10 @@
@ -19,7 +19,7 @@ index cfeba61a32..fec0a7cc36 100644
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@@ -504,4 +507,27 @@ public class PaperWorldConfig { @@ -512,4 +515,27 @@ public class PaperWorldConfig {
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
} }

View File

@ -1,14 +1,14 @@
From 58d72c67a7c9a72473d5e2bb9d58f40b95e804e0 Mon Sep 17 00:00:00 2001 From bc6aa0160941037d2193cfb5386289723418492a Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 8 Aug 2018 16:33:21 -0600 Date: Wed, 8 Aug 2018 16:33:21 -0600
Subject: [PATCH] Configurable speed for water flowing over lava Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index fec0a7cc36..4b4223a9fa 100644 index cc8fdedd5b..5bab0018da 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -459,6 +459,12 @@ public class PaperWorldConfig { @@ -467,6 +467,12 @@ public class PaperWorldConfig {
} }
} }