Files
Purpur/patches/server/0242-Implement-configurable-search-radius-for-villagers-t.patch
granny 639bcbd780 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f9c7f2a Begin switching to JSpecify annotations (#11448)
PaperMC/Paper@e3c8a8e Add PlayerInsertLecternBookEvent [1.20 port] (#7305)
PaperMC/Paper@b410fe8 Configurable per-world void damage offset/damage(#11436)
PaperMC/Paper@ea00be3 Do not NPE on uuid resolution in player profile (#11449)
PaperMC/Paper@ba3c29b Finish converting all events to jspecify annotations
PaperMC/Paper@e7e1ab5 Finish converting most of the undeprecated api to jspecify
PaperMC/Paper@69ffbec Fix hex color check
PaperMC/Paper@709f0f2 Use components properly in ProfileWhitelistVerifyEvent (#11456)
PaperMC/Paper@fb76840 [ci skip] Add section on nullability annotations (#11461)
PaperMC/Paper@7cd4f2c Check if leash tag has a uuid
2024-10-03 17:08:59 -07:00

42 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Wed, 8 Jun 2022 14:13:39 -0400
Subject: [PATCH] Implement configurable search radius for villagers to spawn
iron golems
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 3d93d548b8c68cc0ee7c52dd0f92664c47077b6d..4af1857c4fbc18067b2fa0ae43501ce540630c6f 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -1101,6 +1101,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
public void spawnGolemIfNeeded(ServerLevel world, long time, int requiredCount) {
+ if (world.purpurConfig.villagerSpawnIronGolemRadius > 0 && world.getEntitiesOfClass(net.minecraft.world.entity.animal.IronGolem.class, getBoundingBox().inflate(world.purpurConfig.villagerSpawnIronGolemRadius)).size() > world.purpurConfig.villagerSpawnIronGolemLimit) return; // Purpur
if (this.wantsToSpawnGolem(time)) {
AABB axisalignedbb = this.getBoundingBox().inflate(10.0D, 10.0D, 10.0D);
List<Villager> list = world.getEntitiesOfClass(Villager.class, axisalignedbb);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index f9d927dccb7ba682c38adc734bc4999277a5c915..b6b2dde78249f6fd922bfbcdcbee2ee4e734f6e7 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2942,6 +2942,8 @@ public class PurpurWorldConfig {
public int villagerLobotomizeCheckInterval = 100;
public boolean villagerLobotomizeWaitUntilTradeLocked = false;
public boolean villagerDisplayTradeItem = true;
+ public int villagerSpawnIronGolemRadius = 0;
+ public int villagerSpawnIronGolemLimit = 0;
private void villagerSettings() {
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
@@ -2977,6 +2979,8 @@ public class PurpurWorldConfig {
villagerLobotomizeCheckInterval = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
villagerLobotomizeWaitUntilTradeLocked = getBoolean("mobs.villager.lobotomize.wait-until-trade-locked", villagerLobotomizeWaitUntilTradeLocked);
villagerDisplayTradeItem = getBoolean("mobs.villager.display-trade-item", villagerDisplayTradeItem);
+ villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius);
+ villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
}
public boolean vindicatorRidable = false;