diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 770a2e37de9..12a034d5a6e 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -84,7 +84,6 @@ import net.minecraft.world.World; import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.gen.feature.WorldGenMinable; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.ForgeEventFactory; @@ -1093,6 +1092,7 @@ public void onLoad() { MinecraftForge.EVENT_BUS.register(new GlobalEnergyWorldSavedData("")); MinecraftForge.EVENT_BUS.register(new SpaceProjectWorldSavedData()); + MinecraftForge.EVENT_BUS.register(new GT_Worldgenerator.OregenPatternSavedData("")); // IC2 Hazmat addFullHazmatToIC2Item("hazmatHelmet"); @@ -1365,13 +1365,6 @@ public void onServerStarted() { } } } - World world = DimensionManager.getWorld(0); - if (world.getWorldInfo() - .getWorldTotalTime() == 0L) { - // The world has just been created - GT_Worldgenerator.useNewOregenPattern = true; - } - GT_Worldgenerator.OregenPatternSavedData.loadData(world); } public void onServerStopping() { diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index fce9c12c160..dba718de125 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -19,8 +19,10 @@ import net.minecraft.world.WorldSavedData; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.event.world.WorldEvent; import cpw.mods.fml.common.IWorldGenerator; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -152,6 +154,19 @@ public static void loadData(World world) { instance.markDirty(); } + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + World world = event.world; + if (!world.isRemote && world.provider.dimensionId == 0) { + if (world.getWorldInfo() + .getWorldTotalTime() == 0L) { + // The world has just been created + oregenPattern = OregenPattern.values()[OregenPattern.values().length - 1]; + } + loadData(world); + } + } + @Override public void readFromNBT(NBTTagCompound p_76184_1_) { if (p_76184_1_.hasKey(KEY)) {