Skip to content
Permalink
Browse files

Improve Village Door fix to not merge villages (Iron Titan)

Improves doors to better handle unloaded state so they need 1200 LOADED ticks
in order to not be dismissed.

Also improves the villages to not even tick when the center of the village + 1
is not loaded, improving server performance (and helping door issue)

This should keep Iron Titans back working
  • Loading branch information...
aikar committed Oct 12, 2018
1 parent 583be93 commit 33d2de5f725353cd3ba2dda6739774bf326f8efc
Showing with 48 additions and 7 deletions.
  1. +47 −7 Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch
  2. +1 −0 scripts/importmcdev.sh
@@ -1,22 +1,62 @@
From 9542aadf8d5db8a0f3937f5a311338fca70fc581 Mon Sep 17 00:00:00 2001
From d4d9b90ec44df0777e139ace23b70438a000c800 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Sep 2018 12:13:23 -0400
Subject: [PATCH] Backport Village Door fix from 1.13


diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 9f1867ddd3..af09551f4e 100644
index 9f1867ddd3..d48487cc15 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -312,7 +312,7 @@ public class Village {
villagedoor.a();
@@ -14,7 +14,7 @@ public class Village {
private World a;
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;
@@ -44,6 +44,12 @@ public class Village {
}

public void a(int i) {
+ // Paper - don't tick village if chunk isn't loaded
+ Chunk chunk = this.a.getChunkIfLoaded(getCenter());
+ if (chunk == null || !chunk.areNeighborsLoaded(1)) {
+ return;
+ }
+ // Paper end
this.g = i;
this.m();
this.l();
@@ -313,6 +319,14 @@ public class Village {
}

- if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) {
+ if ((!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) && this.a.isLoaded(villagedoor.d())) { // Paper - don't remove doors from unloaded chunks
if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) {
+ // Paper start- don't remove doors from unloaded chunks
+ if (!this.a.isLoaded(villagedoor.d())) {
+ villagedoor.inactiveDoorTicks = 0;
+ continue;
+ } else if (++villagedoor.inactiveDoorTicks < 1200) {
+ continue;
+ }
+ // Paper end
this.c = this.c.b(villagedoor.d());
flag = true;
villagedoor.a(true);
diff --git a/src/main/java/net/minecraft/server/VillageDoor.java b/src/main/java/net/minecraft/server/VillageDoor.java
index 43de227738..1a7e3e8745 100644
--- a/src/main/java/net/minecraft/server/VillageDoor.java
+++ b/src/main/java/net/minecraft/server/VillageDoor.java
@@ -2,6 +2,7 @@ package net.minecraft.server;

public class VillageDoor {

+ public int inactiveDoorTicks = 0; // Paper
private final BlockPosition a;
private final BlockPosition b;
private final EnumDirection c;
--
2.19.0
2.19.1

@@ -116,6 +116,7 @@ import StructurePiece
import StructureStart
import TileEntityEnderChest
import TileEntityLootable
import VillageDoor
import WorldGenStronghold
import WorldProvider

0 comments on commit 33d2de5

Please sign in to comment.
You can’t perform that action at this time.