[ci skip] add a good chunk of patch identifying comments

This commit is contained in:
granny
2024-12-16 04:03:27 -08:00
parent 73dae7f683
commit 998a4e6973
120 changed files with 3038 additions and 2824 deletions

View File

@@ -5,22 +5,23 @@ Subject: [PATCH] Lobotomize stuck villagers
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index c5e67489ba4a60ead3490f8c9468833f913af1a0..a191fb8563c01413dc4119e3adf81e23aacb824b 100644
index 0a554198b306c05a1c9566f9fda76c48021c7a54..576f6f05b35443aa89437b573330f1118a89f3b4 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -141,6 +141,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}, MemoryModuleType.MEETING_POINT, (entityvillager, holder) -> {
return holder.is(PoiTypes.MEETING);
});
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur
+ private int notLobotomizedCount = 0; // Purpur
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
+ private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
public long nextGolemPanic = -1; // Pufferfish
@@ -203,6 +205,48 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -207,6 +209,49 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
return this.level().purpurConfig.villagerAlwaysDropExp;
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Lobotomize stuck villagers
+ private boolean checkLobotomized() {
+ int interval = this.level().purpurConfig.villagerLobotomizeCheckInterval;
+ boolean shouldCheckForTradeLocked = this.level().purpurConfig.villagerLobotomizeWaitUntilTradeLocked;
@@ -62,11 +63,11 @@ index c5e67489ba4a60ead3490f8c9468833f913af1a0..a191fb8563c01413dc4119e3adf81e23
+ // only if both blocks have no collision
+ return !bottom.hasCollision && !top.hasCollision;
+ }
+
+ // Purpur end - Lobotomize stuck villagers
@Override
public Brain<Villager> getBrain() {
return (Brain<Villager>) super.getBrain(); // CraftBukkit - decompile error
@@ -298,11 +342,19 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -302,11 +347,19 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
// Paper start - EAR 2
this.customServerAiStep(world, false);
}
@@ -86,9 +87,9 @@ index c5e67489ba4a60ead3490f8c9468833f913af1a0..a191fb8563c01413dc4119e3adf81e23
+ // Purpur end
// Pufferfish start
if (!inactive && (getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) {
this.getBrain().tick(world, this); // Paper // Purpur
this.getBrain().tick(world, this); // Paper // Purpur - Ridables
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 8e895d6f84f7d84b219f2424909dd42e5f08dec4..53dcce0701d713c5dd097340a91b8be4806de4b8 100644
index 8e895d6f84f7d84b219f2424909dd42e5f08dec4..e5597563a6ed620ab9c9e81be4bad56fd5308305 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -375,4 +375,11 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
@@ -96,12 +97,12 @@ index 8e895d6f84f7d84b219f2424909dd42e5f08dec4..53dcce0701d713c5dd097340a91b8be4
}
// Paper end
+
+ // Purpur start
+ // Purpur start - Lobotomize stuck villagers
+ @Override
+ public boolean isLobotomized() {
+ return getHandle().isLobotomized();
+ }
+ // Purpur end
+ // Purpur end - Lobotomize stuck villagers
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index fa09bd0e91d3c71d960e316f792323b763569b6e..30d54adaae14884832387951d47872bedaf087a0 100644