diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 770a2e37de9..2c14c9b25b6 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -1369,7 +1369,11 @@ public void onServerStarted() { if (world.getWorldInfo() .getWorldTotalTime() == 0L) { // The world has just been created - GT_Worldgenerator.useNewOregenPattern = true; + GT_Worldgenerator.useNewOregenPattern = 1; + } + if (GT_Worldgenerator.useNewOregenPattern == -1) { + // this is an old world that got updated + GT_Worldgenerator.useNewOregenPattern = 0; } GT_Worldgenerator.OregenPatternSavedData.loadData(world); } diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 74cefb507db..03370dcbfb9 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -60,9 +60,10 @@ public class GT_Worldgenerator implements IWorldGenerator { public static final Object listLock = new Object(); /** - * {@code true} if ore-veins positions are evenly spaced, {@code false} if they are symmetrical to the X and Z axis. + * {@code 1} if ore-veins positions are evenly spaced, {@code 0} if they are symmetrical to the X and Z axis, + * {@code -1} if the state is unknown */ - public static boolean useNewOregenPattern = false; + public static int useNewOregenPattern = -1; public GT_Worldgenerator() { endAsteroids = GregTech_API.sWorldgenFile.get("endasteroids", "GenerateAsteroids", true); @@ -130,7 +131,7 @@ public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvide } public static boolean isOreChunk(int chunkX, int chunkZ) { - if (useNewOregenPattern) { + if (useNewOregenPattern == 1 || useNewOregenPattern == -1) { return Math.floorMod(chunkX, 3) == 1 && Math.floorMod(chunkZ, 3) == 1; } return Math.abs(chunkX) % 3 == 1 && Math.abs(chunkZ) % 3 == 1; @@ -158,13 +159,22 @@ public static void loadData(World world) { @Override public void readFromNBT(NBTTagCompound p_76184_1_) { if (p_76184_1_.hasKey(KEY)) { - useNewOregenPattern = p_76184_1_.getBoolean(KEY); + if (p_76184_1_.getBoolean(KEY)) { + useNewOregenPattern = 1; + } else { + useNewOregenPattern = 0; + } } } @Override public void writeToNBT(NBTTagCompound p_76187_1_) { - p_76187_1_.setBoolean(KEY, useNewOregenPattern); + if (useNewOregenPattern == 1) { + p_76187_1_.setBoolean(KEY, true); + } + if (useNewOregenPattern == 0) { + p_76187_1_.setBoolean(KEY, false); + } } }