From 58301dbe0e72941aa46c2a6ddae75b958daa80b7 Mon Sep 17 00:00:00 2001 From: Dimach Date: Sat, 18 Mar 2017 19:43:32 +0200 Subject: [PATCH] Fixed ores not generated sometimes. --- .../gregtech/common/GT_Worldgenerator.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 544e1afe..e2f3cdab 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -16,8 +16,6 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderEnd; import net.minecraft.world.gen.ChunkProviderHell; -import java.util.ArrayList; -import java.util.List; import java.util.Random; public class GT_Worldgenerator @@ -31,8 +29,6 @@ public class GT_Worldgenerator private static int gcMaxSize = 400; private static boolean endAsteroids = true; private static boolean gcAsteroids = true; - public List mList = new ArrayList(); - public boolean mIsGenerating = false; public GT_Worldgenerator() { @@ -47,17 +43,8 @@ public class GT_Worldgenerator GameRegistry.registerWorldGenerator(this, 1073741823); } - public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName)); - if (!this.mIsGenerating) { - this.mIsGenerating = true; - int mList_sS=this.mList.size(); - for (int i = 0; i < mList_sS; i++) { - ((Runnable) this.mList.get(i)).run(); - } - this.mList.clear(); - this.mIsGenerating = false; - } + public synchronized void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName).run(); } public static class WorldGenContainer @@ -113,7 +100,9 @@ public class GT_Worldgenerator for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } j++; } i++;