Improve Village Door code to not break village mechanics
This commit is contained in:
@@ -45,18 +45,48 @@ index d14a9e3a3e..0be1bf0d99 100644
|
|||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
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
|
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
|
||||||
index bda67faefe..0414f003a5 100644
|
index bda67faefe..5b56ae1818 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Village.java
|
--- a/src/main/java/net/minecraft/server/Village.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Village.java
|
+++ b/src/main/java/net/minecraft/server/Village.java
|
||||||
@@ -0,0 +0,0 @@ public class Village {
|
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
||||||
villagedoor.a();
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!this.g(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) {
|
public class Village {
|
||||||
+ if ((!this.g(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) && this.a.isLoaded(villagedoor.d())) { // Paper - don't expire doors unless the chunk is loaded, use same param as the first conditional and the one below checks
|
|
||||||
this.c = this.c.b(villagedoor.d());
|
- private World a;
|
||||||
flag = true;
|
+ private World a; private World getWorld() { return a; } // Paper - OBFHELPER
|
||||||
villagedoor.a(true);
|
private final List<VillageDoor> b = Lists.newArrayList();
|
||||||
|
private BlockPosition c;
|
||||||
|
- private BlockPosition d;
|
||||||
|
+ private BlockPosition d;private BlockPosition getCenter() { return d; } // Paper - OBFHELPER
|
||||||
|
private int e;
|
||||||
|
private int f;
|
||||||
|
private int g;
|
||||||
|
@@ -0,0 +0,0 @@ public class Village {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(int i) {
|
||||||
|
+ // Paper - don't tick village if chunk isn't loaded
|
||||||
|
+ Chunk chunk = getWorld().getChunkIfLoaded(getCenter());
|
||||||
|
+ if (chunk == null || !chunk.areNeighborsLoaded(1)) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
this.g = i;
|
||||||
|
this.m();
|
||||||
|
this.l();
|
||||||
|
@@ -0,0 +0,0 @@ public class Village {
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
VillageDoor villagedoor = (VillageDoor) iterator.next();
|
||||||
|
+ // Paper start - don't remove doors from unloaded chunks
|
||||||
|
+ if (!getWorld().isLoaded(villagedoor.getPosition())) {
|
||||||
|
+ villagedoor.setLastSeen(villagedoor.getLastSeen());
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
|
||||||
|
if (flag1) {
|
||||||
|
villagedoor.a();
|
||||||
@@ -0,0 +0,0 @@ public class Village {
|
@@ -0,0 +0,0 @@ public class Village {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,4 +98,29 @@ index bda67faefe..0414f003a5 100644
|
|||||||
Block block = iblockdata.getBlock();
|
Block block = iblockdata.getBlock();
|
||||||
|
|
||||||
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
|
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/VillageDoor.java b/src/main/java/net/minecraft/server/VillageDoor.java
|
||||||
|
index 62771547f6..74ac3c1ba6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/VillageDoor.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/VillageDoor.java
|
||||||
|
@@ -0,0 +0,0 @@ public class VillageDoor {
|
||||||
|
return this.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public BlockPosition getPosition() { return d(); } // Paper - OBFHELPER
|
||||||
|
public BlockPosition d() {
|
||||||
|
return this.a;
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class VillageDoor {
|
||||||
|
return this.c.getAdjacentZ() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public int getLastSeen() { return h(); } // Paper - OBFHELPER
|
||||||
|
public int h() {
|
||||||
|
return this.d;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void setLastSeen(int i) { a(i); } // Paper - OBFHELPER
|
||||||
|
public void a(int i) {
|
||||||
|
this.d = i;
|
||||||
|
}
|
||||||
--
|
--
|
||||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Don't double add golems to world
|
|||||||
spawnCreature adds to world now
|
spawnCreature adds to world now
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
|
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
|
||||||
index 0414f003a5..d92ef03661 100644
|
index 5b56ae1818..afb79bb641 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Village.java
|
--- a/src/main/java/net/minecraft/server/Village.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Village.java
|
+++ b/src/main/java/net/minecraft/server/Village.java
|
||||||
@@ -0,0 +0,0 @@ public class Village {
|
@@ -0,0 +0,0 @@ public class Village {
|
||||||
|
|||||||
Reference in New Issue
Block a user