diff --git a/luminol-server/minecraft-patches/features/0025-Purpur-use-alternative-keep-alive.patch b/luminol-server/minecraft-patches/features/0025-Purpur-Use-alternative-keep-alive.patch similarity index 98% rename from luminol-server/minecraft-patches/features/0025-Purpur-use-alternative-keep-alive.patch rename to luminol-server/minecraft-patches/features/0025-Purpur-Use-alternative-keep-alive.patch index 31e3895..c867436 100644 --- a/luminol-server/minecraft-patches/features/0025-Purpur-use-alternative-keep-alive.patch +++ b/luminol-server/minecraft-patches/features/0025-Purpur-Use-alternative-keep-alive.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sun, 12 Jan 2025 11:43:15 +0800 -Subject: [PATCH] Purpur use alternative keep alive +Subject: [PATCH] Purpur Use alternative keep alive diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/luminol-server/minecraft-patches/features/0026-Purpur-Lobotomize-stuck-villagers.patch b/luminol-server/minecraft-patches/features/0026-Purpur-Lobotomize-stuck-villagers.patch new file mode 100644 index 0000000..3c228d4 --- /dev/null +++ b/luminol-server/minecraft-patches/features/0026-Purpur-Lobotomize-stuck-villagers.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Thu, 30 Jan 2025 08:42:29 +0800 +Subject: [PATCH] Purpur Lobotomize stuck villagers + + +diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java +index 7ea74aeb905b95e5919d74df5fbc5e8f7a9985e3..d6e337ac8cf3d40f60a20b07826a4eee1c865bc3 100644 +--- a/net/minecraft/world/entity/npc/Villager.java ++++ b/net/minecraft/world/entity/npc/Villager.java +@@ -193,6 +193,53 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + this.setVillagerData(this.getVillagerData().setType(villagerType).setProfession(VillagerProfession.NONE)); + } + ++ // Purpur start ++ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur ++ private int notLobotomizedCount = 0; // Purpur ++ ++ private boolean checkLobotomized() { ++ int interval = me.earthme.luminol.config.modules.optimizations.LobotomizeVillageConfig.villagerLobotomizeCheckInterval; ++ boolean shouldCheckForTradeLocked = me.earthme.luminol.config.modules.optimizations.LobotomizeVillageConfig.villagerLobotomizeWaitUntilTradeLocked; ++ if (this.notLobotomizedCount > 3) { ++ // check half as often if not lobotomized for the last 3+ consecutive checks ++ interval *= 2; ++ } ++ if (this.level().getGameTime() % interval == 0) { ++ // offset Y for short blocks like dirt_path/farmland ++ this.isLobotomized = !(shouldCheckForTradeLocked && this.getVillagerXp() == 0) && !canTravelFrom(BlockPos.containing(this.position().x, this.getBoundingBox().minY + 0.0625D, this.position().z)); ++ ++ if (this.isLobotomized) { ++ this.notLobotomizedCount = 0; ++ } else { ++ this.notLobotomizedCount++; ++ } ++ } ++ return this.isLobotomized; ++ } ++ // Purpur end ++ ++ private boolean canTravelFrom(BlockPos pos) { ++ return canTravelTo(pos.east()) || canTravelTo(pos.west()) || canTravelTo(pos.north()) || canTravelTo(pos.south()); ++ } ++ ++ private boolean canTravelTo(BlockPos pos) { ++ net.minecraft.world.level.block.state.BlockState state = this.level().getBlockStateIfLoaded(pos); ++ if (state == null) { ++ // chunk not loaded ++ return false; ++ } ++ net.minecraft.world.level.block.Block bottom = state.getBlock(); ++ if (bottom instanceof net.minecraft.world.level.block.FenceBlock || ++ bottom instanceof net.minecraft.world.level.block.FenceGateBlock || ++ bottom instanceof net.minecraft.world.level.block.WallBlock) { ++ // bottom block is too tall to get over ++ return false; ++ } ++ net.minecraft.world.level.block.Block top = level().getBlockState(pos.above()).getBlock(); ++ // only if both blocks have no collision ++ return !bottom.hasCollision && !top.hasCollision; ++ } ++ + @Override + public Brain getBrain() { + return (Brain)super.getBrain(); +@@ -289,10 +336,18 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + // Paper start - EAR 2 + this.customServerAiStep(level, false); + } +- protected void customServerAiStep(ServerLevel level, final boolean inactive) { ++ protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - not final + // Paper end - EAR 2 + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("villagerBrain"); ++ // Purpur start ++ if (me.earthme.luminol.config.modules.optimizations.LobotomizeVillageConfig.villagerLobotomizeEnabled) { ++ // treat as inactive if lobotomized ++ inactive = inactive || checkLobotomized(); ++ } else { ++ this.isLobotomized = false; ++ } ++ // Purpur end + if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2 + profilerFiller.pop(); + if (this.assignProfessionWhenSpawned) { diff --git a/luminol-server/minecraft-patches/features/0026-Petal-Reduce-sensor-work.patch b/luminol-server/minecraft-patches/features/0027-Petal-Reduce-sensor-work.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0026-Petal-Reduce-sensor-work.patch rename to luminol-server/minecraft-patches/features/0027-Petal-Reduce-sensor-work.patch diff --git a/luminol-server/minecraft-patches/features/0027-Pufferfish-Cache-climbing-check-for-activation.patch b/luminol-server/minecraft-patches/features/0028-Pufferfish-Cache-climbing-check-for-activation.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0027-Pufferfish-Cache-climbing-check-for-activation.patch rename to luminol-server/minecraft-patches/features/0028-Pufferfish-Cache-climbing-check-for-activation.patch diff --git a/luminol-server/minecraft-patches/features/0028-Pufferfish-Reduce-chunk-loading-lookups.patch b/luminol-server/minecraft-patches/features/0029-Pufferfish-Reduce-chunk-loading-lookups.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0028-Pufferfish-Reduce-chunk-loading-lookups.patch rename to luminol-server/minecraft-patches/features/0029-Pufferfish-Reduce-chunk-loading-lookups.patch diff --git a/luminol-server/minecraft-patches/features/0029-Gale-Use-platform-math-functions.patch b/luminol-server/minecraft-patches/features/0030-Gale-Use-platform-math-functions.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0029-Gale-Use-platform-math-functions.patch rename to luminol-server/minecraft-patches/features/0030-Gale-Use-platform-math-functions.patch diff --git a/luminol-server/minecraft-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch b/luminol-server/minecraft-patches/features/0031-Gale-Variable-entity-wake-up-duration.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch rename to luminol-server/minecraft-patches/features/0031-Gale-Variable-entity-wake-up-duration.patch diff --git a/luminol-server/minecraft-patches/features/0031-Gale-Skip-entity-move-if-movement-is-zero.patch b/luminol-server/minecraft-patches/features/0032-Gale-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0031-Gale-Skip-entity-move-if-movement-is-zero.patch rename to luminol-server/minecraft-patches/features/0032-Gale-Skip-entity-move-if-movement-is-zero.patch diff --git a/luminol-server/minecraft-patches/features/0032-Gale-Replace-AI-attributes-with-optimized-collection.patch b/luminol-server/minecraft-patches/features/0033-Gale-Replace-AI-attributes-with-optimized-collection.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0032-Gale-Replace-AI-attributes-with-optimized-collection.patch rename to luminol-server/minecraft-patches/features/0033-Gale-Replace-AI-attributes-with-optimized-collection.patch diff --git a/luminol-server/minecraft-patches/features/0033-Gale-Optimize-noise-generation.patch b/luminol-server/minecraft-patches/features/0034-Gale-Optimize-noise-generation.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0033-Gale-Optimize-noise-generation.patch rename to luminol-server/minecraft-patches/features/0034-Gale-Optimize-noise-generation.patch diff --git a/luminol-server/minecraft-patches/features/0034-SparklyPaper-Optimize-canSee-checks.patch b/luminol-server/minecraft-patches/features/0035-SparklyPaper-Optimize-canSee-checks.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0034-SparklyPaper-Optimize-canSee-checks.patch rename to luminol-server/minecraft-patches/features/0035-SparklyPaper-Optimize-canSee-checks.patch diff --git a/luminol-server/minecraft-patches/features/0035-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/luminol-server/minecraft-patches/features/0036-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0035-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch rename to luminol-server/minecraft-patches/features/0036-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch diff --git a/luminol-server/minecraft-patches/features/0036-Leaf-Secure-seed-and-matter-seed-command.patch b/luminol-server/minecraft-patches/features/0037-Leaf-Secure-seed-and-matter-seed-command.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0036-Leaf-Secure-seed-and-matter-seed-command.patch rename to luminol-server/minecraft-patches/features/0037-Leaf-Secure-seed-and-matter-seed-command.patch diff --git a/luminol-server/minecraft-patches/features/0037-Tick-regions-api.patch b/luminol-server/minecraft-patches/features/0038-Tick-regions-api.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0037-Tick-regions-api.patch rename to luminol-server/minecraft-patches/features/0038-Tick-regions-api.patch diff --git a/luminol-server/paper-patches/features/0022-Purpur-use-alternative-keep-alive.patch b/luminol-server/paper-patches/features/0022-Purpur-Use-alternative-keep-alive.patch similarity index 95% rename from luminol-server/paper-patches/features/0022-Purpur-use-alternative-keep-alive.patch rename to luminol-server/paper-patches/features/0022-Purpur-Use-alternative-keep-alive.patch index 9eaebc9..c4a5633 100644 --- a/luminol-server/paper-patches/features/0022-Purpur-use-alternative-keep-alive.patch +++ b/luminol-server/paper-patches/features/0022-Purpur-Use-alternative-keep-alive.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sun, 12 Jan 2025 11:43:17 +0800 -Subject: [PATCH] Purpur use alternative keep alive +Subject: [PATCH] Purpur Use alternative keep alive diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/PurpurAlternativeKeepaliveConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/PurpurAlternativeKeepaliveConfig.java diff --git a/luminol-server/paper-patches/features/0023-Purpur-Lobotomize-stuck-villagers.patch b/luminol-server/paper-patches/features/0023-Purpur-Lobotomize-stuck-villagers.patch new file mode 100644 index 0000000..173143e --- /dev/null +++ b/luminol-server/paper-patches/features/0023-Purpur-Lobotomize-stuck-villagers.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Thu, 30 Jan 2025 08:42:31 +0800 +Subject: [PATCH] Purpur Lobotomize stuck villagers + + +diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/LobotomizeVillageConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/LobotomizeVillageConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3b30546a26634361cd6eb2dbf08af9e2608a060f +--- /dev/null ++++ b/src/main/java/me/earthme/luminol/config/modules/optimizations/LobotomizeVillageConfig.java +@@ -0,0 +1,24 @@ ++package me.earthme.luminol.config.modules.optimizations; ++ ++import me.earthme.luminol.config.ConfigInfo; ++import me.earthme.luminol.config.EnumConfigCategory; ++import me.earthme.luminol.config.IConfigModule; ++ ++public class LobotomizeVillageConfig implements IConfigModule { ++ @ConfigInfo(baseName = "enabled") ++ public static boolean villagerLobotomizeEnabled = false; ++ @ConfigInfo(baseName = "check_interval") ++ public static int villagerLobotomizeCheckInterval = 100; ++ @ConfigInfo(baseName = "wait_until_trade_locked") ++ public static boolean villagerLobotomizeWaitUntilTradeLocked = false; ++ ++ @Override ++ public EnumConfigCategory getCategory() { ++ return EnumConfigCategory.OPTIMIZATIONS; ++ } ++ ++ @Override ++ public String getBaseName() { ++ return "lobotomize_villager"; ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +index bd515cdfbcc6fb0d17f70150d8b0bab60949db49..b6038fedea6251226b3b3db0f4b7a1f3d2276ab0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +@@ -381,4 +381,11 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { + getHandle().getGossips().gossips.clear(); + } + // Paper end ++ ++ // Purpur start ++ @Override ++ public boolean isLobotomized() { ++ return getHandle().isLobotomized(); ++ } ++ // Purpur end + } diff --git a/luminol-server/paper-patches/features/0023-Petal-Reduce-sensor-work.patch b/luminol-server/paper-patches/features/0024-Petal-Reduce-sensor-work.patch similarity index 100% rename from luminol-server/paper-patches/features/0023-Petal-Reduce-sensor-work.patch rename to luminol-server/paper-patches/features/0024-Petal-Reduce-sensor-work.patch diff --git a/luminol-server/paper-patches/features/0024-Pufferfish-Reduce-projectile-chunk-loading.patch b/luminol-server/paper-patches/features/0025-Pufferfish-Reduce-projectile-chunk-loading.patch similarity index 100% rename from luminol-server/paper-patches/features/0024-Pufferfish-Reduce-projectile-chunk-loading.patch rename to luminol-server/paper-patches/features/0025-Pufferfish-Reduce-projectile-chunk-loading.patch diff --git a/luminol-server/paper-patches/features/0025-Pufferfish-Optimize-suffocation.patch b/luminol-server/paper-patches/features/0026-Pufferfish-Optimize-suffocation.patch similarity index 100% rename from luminol-server/paper-patches/features/0025-Pufferfish-Optimize-suffocation.patch rename to luminol-server/paper-patches/features/0026-Pufferfish-Optimize-suffocation.patch diff --git a/luminol-server/paper-patches/features/0026-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/luminol-server/paper-patches/features/0027-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch similarity index 100% rename from luminol-server/paper-patches/features/0026-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch rename to luminol-server/paper-patches/features/0027-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch diff --git a/luminol-server/paper-patches/features/0027-Pufferfish-SIMD-Utilities.patch b/luminol-server/paper-patches/features/0028-Pufferfish-SIMD-Utilities.patch similarity index 100% rename from luminol-server/paper-patches/features/0027-Pufferfish-SIMD-Utilities.patch rename to luminol-server/paper-patches/features/0028-Pufferfish-SIMD-Utilities.patch diff --git a/luminol-server/paper-patches/features/0028-Pufferfish-Sentry.patch b/luminol-server/paper-patches/features/0029-Pufferfish-Sentry.patch similarity index 100% rename from luminol-server/paper-patches/features/0028-Pufferfish-Sentry.patch rename to luminol-server/paper-patches/features/0029-Pufferfish-Sentry.patch diff --git a/luminol-server/paper-patches/features/0029-Gale-Variable-entity-wake-up-duration.patch b/luminol-server/paper-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch similarity index 100% rename from luminol-server/paper-patches/features/0029-Gale-Variable-entity-wake-up-duration.patch rename to luminol-server/paper-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch diff --git a/luminol-server/paper-patches/features/0030-SparklyPaper-Optimize-canSee-checks.patch b/luminol-server/paper-patches/features/0031-SparklyPaper-Optimize-canSee-checks.patch similarity index 100% rename from luminol-server/paper-patches/features/0030-SparklyPaper-Optimize-canSee-checks.patch rename to luminol-server/paper-patches/features/0031-SparklyPaper-Optimize-canSee-checks.patch diff --git a/luminol-server/paper-patches/features/0031-Leaf-Skip-event-if-no-listeners.patch b/luminol-server/paper-patches/features/0032-Leaf-Skip-event-if-no-listeners.patch similarity index 100% rename from luminol-server/paper-patches/features/0031-Leaf-Skip-event-if-no-listeners.patch rename to luminol-server/paper-patches/features/0032-Leaf-Skip-event-if-no-listeners.patch diff --git a/luminol-server/paper-patches/features/0032-Leaf-Secure-seed-and-matter-seed-command.patch b/luminol-server/paper-patches/features/0033-Leaf-Secure-seed-and-matter-seed-command.patch similarity index 100% rename from luminol-server/paper-patches/features/0032-Leaf-Secure-seed-and-matter-seed-command.patch rename to luminol-server/paper-patches/features/0033-Leaf-Secure-seed-and-matter-seed-command.patch diff --git a/luminol-server/paper-patches/features/0033-Tick-regions-api.patch b/luminol-server/paper-patches/features/0034-Tick-regions-api.patch similarity index 100% rename from luminol-server/paper-patches/features/0033-Tick-regions-api.patch rename to luminol-server/paper-patches/features/0034-Tick-regions-api.patch