From 25209a4bcb9b79647a77bc0c63515f1192154098 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Fri, 29 Jul 2016 18:54:45 +0100 Subject: Merge GG into GT --- .../gregtech/common/GT_Worldgen_GT_Ore_Layer.java | 16 ++++++---- .../common/GT_Worldgen_GT_Ore_SmallPieces.java | 18 +++++++---- .../java/gregtech/common/GT_Worldgenerator.java | 35 +++++++++++++++------- 3 files changed, 48 insertions(+), 21 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java index 9ed6c1dc48..cff1da7192 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java @@ -25,18 +25,24 @@ public class GT_Worldgen_GT_Ore_Layer public final short mSecondaryMeta; public final short mBetweenMeta; public final short mSporadicMeta; - public final String mBiome; + public final String mRestrictBiome; public final boolean mOverworld; public final boolean mNether; public final boolean mEnd; public final boolean mEndAsteroid; + public final boolean mMoon; + public final boolean mMars; + public final boolean mAsteroid; - public GT_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { + public GT_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, boolean aMoon, boolean aMars, boolean aAsteroid, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { super(aName, sList, aDefault); this.mOverworld = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Overworld", aOverworld); this.mNether = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Nether", aNether); this.mEnd = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "TheEnd", aEnd); this.mEndAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "EndAsteroid", aEnd); + this.mMoon = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Moon", aMoon); + this.mMars = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Mars", aMars); + this.mAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Asteroid", aAsteroid); this.mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", aMinY)); this.mMaxY = ((short) Math.max(this.mMinY + 5, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", aMaxY))); this.mWeight = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RandomWeight", aWeight)); @@ -46,7 +52,7 @@ public class GT_Worldgen_GT_Ore_Layer this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "BiomeName", "None"); + this.mRestrictBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "mRestrictToBiomeName", "None"); if (this.mEnabled) { GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); @@ -57,10 +63,10 @@ public class GT_Worldgen_GT_Ore_Layer } public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) { + if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { return false; //Not the correct biome for ore mix } - if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { + if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) || ((aDimensionType == -28) && (this.mMoon)) || ((aDimensionType == -29) && (this.mMars)) || ((aDimensionType == -30) && (this.mAsteroid)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { return false; } int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java index 5365eb82df..71fc349b4b 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java @@ -18,25 +18,31 @@ public class GT_Worldgen_GT_Ore_SmallPieces public final boolean mOverworld; public final boolean mNether; public final boolean mEnd; - public final String mBiome; + public final boolean mMoon; + public final boolean mMars; + public final boolean mAsteroid; + public final String mRestrictBiome; - public GT_Worldgen_GT_Ore_SmallPieces(String aName, boolean aDefault, int aMinY, int aMaxY, int aAmount, boolean aOverworld, boolean aNether, boolean aEnd, Materials aPrimary) { + public GT_Worldgen_GT_Ore_SmallPieces(String aName, boolean aDefault, int aMinY, int aMaxY, int aAmount, boolean aOverworld, boolean aNether, boolean aEnd, boolean aMoon, boolean aMars, boolean aAsteroid, Materials aPrimary) { super(aName, GregTech_API.sWorldgenList, aDefault); this.mOverworld = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Overworld", aOverworld); this.mNether = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Nether", aNether); this.mEnd = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "TheEnd", aEnd); + this.mMoon = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Moon", aMoon); + this.mMars = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Mars", aMars); + this.mAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Asteroid", aAsteroid); this.mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", aMinY)); this.mMaxY = ((short) Math.max(this.mMinY + 1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", aMaxY))); this.mAmount = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Amount", aAmount))); this.mMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Ore", aPrimary.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "BiomeName", "None"); + this.mRestrictBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "mRestrictToBiomeName", "None"); } public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) { - return false; //Not the correct biome for ore mix + if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { + return false; //Not the correct biome for small ore } - if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { + if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) || ((aDimensionType == -28) && (this.mMoon)) || ((aDimensionType == -29) && (this.mMars)) || ((aDimensionType == -30) && (this.mAsteroid)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { return false; } if (this.mMeta > 0) { diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index de0606b62f..f05143b0d1 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -21,12 +21,15 @@ import java.util.Random; public class GT_Worldgenerator implements IWorldGenerator { - public static boolean sAsteroids = true; - private static int mEndAsteroidProbability = 300; + private static int mEndAsteroidProbability = 50; + private static int mGCAsteroidProbability = 300; private static int mSize = 100; private static int endMinSize = 50; private static int endMaxSize = 200; + private static int gcMinSize = 100; + private static int gcMaxSize = 400; private static boolean endAsteroids = true; + private static boolean gcAsteroids = true; public List mList = new ArrayList(); public boolean mIsGenerating = false; @@ -36,6 +39,10 @@ public class GT_Worldgenerator endMinSize = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidMinSize", 50); endMaxSize = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidMaxSize", 200); mEndAsteroidProbability = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidProbability", 300); + gcAsteroids = GregTech_API.sWorldgenFile.get("gcasteroids", "GenerateGCAsteroids", true); + gcMinSize = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidMinSize", 100); + gcMaxSize = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidMaxSize", 400); + mGCAsteroidProbability = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidProbability", 300); GameRegistry.registerWorldGenerator(this, 1073741823); } @@ -118,8 +125,9 @@ public class GT_Worldgenerator //Asteroid Worldgen int tDimensionType = this.mWorld.provider.dimensionId; Random aRandom = new Random(); - if (((tDimensionType == 1) && endAsteroids && ((mEndAsteroidProbability <= 1) || (aRandom.nextInt(mEndAsteroidProbability) == 0)))) { - short primaryMeta = 0; + if (((tDimensionType == 1) && endAsteroids && ((mEndAsteroidProbability <= 1) || (aRandom.nextInt(mEndAsteroidProbability) == 0))) || ((tDimensionType == -30) && gcAsteroids && ((mGCAsteroidProbability <= 1) || (aRandom.nextInt(mGCAsteroidProbability) == 0)))) { + + short primaryMeta = 0; short secondaryMeta = 0; short betweenMeta = 0; short sporadicMeta = 0; @@ -132,7 +140,7 @@ public class GT_Worldgenerator tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer) tWorldGen).mWeight; if (tRandomWeight <= 0) { try { - if (tWorldGen.mEndAsteroid && tDimensionType == 1) { + if ((tWorldGen.mEndAsteroid && tDimensionType == 1) || (tWorldGen.mAsteroid && tDimensionType == -30)) { primaryMeta = tWorldGen.mPrimaryMeta; secondaryMeta = tWorldGen.mSecondaryMeta; betweenMeta = tWorldGen.mBetweenMeta; @@ -152,6 +160,8 @@ public class GT_Worldgenerator int tZ = mZ + aRandom.nextInt(16); if (tDimensionType == 1) { mSize = aRandom.nextInt((int) (endMaxSize - endMinSize)); + } else if (tDimensionType == -30) { + mSize = aRandom.nextInt((int) (gcMaxSize - gcMinSize)); } if ((mWorld.getBlock(tX, tY, tZ).isAir(mWorld, tX, tY, tZ))) { float var6 = aRandom.nextFloat() * 3.141593F; @@ -185,14 +195,19 @@ public class GT_Worldgenerator if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && (mWorld.getBlock(tX, tY, tZ).isAir(mWorld, tX, tY, tZ))) { int ranOre = aRandom.nextInt(50); if (ranOre < 3) { - GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, primaryMeta , true); + GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, primaryMeta, false); } else if (ranOre < 6) { - GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, secondaryMeta , true); + GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, secondaryMeta, false); } else if (ranOre < 8) { - GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, betweenMeta , true); + GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, betweenMeta, false); } else if (ranOre < 10) { - GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, sporadicMeta , true); - } else {mWorld.setBlock(eX, eY, eZ, Blocks.end_stone, 0, 0); + GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, sporadicMeta, false); + } else { + if (tDimensionType == -1) { + mWorld.setBlock(eX, eY, eZ, Blocks.end_stone, 0, 0); + } else if (tDimensionType == -30) { + mWorld.setBlock(eX, eY, eZ, GregTech_API.sBlockGranites, 8, 3); + } } } } -- cgit