From 2b5f001eeb1c3c7bf65797c0dd456bcf632ffee7 Mon Sep 17 00:00:00 2001 From: Charles445 Date: Fri, 26 Nov 2021 10:50:00 -0600 Subject: [PATCH] Remove Village and Fortress Cleanup If you enter a village or fortress, unload the chunks, have the world save twice, and then come back, the village and fortress will be broken. Restarting the game or server, however, brings them back, which I don't quite understand, but it's a good thing, as it means this feature might be workable on server stopping. For now, the tweak is removed. Mineshafts are still cleaned up though as this bug hardly matters for them. --- .../rltweaker/config/ConfigMinecraft.java | 6 +++--- .../rltweaker/handler/MinecraftHandler.java | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/charles445/rltweaker/config/ConfigMinecraft.java b/src/main/java/com/charles445/rltweaker/config/ConfigMinecraft.java index 17fc36e..c7fc2f1 100644 --- a/src/main/java/com/charles445/rltweaker/config/ConfigMinecraft.java +++ b/src/main/java/com/charles445/rltweaker/config/ConfigMinecraft.java @@ -64,12 +64,12 @@ public class ConfigMinecraft @RLConfig.RLCraftTwoNine("true") public boolean lessCollisions = true; - @Config.Comment("Cleans up Mineshaft, Village, and Fortress .dat files regularly to lower RAM usage") - @Config.Name("Cleanup Worldgen Files") + @Config.Comment("Cleans up Mineshaft .dat files regularly to lower RAM usage. May break mods that need to locate Mineshafts.") + @Config.Name("Cleanup Mineshaft Worldgen Files") @RLConfig.ImprovementsOnly("true") @RLConfig.RLCraftTwoEightTwo("true") @RLConfig.RLCraftTwoNine("true") - public boolean cleanupWorldgenFiles = true; + public boolean cleanupMineshaftWorldgenFiles = true; @Config.Comment("Replace thrown witch potions with configured potions") @Config.Name("Witch Potion Replacements") diff --git a/src/main/java/com/charles445/rltweaker/handler/MinecraftHandler.java b/src/main/java/com/charles445/rltweaker/handler/MinecraftHandler.java index 195c996..2b62567 100644 --- a/src/main/java/com/charles445/rltweaker/handler/MinecraftHandler.java +++ b/src/main/java/com/charles445/rltweaker/handler/MinecraftHandler.java @@ -120,11 +120,20 @@ public void onWorldUnload(WorldEvent.Save event) if(world.isRemote) return; - if(ModConfig.server.minecraft.cleanupWorldgenFiles) + //TODO other worldgen + //Uf you enter an area for the first time, leave, world saves twice, come back, the area will be broken + //This is very uncommon, but it's still a possibility + //They seem to regenerate when the game is restarted, which is very peculiar, but could also be incredibly helpful + //It may be possible to run these cleanups on server stopping, or something similar + // + //Nobody uses Mineshafts, though, so that cleaner gets to stay for now + + + if(ModConfig.server.minecraft.cleanupMineshaftWorldgenFiles) { cleanMapGenStructureData(world, "Mineshaft", false, true); - cleanMapGenStructureData(world, "Village", false, true); - cleanMapGenStructureData(world, "Fortress", false, true); + //cleanMapGenStructureData(world, "Village", false, true); + //cleanMapGenStructureData(world, "Fortress", false, true); } }