diff options
author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-09-16 05:14:47 +0200 |
---|---|---|
committer | boubou19 <miisterunknown@gmail.com> | 2024-09-17 22:55:46 +0200 |
commit | 26a2f3783138080105ea0e937d221b1b0baf8cb6 (patch) | |
tree | 69fd5eee1a0ab5b92ef8f9b3b179f7e011afca9a /src/main | |
parent | 04042808a9c9b79fee0d49b031cf798e29cdc5bb (diff) | |
download | GT5-Unofficial-26a2f3783138080105ea0e937d221b1b0baf8cb6.tar.gz GT5-Unofficial-26a2f3783138080105ea0e937d221b1b0baf8cb6.tar.bz2 GT5-Unofficial-26a2f3783138080105ea0e937d221b1b0baf8cb6.zip |
remove reflection from WorldGen_GT_Ore_Layer and fix ore generation in toxic everglades
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java | 113 |
1 files changed, 19 insertions, 94 deletions
diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java index bfeeff8910..74aad2d996 100644 --- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java +++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java @@ -2,8 +2,6 @@ package gtPlusPlus.everglades.gen.gt; import static gtPlusPlus.everglades.gen.gt.WorldGen_GT_Base.debugWorldGen; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -90,12 +88,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { this.mNether = HandlerGT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); this.mEnd = HandlerGT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); this.mMinY = 5; - short mMaxY = 14; - if (mMaxY < (this.mMinY + 7)) { - GTLog.out.println("Oremix " + this.mWorldGenName + " has invalid Min/Max heights!"); - mMaxY = (short) (this.mMinY + 7); - } - this.mMaxY = mMaxY; + this.mMaxY = (short) 14; this.mWeight = ((short) HandlerGT.sCustomWorldgenFile .get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); this.mDensity = ((short) HandlerGT.sCustomWorldgenFile @@ -119,11 +112,8 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { 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 - */ + // 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) { @@ -247,7 +237,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { } 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 + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -274,7 +264,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { } 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 + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -291,14 +281,14 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { .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 + // 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 + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -314,7 +304,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { .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 + // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) { placeCount[2]++; } @@ -326,7 +316,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { } 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 + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -350,7 +340,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { } 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 + // reduce by 1/7 to // compensate if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++; } @@ -398,8 +388,10 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { return ORE_PLACED; } - private String fString = "unset", ore1String = "unset", ore2String = "unset", ore3String = "unset", - ore4String = "unset"; + private String ore1String = "unset"; + private String ore2String = "unset"; + private String ore3String = "unset"; + private String ore4String = "unset"; Map<Materials, String> gtOreMap = new HashMap<>(); public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData, boolean isSmallOre, boolean air) { @@ -430,6 +422,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { .toLowerCase()); } + String fString; if (this.mPrimaryMeta == aMetaData) { for (Materials f : Materials.values()) { if (!gtOreMap.containsKey(f)) { @@ -438,15 +431,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { fString = gtOreMap.get(f); if (fString.contains(ore1String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -460,15 +445,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { fString = gtOreMap.get(f); if (fString.contains(ore2String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -482,15 +459,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { fString = gtOreMap.get(f); if (fString.contains(ore3String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -504,15 +473,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { fString = gtOreMap.get(f); if (fString.contains(ore4String)) { int r = f.mMetaItemSubID; - if (setOreBlock(aWorld, aX, aY, aZ, r, false)) { - Logger.WORLD( - "[World Generation Debug] Set " + f.mDefaultLocalName - + " Ore at X: " - + aX - + " | Y: " - + aY - + " | Z: " - + aZ); + if (TileEntityOres.setOreBlock(aWorld, aX, aY, aZ, r, false)) { return true; } } @@ -521,9 +482,6 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { } Block tBlock = aWorld.getBlock(aX, aY, aZ); - Block tOreBlock = aMetaData; - int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ); - String BlockName = tBlock.getUnlocalizedName(); if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sand) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt) @@ -534,43 +492,10 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, DimensionEverglades.blockSecondaryFiller) || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sandstone)) { - if (aWorld.setBlock(aX, aY, aZ, tOreBlock, 0, 3)) { - Logger.WORLD( - "[World Generation Debug] Set " + tOreBlock - .getLocalizedName() + " at X: " + aX + " | Y: " + aY + " | Z: " + aZ); + if (aWorld.setBlock(aX, aY, aZ, aMetaData, 0, 3)) { return true; } } return false; } - - private boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int mMetaItemSubID, boolean useless) { - - // Get Class and Methods - Method setOres = null; - - try { - setOres = TileEntityOres.class.getDeclaredMethod( - "setOreBlock", - World.class, - int.class, - int.class, - int.class, - int.class, - boolean.class); - } catch (NoSuchMethodException | SecurityException e) { - - } - - try { - if (setOres != null) { - setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID, useless); - } else { - return false; - } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - - } - return false; - } } |