diff options
Diffstat (limited to 'src/Java')
7 files changed, 167 insertions, 110 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 5f522215a0..6479a1d447 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -20,7 +20,6 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; import gregtech.api.util.EmptyRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; @@ -31,7 +30,6 @@ import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; import gtPlusPlus.core.item.general.RF2EU_Battery; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.gregtech.CustomGTMaterials; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.geo.GeoUtils; import gtPlusPlus.core.util.item.ItemUtils; @@ -219,9 +217,9 @@ public class GTplusplus implements ActionListener { Utils.LOG_INFO("Login Handler Initialized"); //Early load materials - try { + /*try { CustomGTMaterials.run(); - } catch (Throwable t){} + } catch (Throwable t){}*/ if (CORE.configSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ removeCircuitRecipeMap(); //Bye shitty recipes. @@ -261,9 +259,9 @@ public class GTplusplus implements ActionListener { this.dumpGtRecipeMap(Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes); } - for (Materials s : gtPlusPlus.core.material.gregtech.CustomGTMaterials.Custom_GT_Materials){ + /*for (Materials s : gtPlusPlus.core.material.gregtech.CustomGTMaterials.Custom_GT_Materials){ Utils.LOG_INFO("Verification for New Material: "+s.mName); - } + }*/ // Utils.LOG_INFO("Activating GT OreDictionary Handler, this can take // some time."); diff --git a/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java b/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java index cdb3bda718..b497e0e3a3 100644 --- a/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java +++ b/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java @@ -32,7 +32,7 @@ public class CustomGTMaterials { **/ - public static List<Materials> Custom_GT_Materials = new ArrayList<Materials>(); + /*public static List<Materials> Custom_GT_Materials = new ArrayList<Materials>(); public static Materials Zirconium = materialBuilder_Element(1232, TextureSet.SET_METALLIC, 6.0F, 256, 2, 1|2|8|32|64|128, 200, 200, 200, 0, "Zirconium", "Zirconium", 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray, Element.Zr, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 3))); public static Materials Geikielite = materialBuilder(1234, TextureSet.SET_SHINY, new int[]{1,2,3}, "Geikielite", Dyes.dyeBlack, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 3))); @@ -89,6 +89,6 @@ public class CustomGTMaterials { registerMaterial(newMat); return newMat; } - +*/ } diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index c53642c0ec..9440522db8 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -33,7 +33,7 @@ import net.minecraft.entity.Entity; public class ClientProxy extends CommonProxy implements Runnable{ - private final HashSet mCapeList = new HashSet(); + private final HashSet<String> mCapeList = new HashSet<String>(); private final GTPP_CapeRenderer mCapeRenderer; public ClientProxy(){ diff --git a/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java b/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java index e642258645..64c2751cde 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java @@ -11,7 +11,7 @@ import gregtech.api.enums.TextureSet; import gregtech.api.objects.MaterialStack; public class MaterialBuilder { - public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; + /*public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; private int metaItemSubID; private TextureSet iconSet; @@ -250,5 +250,5 @@ public class MaterialBuilder { this.canBeCracked = canBeCracked; return this; } - +*/ }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index f6db32fd5b..3b9e39208d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.W; import gregtech.api.util.*; import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -285,7 +286,7 @@ public enum GregtechItemList implements GregtechItemContainer { if (this.mHasNotBeenSet) { throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); } - return GT_Utility.getBlockFromStack(this.getItem()); + return getBlockFromStack(this.getItem()); } @Override @@ -305,6 +306,12 @@ public enum GregtechItemList implements GregtechItemContainer { } return GT_Utility.areUnificationsEqual((ItemStack)aStack, aWildcard?this.getWildcard(1):this.get(1), aIgnoreNBT); } + + public static Block getBlockFromStack(Object aStack) { + if (GT_Utility.isStackInvalid(aStack)) + return Blocks.air; + return Block.getBlockFromItem(((ItemStack) aStack).getItem()); + } @Override public ItemStack get(final long aAmount, final Object... aReplacements) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java index eb91919686..82048b17f7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java @@ -2,126 +2,158 @@ package gtPlusPlus.xmod.gregtech.api.world; import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; -import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; -import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_TileEntity_Ores; import gregtech.loaders.misc.GT_Achievements; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Random; public class GTPP_Worldgen_GT_Ore_Layer - extends GTPP_Worldgen { - public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_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 short mPrimaryMeta; - public short mSecondaryMeta; - public short mBetweenMeta; - public short mSporadicMeta; - public final String mRestrictBiome; - public final boolean mDarkWorld; - public final String aTextWorldgen = "worldgen.gtpp."; +extends GTPP_Worldgen { + public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_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 short mPrimaryMeta; + public short mSecondaryMeta; + public short mBetweenMeta; + public short mSporadicMeta; + public final String mRestrictBiome; + public final boolean mDarkWorld; + public final String aTextWorldgen = "worldgen.gtpp."; - public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { - super(aName, sList, aDefault); - this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); - this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { + super(aName, sList, aDefault); + this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); - if (this.mEnabled) { - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - sWeight += this.mWeight; - } - } + if (this.mEnabled) { + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + sWeight += this.mWeight; + } + } - public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { - super(aName, sList, aDefault); - this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Darkworld", true); - this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - /* this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + super(aName, sList, aDefault); + this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Darkworld", true); + this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + /* this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - */this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + */this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); - if (this.mEnabled) { - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - sWeight += this.mWeight; - } + if (this.mEnabled) { + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + sWeight += this.mWeight; + } } public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { - return false; //Not the correct biome for ore mix - } - if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (false)) || ((aDimensionType == 0) && (this.mDarkWorld)) || ((aDimensionType == 1) && (false)) || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { - return false; - } - int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); + if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { + return false; //Not the correct biome for ore mix + } + if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (false)) || ((aDimensionType == 0) && (this.mDarkWorld)) || ((aDimensionType == 1) && (false)) || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { + return false; + } + int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); + + int cX = aChunkX - aRandom.nextInt(this.mSize); + int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); + for (int tX = cX; tX <= eX; tX++) { + int cZ = aChunkZ - aRandom.nextInt(this.mSize); + int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); + for (int tZ = cZ; tZ <= eZ; tZ++) { + if (this.mSecondaryMeta > 0) { + for (int i = tMinY - 1; i < tMinY + 2; i++) { + if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); + } + } + } + if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { + setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); + } + if (this.mPrimaryMeta > 0) { + for (int i = tMinY + 3; i < tMinY + 6; i++) { + if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); + } + } + } + if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { + setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); + } + } + } + if (GT_Values.D1) { + System.out.println("Generated Orevein: " + this.mWorldGenName+" "+aChunkX +" "+ aChunkZ); + } + return true; + } + private Method mSetOre = null; + private boolean setOreBlock(World world, int x, int y, int z, int secondarymeta, boolean bool){ - int cX = aChunkX - aRandom.nextInt(this.mSize); - int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); - for (int tX = cX; tX <= eX; tX++) { - int cZ = aChunkZ - aRandom.nextInt(this.mSize); - int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); - for (int tZ = cZ; tZ <= eZ; tZ++) { - if (this.mSecondaryMeta > 0) { - for (int i = tMinY - 1; i < tMinY + 2; i++) { - if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); - } - } - } - if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { - GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); - } - if (this.mPrimaryMeta > 0) { - for (int i = tMinY + 3; i < tMinY + 6; i++) { - if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { - GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); - } - } - } - if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { - GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); - } - } - } - if (GT_Values.D1) { - System.out.println("Generated Orevein: " + this.mWorldGenName+" "+aChunkX +" "+ aChunkZ); - } - return true; - } + if (mSetOre == null){ + try { + mSetOre = GT_TileEntity_Ores.class.getMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class, boolean.class); + } + catch (SecurityException | NoSuchMethodException e) { + try { + mSetOre = GT_TileEntity_Ores.class.getMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class); + } + catch (SecurityException | NoSuchMethodException r) {} + } + } + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + try { + return (boolean) mSetOre.invoke(world, x, y, z, secondarymeta, bool); + } + catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException t) { + return false; + } + } + else { + try { + return (boolean) mSetOre.invoke(world, x, y, z, secondarymeta); + } + catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException t) { + return false;} + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java index 47cd725a10..1c46f6c122 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java @@ -6,6 +6,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTransformerHiAmp; +import net.minecraft.item.ItemStack; public class GregtechHiAmpTransformer { @@ -35,6 +36,25 @@ public class GregtechHiAmpTransformer { GregtechItemList.Transformer_HA_MAX_UV.set(new GregtechMetaTransformerHiAmp(mID++, "transformer.ha.tier.08", "UV Hi-Amp Transformer", 8, "Any Voltage -> UV (Use Soft Hammer to invert)").getStackForm(1L)); + ItemStack mItem_1; + ItemStack mItem_2; + ItemStack mItem_3; + try { + mItem_1 = ItemList.valueOf("Casing_Coil_TungstenSteel").get(1); + } catch (Throwable t){ + mItem_1 = ItemList.Circuit_Elite.get(1); + } + try { + mItem_2 = ItemList.valueOf("Casing_Coil_Naquadah").get(1); + } catch (Throwable t){ + mItem_2 = ItemList.Circuit_Master.get(1); + } + try { + mItem_3 = ItemList.valueOf("Casing_Coil_NaquadahAlloy").get(1); + } catch (Throwable t){ + mItem_3 = ItemList.Circuit_Ultimate.get(1); + } + GT_ModHandler.addCraftingRecipe(GregtechItemList.Transformer_HA_LV_ULV.get(1L, new Object[0]), bitsd, new Object[] { " BB", "CM ", " BB", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('C'), OrePrefixes.wireGt16.get(Materials.Tin), Character.valueOf('B'), @@ -66,17 +86,17 @@ public class GregtechHiAmpTransformer { new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('C'), OrePrefixes.wireGt16.get(Materials.Naquadah), Character.valueOf('B'), OrePrefixes.wireGt16.get(Materials.VanadiumGallium), Character.valueOf('K'), - ItemList.Casing_Coil_TungstenSteel }); + mItem_1 }); GT_ModHandler.addCraftingRecipe(GregtechItemList.Transformer_HA_UV_ZPM.get(1L, new Object[0]), bitsd, new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Hull_ZPM, Character.valueOf('C'), OrePrefixes.wireGt04.get(Materials.NaquadahAlloy), Character.valueOf('B'), OrePrefixes.wireGt16.get(Materials.Naquadah), Character.valueOf('K'), - ItemList.Casing_Coil_Naquadah }); + mItem_2 }); GT_ModHandler.addCraftingRecipe(GregtechItemList.Transformer_HA_MAX_UV.get(1L, new Object[0]), bitsd, new Object[] { "KBB", "CM ", "KBB", Character.valueOf('M'), ItemList.Hull_UV, Character.valueOf('C'), OrePrefixes.wireGt01.get(Materials.Superconductor), Character.valueOf('B'), OrePrefixes.wireGt04.get(Materials.NaquadahAlloy), Character.valueOf('K'), - ItemList.Casing_Coil_NaquadahAlloy }); + mItem_3 }); } } |