aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java51
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java14
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java8
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java33
-rw-r--r--src/Java/gtPlusPlus/core/util/PollutionUtils.java5
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java601
6 files changed, 395 insertions, 317 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
index 0a74a9f2aa..0bab9638e0 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
@@ -1,5 +1,7 @@
package gtPlusPlus.core.block.base;
+import java.lang.reflect.Field;
+
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -7,6 +9,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_CopiedBlockTexture;
@@ -20,6 +23,7 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
@@ -42,14 +46,14 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
this.setStepSound(soundTypeStone);
this.setBlockName("Ore"+Utils.sanitizeString(Utils.sanitizeString(material.getUnlocalizedName())));
-
+
//this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture());
//this.setBlockName(this.blockMaterial.getLocalizedName()+" Ore");
-
+
try {
- GameRegistry.registerBlock(this, ItemBlockOre.class, Utils.sanitizeString("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName())));
- GT_OreDictUnificator.registerOre("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()), ItemUtils.getSimpleStack(this));
- LanguageRegistry.addName(this, blockMaterial.getLocalizedName()+ " Ore");
+ GameRegistry.registerBlock(this, ItemBlockOre.class, Utils.sanitizeString("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName())));
+ GT_OreDictUnificator.registerOre("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()), ItemUtils.getSimpleStack(this));
+ LanguageRegistry.addName(this, blockMaterial.getLocalizedName()+ " Ore");
}
catch (Throwable t){
t.printStackTrace();
@@ -60,7 +64,7 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
return false;
}
-
+
public Material getMaterialEx(){
return this.blockMaterial;
}
@@ -84,7 +88,12 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
* GT Texture Handler
*/
- @Override
+ //.08 compat
+ IIconContainer[] hiddenTextureArray;
+ public ITexture[] getTexture(byte arg0) {
+ return getTexture(null, arg0);
+ }
+
public ITexture[] getTexture(Block block, byte side) {
if (this.blockMaterial != null){
GT_RenderedTexture aIconSet = new GT_RenderedTexture(Materials.Iron.mIconSet.mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA());
@@ -93,7 +102,31 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet};
}
}
- return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})};
+
+ if (hiddenTextureArray == null){
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ hiddenTextureArray = Textures.BlockIcons.GRANITES;
+ }
+ else {
+ try {
+ Field o = ReflectionUtils.getField(Textures.BlockIcons.class, "STONES");
+ if (o != null){
+ hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class);
+ if (hiddenTextureArray != null){
+ //Found
+ }
+ else {
+ hiddenTextureArray = new IIconContainer[6];
+ }
+ }
+ }
+ catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ }
+
+ //return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})};
+ return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})};
}
public static class oldOreBlock extends BlockBaseModular{
@@ -141,6 +174,6 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
return false;
}
- }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java
index d517bdfae3..0ebf3462c1 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java
@@ -30,7 +30,7 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler {
public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
Block tTileEntity = aBlock;
if ((tTileEntity instanceof ITexturedTileEntity)) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)});
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture((byte) 0), ((ITexturedTileEntity) tTileEntity).getTexture((byte) 1), ((ITexturedTileEntity) tTileEntity).getTexture((byte) 2), ((ITexturedTileEntity) tTileEntity).getTexture((byte) 3), ((ITexturedTileEntity) tTileEntity).getTexture((byte) 4), ((ITexturedTileEntity) tTileEntity).getTexture((byte) 5)});
}
return false;
}
@@ -192,27 +192,27 @@ public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler {
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
- renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 0), true);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 0), true);
Tessellator.instance.draw();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
- renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 1), true);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 1), true);
Tessellator.instance.draw();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
- renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 2), true);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 2), true);
Tessellator.instance.draw();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
- renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 3), true);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 3), true);
Tessellator.instance.draw();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
- renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 4), true);
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 4), true);
Tessellator.instance.draw();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
- renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 5), true);
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture((byte) 5), true);
Tessellator.instance.draw();
aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
aRenderer.setRenderBoundsFromBlock(aBlock);
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
index a60a2554d8..69776b4d95 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
@@ -19,7 +19,7 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed {
public RenderMiningExplosivesPrimed(){
this.shadowSize = 0.5F;
- Logger.INFO("Rendering Mining Explosion. 1");
+ Logger.WARNING("Rendering Mining Explosion. 1");
}
/**
@@ -29,7 +29,7 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed {
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(final EntityPrimedMiningExplosive entity, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){
- Logger.INFO("Rendering Mining Explosion. 2");
+ Logger.WARNING("Rendering Mining Explosion. 2");
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
float f2;
@@ -87,7 +87,7 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed {
*/
@Override
protected ResourceLocation getEntityTexture(final Entity p_110775_1_){
- Logger.INFO("Rendering Mining Explosion. 4");
+ Logger.WARNING("Rendering Mining Explosion. 4");
return this.getEntityTexture((EntityPrimedMiningExplosive)p_110775_1_);
}
@@ -99,7 +99,7 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed {
*/
@Override
public void doRender(final Entity p_76986_1_, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){
- Logger.INFO("Rendering Mining Explosion. 3");
+ Logger.WARNING("Rendering Mining Explosion. 3");
this.doRender((EntityPrimedMiningExplosive)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
index e8d37a34d2..a36e541c4a 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java
@@ -120,31 +120,30 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator {
*/
//Basic
- ItemList.Circuit_Microprocessor.set(GregtechItemList.Old_Circuit_Basic.get(1));
+ ItemList.valueOf("Circuit_Microprocessor").set(GregtechItemList.Old_Circuit_Basic.get(1));
//Good
- ItemList.Circuit_Integrated.set(GregtechItemList.Old_Circuit_Good.get(1));
+ ItemList.valueOf("Circuit_Integrated").set(GregtechItemList.Old_Circuit_Good.get(1));
//Advanced
- ItemList.Circuit_Nanoprocessor.set(GregtechItemList.Old_Circuit_Advanced.get(1));
+ ItemList.valueOf("Circuit_Nanoprocessor").set(GregtechItemList.Old_Circuit_Advanced.get(1));
//Data
- ItemList.Circuit_Quantumprocessor.set(GregtechItemList.Old_Circuit_Data.get(1));
- ItemList.Circuit_Nanocomputer.set(GregtechItemList.Old_Circuit_Data.get(1));
+ ItemList.valueOf("Circuit_Quantumprocessor").set(GregtechItemList.Old_Circuit_Data.get(1));
+ ItemList.valueOf("Circuit_Nanocomputer").set(GregtechItemList.Old_Circuit_Data.get(1));
//Elite
- ItemList.Circuit_Crystalprocessor.set(GregtechItemList.Old_Circuit_Elite.get(1));
- ItemList.Circuit_Quantumcomputer.set(GregtechItemList.Old_Circuit_Elite.get(1));
- ItemList.Circuit_Elitenanocomputer.set(GregtechItemList.Old_Circuit_Elite.get(1));
+ ItemList.valueOf("Circuit_Crystalprocessor").set(GregtechItemList.Old_Circuit_Elite.get(1));
+ ItemList.valueOf("Circuit_Quantumcomputer").set(GregtechItemList.Old_Circuit_Elite.get(1));
+ ItemList.valueOf("Circuit_Elitenanocomputer").set(GregtechItemList.Old_Circuit_Elite.get(1));
//Master
- ItemList.Circuit_Neuroprocessor.set(GregtechItemList.Old_Circuit_Master.get(1));
- ItemList.Circuit_Masterquantumcomputer.set(GregtechItemList.Old_Circuit_Master.get(1));
+ ItemList.valueOf("Circuit_Neuroprocessor").set(GregtechItemList.Old_Circuit_Master.get(1));
+ ItemList.valueOf("Circuit_Masterquantumcomputer").set(GregtechItemList.Old_Circuit_Master.get(1));
//Ultimate
- ItemList.Circuit_Wetwarecomputer.set(GregtechItemList.Old_Circuit_Ultimate.get(1));
- ItemList.Circuit_Ultimatecrystalcomputer.set(GregtechItemList.Old_Circuit_Ultimate.get(1));
- ItemList.Circuit_Quantummainframe.set(GregtechItemList.Old_Circuit_Ultimate.get(1));
+ ItemList.valueOf("Circuit_Wetwarecomputer").set(GregtechItemList.Old_Circuit_Ultimate.get(1));
+ ItemList.valueOf("Circuit_Ultimatecrystalcomputer").set(GregtechItemList.Old_Circuit_Ultimate.get(1));
+ ItemList.valueOf("Circuit_Quantummainframe").set(GregtechItemList.Old_Circuit_Ultimate.get(1));
//Superconductor
- ItemList.Circuit_Wetwaresupercomputer.set(GregtechItemList.Circuit_IV.get(1));
- ItemList.Circuit_Crystalmainframe.set(GregtechItemList.Circuit_IV.get(1));
+ ItemList.valueOf("Circuit_Wetwaresupercomputer").set(GregtechItemList.Circuit_IV.get(1));
+ ItemList.valueOf("Circuit_Crystalmainframe").set(GregtechItemList.Circuit_IV.get(1));
//Infinite
- ItemList.Circuit_Wetwaremainframe.set(GregtechItemList.Circuit_LuV.get(1));
-
+ ItemList.valueOf("Circuit_Wetwaremainframe").set(GregtechItemList.Circuit_LuV.get(1));
//set data orbs and sticks to their new replacements
ItemList.Tool_DataStick.set(GregtechItemList.Old_Tool_DataStick.get(1));
diff --git a/src/Java/gtPlusPlus/core/util/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/PollutionUtils.java
index a73a89b85c..7e8de5f706 100644
--- a/src/Java/gtPlusPlus/core/util/PollutionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/PollutionUtils.java
@@ -5,6 +5,7 @@ import java.lang.reflect.*;
import gregtech.GT_Mod;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.common.GT_Proxy;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
public class PollutionUtils {
@@ -12,12 +13,12 @@ public class PollutionUtils {
try {
GT_Proxy GT_Pollution = GT_Mod.gregtechproxy;
if (GT_Pollution != null) {
- Field mPollution = GT_Pollution.getClass().getField("mPollution");
+ Field mPollution = ReflectionUtils.getField(GT_Pollution.getClass(), "mPollution");
if (mPollution != null) {
return mPollution.getBoolean(GT_Pollution);
}
}
- } catch (SecurityException | IllegalArgumentException | NoSuchFieldException | IllegalAccessException e) {
+ } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {
return false;
}
return false;
diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java
index 74ef604a56..5fbb07a570 100644
--- a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java
+++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java
@@ -2,6 +2,8 @@ package gtPlusPlus.core.world.darkworld.gen.gt;
import static gtPlusPlus.core.world.darkworld.gen.gt.WorldGen_GT_Base.debugWorldGen;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Random;
@@ -10,6 +12,7 @@ import gregtech.api.util.GT_Log;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_TileEntity_Ores;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld;
@@ -21,309 +24,309 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public class WorldGen_GT_Ore_Layer
- extends WorldGen_GT {
- public static ArrayList<WorldGen_GT_Ore_Layer> sList = new ArrayList<WorldGen_GT_Ore_Layer>();
- public static int sWeight = 0;
- public final short mMinY;
- public final short mMaxY;
- public final short mWeight;
- public final short mDensity;
- public final short mSize;
- public Block mPrimaryMeta;
- public Block mSecondaryMeta;
- public Block mBetweenMeta;
- public Block mSporadicMeta;
- public final Material mPrimary;
- public final Material mSecondary;
- public final Material mBetween;
- public final Material mSporadic;
-
-
- //public final String mBiome;
- public final String mRestrictBiome;
- public final boolean mOverworld;
- public final boolean mNether;
- public final boolean mEnd;
- public static final int WRONG_BIOME=0;
- public static final int WRONG_DIMENSION=1;
- public static final int NO_ORE_IN_BOTTOM_LAYER=2;
- public static final int NO_OVERLAP=3;
- public static final int ORE_PLACED=4;
-
-
- //public final boolean mMoon;
- //public final boolean mMars;
- //public final boolean mAsteroid;
- public final String aTextWorldgen = "worldgen.";
-
- public WorldGen_GT_Ore_Layer(String aName, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
- this(aName, true, aMinY, aMaxY, aWeight, aDensity, aSize, false, false, false, false, false, false, aPrimary, aSecondary, aBetween, aSporadic);
- }
-
-
- public 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 GC_UNUSED1, boolean GC_UNUSED2, boolean GC_UNUSED3, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
- super(aName, sList, aDefault);
- Logger.WORLD("Creating Ore Layer Object");
- this.mOverworld = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld);
- this.mNether = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether);
- this.mEnd = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd);
- //this.mMoon = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon);
- //this.mMars = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars);
- //this.mAsteroid = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid);
- this.mMinY = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY));
- short mMaxY = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY));
- if (mMaxY < (this.mMinY + 7)) {
- GT_Log.out.println(
- "Oremix " + this.mWorldGenName +
- " has invalid Min/Max heights!"
- );
- mMaxY = (short) (this.mMinY + 7);
- }
- this.mMaxY = mMaxY;
- this.mWeight = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight));
- this.mDensity = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity));
- this.mSize = ((short) Math.max(1, HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize)));
- this.mPrimary = aPrimary;
- this.mSecondary = aSecondary;
- this.mBetween = aBetween;
- this.mSporadic = aSporadic;
- this.mPrimaryMeta = aPrimary.getOreBlock(1);
- this.mSecondaryMeta = aSecondary.getOreBlock(1);
- this.mBetweenMeta = aBetween.getOreBlock(1);
- this.mSporadicMeta = aSporadic.getOreBlock(1);
- this.mRestrictBiome = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None");
-
- //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does not exist");
- //if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + " does not exist");
- //if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does not exist");
- //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does not exist");
-
- 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);
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- sWeight += this.mWeight;
- }
- }
-
- public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
-
- //Debug Handler
- /**
- * This handles Variables that are null during Init
- */
-
- if (this.mPrimaryMeta == Blocks.stone || this.mSecondaryMeta == Blocks.stone
- || this.mBetweenMeta == Blocks.stone || this.mSporadicMeta == Blocks.stone){
- this.mPrimaryMeta = this.mPrimary.getOreBlock(1);
- this.mSecondaryMeta = this.mSecondary.getOreBlock(1);
- this.mBetweenMeta = this.mBetween.getOreBlock(1);
- this.mSporadicMeta = this.mSporadic.getOreBlock(1);
- Logger.WORLD("[Vein Generator] An Ore in a Vein had defaulted back to a default value, so they have now been reset to correct values.");
- }
-
- if( mWorldGenName.equals("vein0") ) {
- if (debugWorldGen) GT_Log.out.println(
- " NoOresInVein-vein0"
- );
- // This is a special empty orevein
- Logger.WORLD("[World Generation Debug] Special Empty Vein placed.");
- return ORE_PLACED;
- }
- if (aDimensionType != Dimension_DarkWorld.DIMID) {
- /* // Debug code, but spams log
+extends WorldGen_GT {
+ public static ArrayList<WorldGen_GT_Ore_Layer> sList = new ArrayList<WorldGen_GT_Ore_Layer>();
+ public static int sWeight = 0;
+ public final short mMinY;
+ public final short mMaxY;
+ public final short mWeight;
+ public final short mDensity;
+ public final short mSize;
+ public Block mPrimaryMeta;
+ public Block mSecondaryMeta;
+ public Block mBetweenMeta;
+ public Block mSporadicMeta;
+ public final Material mPrimary;
+ public final Material mSecondary;
+ public final Material mBetween;
+ public final Material mSporadic;
+
+
+ //public final String mBiome;
+ public final String mRestrictBiome;
+ public final boolean mOverworld;
+ public final boolean mNether;
+ public final boolean mEnd;
+ public static final int WRONG_BIOME=0;
+ public static final int WRONG_DIMENSION=1;
+ public static final int NO_ORE_IN_BOTTOM_LAYER=2;
+ public static final int NO_OVERLAP=3;
+ public static final int ORE_PLACED=4;
+
+
+ //public final boolean mMoon;
+ //public final boolean mMars;
+ //public final boolean mAsteroid;
+ public final String aTextWorldgen = "worldgen.";
+
+ public WorldGen_GT_Ore_Layer(String aName, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
+ this(aName, true, aMinY, aMaxY, aWeight, aDensity, aSize, false, false, false, false, false, false, aPrimary, aSecondary, aBetween, aSporadic);
+ }
+
+
+ public 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 GC_UNUSED1, boolean GC_UNUSED2, boolean GC_UNUSED3, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
+ super(aName, sList, aDefault);
+ Logger.WORLD("Creating Ore Layer Object");
+ this.mOverworld = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld);
+ this.mNether = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether);
+ this.mEnd = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd);
+ //this.mMoon = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon);
+ //this.mMars = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars);
+ //this.mAsteroid = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid);
+ this.mMinY = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY));
+ short mMaxY = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY));
+ if (mMaxY < (this.mMinY + 7)) {
+ GT_Log.out.println(
+ "Oremix " + this.mWorldGenName +
+ " has invalid Min/Max heights!"
+ );
+ mMaxY = (short) (this.mMinY + 7);
+ }
+ this.mMaxY = mMaxY;
+ this.mWeight = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight));
+ this.mDensity = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity));
+ this.mSize = ((short) Math.max(1, HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize)));
+ this.mPrimary = aPrimary;
+ this.mSecondary = aSecondary;
+ this.mBetween = aBetween;
+ this.mSporadic = aSporadic;
+ this.mPrimaryMeta = aPrimary.getOreBlock(1);
+ this.mSecondaryMeta = aSecondary.getOreBlock(1);
+ this.mBetweenMeta = aBetween.getOreBlock(1);
+ this.mSporadicMeta = aSporadic.getOreBlock(1);
+ this.mRestrictBiome = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None");
+
+ //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does not exist");
+ //if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + " does not exist");
+ //if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does not exist");
+ //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does not exist");
+
+ 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);
+ //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
+ //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
+ sWeight += this.mWeight;
+ }
+ }
+
+ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
+
+ //Debug Handler
+ /**
+ * This handles Variables that are null during Init
+ */
+
+ if (this.mPrimaryMeta == Blocks.stone || this.mSecondaryMeta == Blocks.stone
+ || this.mBetweenMeta == Blocks.stone || this.mSporadicMeta == Blocks.stone){
+ this.mPrimaryMeta = this.mPrimary.getOreBlock(1);
+ this.mSecondaryMeta = this.mSecondary.getOreBlock(1);
+ this.mBetweenMeta = this.mBetween.getOreBlock(1);
+ this.mSporadicMeta = this.mSporadic.getOreBlock(1);
+ Logger.WORLD("[Vein Generator] An Ore in a Vein had defaulted back to a default value, so they have now been reset to correct values.");
+ }
+
+ if( mWorldGenName.equals("vein0") ) {
+ if (debugWorldGen) GT_Log.out.println(
+ " NoOresInVein-vein0"
+ );
+ // This is a special empty orevein
+ Logger.WORLD("[World Generation Debug] Special Empty Vein placed.");
+ return ORE_PLACED;
+ }
+ if (aDimensionType != Dimension_DarkWorld.DIMID) {
+ /* // Debug code, but spams log
if (debugWorldGen) {
GT_Log.out.println(
"Wrong dimension"
);
}
- */
- Logger.WORLD("[World Generation Debug] Wrong dimension.");
- return WRONG_DIMENSION;
- }
- if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) {
- return WRONG_BIOME;
- }
- int[] placeCount=new int[4];
-
- int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
- // Determine West/East ends of orevein
- int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
- int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
- // Limit Orevein to only blocks present in current chunk
- int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int eX = Math.min( eXVein, aChunkX + 2 + 16);
- if (wX >= eX) { //No overlap between orevein and this chunk exists in X
- /*
+ */
+ Logger.WORLD("[World Generation Debug] Wrong dimension.");
+ return WRONG_DIMENSION;
+ }
+ if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) {
+ return WRONG_BIOME;
+ }
+ int[] placeCount=new int[4];
+
+ int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
+ // Determine West/East ends of orevein
+ int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
+ int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
+ // Limit Orevein to only blocks present in current chunk
+ int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int eX = Math.min( eXVein, aChunkX + 2 + 16);
+ if (wX >= eX) { //No overlap between orevein and this chunk exists in X
+ /*
if (debugWorldGen) {
GT_Log.out.println(
"No X overlap"
);
}
- */
- return NO_OVERLAP;
- }
- // Determine North/Sound ends of orevein
- int nZVein = aSeedZ - aRandom.nextInt(mSize);
- int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
-
- int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
- if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z
- /*
+ */
+ return NO_OVERLAP;
+ }
+ // Determine North/Sound ends of orevein
+ int nZVein = aSeedZ - aRandom.nextInt(mSize);
+ int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
+
+ int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
+ if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z
+ /*
if (debugWorldGen) {
GT_Log.out.println(
"No Z overlap"
);
}
- */
- return NO_OVERLAP;
- }
- // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt().
- int localDensity = Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2))) );
-
- // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop
- // Now we do bottom-level-first oregen, and work our way upwards.
- int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure.
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- /*if ((placeCount[1]+placeCount[3])==0) {
+ */
+ return NO_OVERLAP;
+ }
+ // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt().
+ int localDensity = Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2))) );
+
+ // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop
+ // Now we do bottom-level-first oregen, and work our way upwards.
+ int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure.
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ /*if ((placeCount[1]+placeCount[3])==0) {
if (debugWorldGen) GT_Log.out.println(
" No ore in bottom layer"
);
return NO_ORE_IN_BOTTOM_LAYER; // Exit early, didn't place anything in the bottom layer
}*/
- Logger.WORLD("[World Generation Debug] Trying to set Ores?");
- for (level = tMinY; level < (tMinY-1+3); level++) {
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
- // Low Middle layer is between + sporadic
- // level should be = tMinY-1+3 from end of for loop
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // High Middle layer is between + primary + sporadic
- level++; // Increment level to next layer
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // Top two layers are primary + sporadic
- level++; // Increment level to next layer
- for( ; level < (tMinY + 6); level++){ // should do two layers
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
- if (debugWorldGen) {
- String tDimensionName = aWorld.provider.getDimensionName();
- GT_Log.out.println(
- "Generated Orevein:" + this.mWorldGenName +
- " Dimension=" + tDimensionName +
- " mX="+aChunkX/16+
- " mZ="+aChunkZ/16+
- " oreseedX="+ aSeedX/16 +
- " oreseedZ="+ aSeedZ/16 +
- " cY="+tMinY+
- " wXVein" + wXVein +
- " eXVein" + eXVein +
- " nZVein" + nZVein +
- " sZVein" + sZVein +
- " locDen=" + localDensity +
- " Den=" + this.mDensity +
- " Sec="+placeCount[1]+
- " Spo="+placeCount[3]+
- " Bet="+placeCount[2]+
- " Pri="+placeCount[0]
- );
- }
- // Something (at least the bottom layer must have 1 block) must have been placed, return true
- return ORE_PLACED;
- }
-
- @SuppressWarnings("deprecation")
+ Logger.WORLD("[World Generation Debug] Trying to set Ores?");
+ for (level = tMinY; level < (tMinY-1+3); level++) {
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ }
+ // Low Middle layer is between + sporadic
+ // level should be = tMinY-1+3 from end of for loop
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ // High Middle layer is between + primary + sporadic
+ level++; // Increment level to next layer
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ }
+ else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ // Top two layers are primary + sporadic
+ level++; // Increment level to next layer
+ for( ; level < (tMinY + 6); level++){ // should do two layers
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ }
+ if (debugWorldGen) {
+ String tDimensionName = aWorld.provider.getDimensionName();
+ GT_Log.out.println(
+ "Generated Orevein:" + this.mWorldGenName +
+ " Dimension=" + tDimensionName +
+ " mX="+aChunkX/16+
+ " mZ="+aChunkZ/16+
+ " oreseedX="+ aSeedX/16 +
+ " oreseedZ="+ aSeedZ/16 +
+ " cY="+tMinY+
+ " wXVein" + wXVein +
+ " eXVein" + eXVein +
+ " nZVein" + nZVein +
+ " sZVein" + sZVein +
+ " locDen=" + localDensity +
+ " Den=" + this.mDensity +
+ " Sec="+placeCount[1]+
+ " Spo="+placeCount[3]+
+ " Bet="+placeCount[2]+
+ " Pri="+placeCount[0]
+ );
+ }
+ // Something (at least the bottom layer must have 1 block) must have been placed, return true
+ return ORE_PLACED;
+ }
+
+ @SuppressWarnings("deprecation")
public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData, boolean isSmallOre,
boolean air) {
if (!air) {
aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1));
}
-
+
//Set GT ORE
if (aMetaData instanceof GT_Block_Ores){
-
+
if (this.mPrimaryMeta == aMetaData){
for (Materials f : Materials.values()){
if (Utils.sanitizeString(f.name().toLowerCase()).contains(Utils.sanitizeString(this.mPrimary.getLocalizedName().toLowerCase()))){
int r = f.mMetaItemSubID;
- if (GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, r, false)){
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
return true;
}
@@ -334,7 +337,7 @@ public class WorldGen_GT_Ore_Layer
for (Materials f : Materials.values()){
if (Utils.sanitizeString(f.name().toLowerCase()).contains(Utils.sanitizeString(this.mSecondary.getLocalizedName().toLowerCase()))){
int r = f.mMetaItemSubID;
- if (GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, r, false)){
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
return true;
}
@@ -345,7 +348,7 @@ public class WorldGen_GT_Ore_Layer
for (Materials f : Materials.values()){
if (Utils.sanitizeString(f.name().toLowerCase()).contains(Utils.sanitizeString(this.mBetween.getLocalizedName().toLowerCase()))){
int r = f.mMetaItemSubID;
- if (GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, r, false)){
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
return true;
}
@@ -356,16 +359,16 @@ public class WorldGen_GT_Ore_Layer
for (Materials f : Materials.values()){
if (Utils.sanitizeString(f.name().toLowerCase()).contains(Utils.sanitizeString(this.mSporadic.getLocalizedName().toLowerCase()))){
int r = f.mMetaItemSubID;
- if (GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, r, false)){
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
return true;
}
}
}
}
-
+
}
-
+
Block tBlock = aWorld.getBlock(aX, aY, aZ);
Block tOreBlock = aMetaData;
int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ);
@@ -385,5 +388,47 @@ public class WorldGen_GT_Ore_Layer
}
}
return false;
- }
+ }
+
+
+ private boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int mMetaItemSubID, boolean useless){
+
+ //Get Class and Methods
+ Method setOres = null;
+ boolean is08 = !CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
+
+ //GT 5.08
+ if (is08){
+ try {
+ setOres = GT_TileEntity_Ores.class.getDeclaredMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class);
+ }
+ catch (NoSuchMethodException | SecurityException e) {
+
+ }
+ }
+ //GT 5.09
+ else {
+ try {
+ setOres = GT_TileEntity_Ores.class.getDeclaredMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class, boolean.class);
+ }
+ catch (NoSuchMethodException | SecurityException e) {
+
+ }
+ }
+
+ try {
+ if (is08 && setOres != null){
+ setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID);
+ }
+ else if (!is08 && setOres != null){
+ setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID, useless);
+ }
+ else {
+ return false;
+ }}
+ catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+
+ }
+ return false;
+ }
} \ No newline at end of file