Browse Source

Added Config for disabling specific Stone Layer Ores

Gregorius Techneticies 2 months ago
parent
commit
19e3d528ba
Signed by: Gregorius Techneticies <gregoriustech@gmail.com> GPG Key ID: 1B693EA14F2FD70F

+ 1
- 0
CHANGELOG.md View File

@@ -20,6 +20,7 @@ Nothing (I tend to only add finished Stuff to the Changelog).
20 20
 [ADDED] Barbecue Sauce (BBQ Sauce), because why not.
21 21
 [ADDED] Axes, Saws and Chainsaws can now place Saplings too. They will still place Workbenches if Saplings cant be placed.
22 22
 [ADDED] Tooltip for Covers that can be controlled with the Cover Controller Cover. In case of Covers where the Cover Controller Cover is required (such as Shutter Cover), it will be Cyan instead of Dark Gray to make it easier to see.
23
+[ADDED] Config to make it possible to disable specific Ores in Stone Layers from generating.
23 24
 
24 25
 
25 26
 6.14.08:

+ 1
- 1
src/main/java/gregapi/data/CS.java View File

@@ -841,7 +841,7 @@ public class CS {
841 841
 	, DIM_NETHER = -1
842 842
 	, DIM_END = 1
843 843
 	, DIM_ENVM = -2
844
-	, DIM_AROMA = 6 // Collides with Aether by default
844
+	, DIM_AROMA = -6 // Collides with Aether by default
845 845
 	, DIM_MOON = 2
846 846
 	, DIM_MARS = 3
847 847
 	, DIM_ASTEROIDS = 4

+ 3
- 2
src/main/java/gregapi/fluid/FluidTankGT.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2020 GregTech-6 Team
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -42,10 +42,11 @@ public class FluidTankGT implements IFluidTank {
42 42
 	private Map<String, Long> mAdjustableCapacity = null;
43 43
 	private long mAdjustableMultiplier = 1;
44 44
 	
45
+	public FluidTankGT() {mCapacity = Long.MAX_VALUE;}
46
+	public FluidTankGT(long aCapacity) {mCapacity = aCapacity;}
45 47
 	public FluidTankGT(FluidStack aFluid) {mFluid = aFluid; if (aFluid != null) {mCapacity = aFluid.amount; mAmount = aFluid.amount;}}
46 48
 	public FluidTankGT(FluidStack aFluid, long aCapacity) {mFluid = aFluid; mCapacity = aCapacity; mAmount = (aFluid == null ? 0 : aFluid.amount);}
47 49
 	public FluidTankGT(FluidStack aFluid, long aAmount, long aCapacity) {mFluid = aFluid; mCapacity = aCapacity; mAmount = (aFluid == null ? 0 : aAmount);}
48
-	public FluidTankGT(long aCapacity) {mCapacity = aCapacity;}
49 50
 	public FluidTankGT(Fluid aFluid, long aAmount) {this(FL.make(aFluid, aAmount)); mAmount = aAmount;}
50 51
 	public FluidTankGT(Fluid aFluid, long aAmount, long aCapacity) {this(FL.make(aFluid, aAmount), aCapacity); mAmount = aAmount;}
51 52
 	public FluidTankGT(NBTTagCompound aNBT, long aCapacity) {mCapacity = aCapacity; if (aNBT != null && !aNBT.hasNoTags()) {mFluid = FL.load_(aNBT); mAmount = (isEmpty() ? 0 : aNBT.hasKey("LAmount") ? aNBT.getLong("LAmount") : mFluid.amount);}}

+ 15
- 13
src/main/java/gregapi/worldgen/StoneLayer.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2020 GregTech-6 Team
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -35,6 +35,7 @@ import gregapi.code.ArrayListNoNulls;
35 35
 import gregapi.code.HashSetNoNulls;
36 36
 import gregapi.code.ItemStackContainer;
37 37
 import gregapi.data.CS.BlocksGT;
38
+import gregapi.data.CS.ConfigsGT;
38 39
 import gregapi.data.MT;
39 40
 import gregapi.oredict.OreDictMaterial;
40 41
 import gregapi.util.UT;
@@ -62,18 +63,19 @@ public class StoneLayer {
62 63
 		this(aStone, aMetaStone, aCobble, aMetaCobble, aCobble, aMetaCobble, aMaterial, aOres);
63 64
 	}
64 65
 	public StoneLayer(Block aStone, long aMetaStone, Block aCobble, long aMetaCobble, Block aMossy, long aMetaMossy, OreDictMaterial aMaterial, StoneLayerOres... aOres) {
65
-		mStone  = (aStone  == null || aStone  == NB ? Blocks.stone : aStone);
66
-		mMossy  = (aMossy  == null || aMossy  == NB ? mStone : aMossy);
67
-		mCobble = (aCobble == null || aCobble == NB ? mStone : aCobble);
68
-		mMetaStone = UT.Code.bind4(aMetaStone);
69
-		mMetaMossy = UT.Code.bind4(aMetaMossy);
70
-		mMetaCobble = UT.Code.bind4(aMetaCobble);
71
-		mMaterial = (aMaterial == null ? MT.Stone : aMaterial);
72
-		mStack = new ItemStackContainer(mStone, 1, mMetaStone);
73
-		mOre = BlocksGT.stoneToNormalOres.get(mStack);
74
-		mOreSmall = BlocksGT.stoneToSmallOres.get(mStack);
75
-		mOreBroken = BlocksGT.stoneToBrokenOres.get(mStack);
76
-		mOres = new ArrayListNoNulls<>(F, aOres);
66
+		mStone      = (aStone  == null || aStone  == NB ?                                 Blocks.stone                       : aStone );
67
+		mCobble     = (aCobble == null || aCobble == NB ? Blocks.stone       == mStone  ? Blocks.cobblestone       : mStone  : aCobble);
68
+		mMossy      = (aMossy  == null || aMossy  == NB ? Blocks.cobblestone == mCobble ? Blocks.mossy_cobblestone : mCobble : aMossy );
69
+		mMetaStone  = (Blocks.stone             == mStone  ? 0 : UT.Code.bind4(aMetaStone ));
70
+		mMetaCobble = (Blocks.cobblestone       == mCobble ? 0 : UT.Code.bind4(aMetaCobble));
71
+		mMetaMossy  = (Blocks.mossy_cobblestone == mMossy  ? 0 : UT.Code.bind4(aMetaMossy ));
72
+		mMaterial   = (aMaterial == null ? MT.Stone : aMaterial);
73
+		mStack      = new ItemStackContainer(mStone, 1, mMetaStone);
74
+		mOre        = BlocksGT.stoneToNormalOres.get(mStack);
75
+		mOreBroken  = BlocksGT.stoneToBrokenOres.get(mStack);
76
+		mOreSmall   = BlocksGT.stoneToSmallOres .get(mStack);
77
+		mOres       = new ArrayListNoNulls<>(8);
78
+		for (StoneLayerOres tOre : aOres) if (tOre.mMaterial != MT.Empty && ConfigsGT.WORLDGEN.get("stonelayers."+mMaterial.mNameInternal, tOre.mMaterial.mNameInternal, T)) mOres.add(tOre);
77 79
 	}
78 80
 	
79 81
 	/** List of Stone and Ore Blocks, that can simply be replaced by the Stone Layers. */

+ 7
- 7
src/main/java/gregapi/worldgen/StoneLayerOres.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2019 Gregorius Techneticies
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -39,7 +39,7 @@ public class StoneLayerOres {
39 39
 	public ArrayList<String> mBiomes = new ArrayList<>();
40 40
 	
41 41
 	public StoneLayerOres(OreDictMaterial aMaterial, long aChance, int aMinY, int aMaxY) {
42
-		mMaterial = (aMaterial == null || aMaterial.mID < 0 ? MT.Empty : aMaterial);
42
+		mMaterial = (aMaterial != null && aMaterial.mID > 0 ? aMaterial : MT.Empty);
43 43
 		mChance = UT.Code.bind(1, U, aChance);
44 44
 		if (aMinY > aMaxY) {mMinY = aMaxY; mMaxY = aMinY;} else {mMinY = aMinY; mMaxY = aMaxY;}
45 45
 	}
@@ -49,25 +49,25 @@ public class StoneLayerOres {
49 49
 	}
50 50
 	
51 51
 	public boolean check(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome, int aRandomNumber) {
52
-		return aY >= mMinY && aY <= mMaxY && aRandomNumber < mChance && (mBiomes.isEmpty() || mBiomes.contains(aBiome.biomeName));
52
+		return aY >= mMinY && aY <= mMaxY && aRandomNumber           < mChance && (mBiomes.isEmpty() || mBiomes.contains(aBiome.biomeName));
53 53
 	}
54 54
 	public boolean check(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome, Random aRandom) {
55 55
 		return aY >= mMinY && aY <= mMaxY && aRandom.nextInt((int)U) < mChance && (mBiomes.isEmpty() || mBiomes.contains(aBiome.biomeName));
56 56
 	}
57 57
 	public boolean check(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome) {
58
-		return aY >= mMinY && aY <= mMaxY && RNGSUS.nextInt((int)U) < mChance && (mBiomes.isEmpty() || mBiomes.contains(aBiome.biomeName));
58
+		return aY >= mMinY && aY <= mMaxY && RNGSUS .nextInt((int)U) < mChance && (mBiomes.isEmpty() || mBiomes.contains(aBiome.biomeName));
59 59
 	}
60 60
 	public boolean set(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome, Random aRandom) {
61 61
 		return aY == mMinY || aY == mMaxY || aRandom.nextBoolean() ? small(aLayer, aWorld, aX, aY, aZ, aBiome) : normal(aLayer, aWorld, aX, aY, aZ, aBiome);
62 62
 	}
63 63
 	public boolean set(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome) {
64
-		return aY == mMinY || aY == mMaxY || RNGSUS.nextBoolean() ? small(aLayer, aWorld, aX, aY, aZ, aBiome) : normal(aLayer, aWorld, aX, aY, aZ, aBiome);
64
+		return aY == mMinY || aY == mMaxY || RNGSUS .nextBoolean() ? small(aLayer, aWorld, aX, aY, aZ, aBiome) : normal(aLayer, aWorld, aX, aY, aZ, aBiome);
65 65
 	}
66 66
 	public boolean normal(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome) {
67
-		return aLayer.mOre != null && aLayer.mOre.placeBlock(aWorld, aX, aY, aZ, (byte)6, mMaterial.mID, null, F, T);
67
+		return aLayer.mOre       != null && aLayer.mOre      .placeBlock(aWorld, aX, aY, aZ, (byte)6, mMaterial.mID, null, F, T);
68 68
 	}
69 69
 	public boolean small(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome) {
70
-		return aLayer.mOreSmall != null && aLayer.mOreSmall.placeBlock(aWorld, aX, aY, aZ, (byte)6, mMaterial.mID, null, F, T);
70
+		return aLayer.mOreSmall  != null && aLayer.mOreSmall .placeBlock(aWorld, aX, aY, aZ, (byte)6, mMaterial.mID, null, F, T);
71 71
 	}
72 72
 	public boolean broken(StoneLayer aLayer, World aWorld, int aX, int aY, int aZ, BiomeGenBase aBiome) {
73 73
 		return aLayer.mOreBroken != null && aLayer.mOreBroken.placeBlock(aWorld, aX, aY, aZ, (byte)6, mMaterial.mID, null, F, T);

+ 2
- 2
src/main/java/gregtech/tileentity/multiblocks/MultiTileEntityLargeTurbineGas.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2019 Gregorius Techneticies
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -39,7 +39,7 @@ import net.minecraftforge.fluids.IFluidTank;
39 39
  * @author Gregorius Techneticies
40 40
  */
41 41
 public class MultiTileEntityLargeTurbineGas extends MultiTileEntityLargeTurbine {
42
-	public FluidTankGT mInputTank = new FluidTankGT(Integer.MAX_VALUE), mTanksOutput[] = new FluidTankGT[] {new FluidTankGT(Integer.MAX_VALUE), new FluidTankGT(Integer.MAX_VALUE), new FluidTankGT(Integer.MAX_VALUE)};
42
+	public FluidTankGT mInputTank = new FluidTankGT(), mTanksOutput[] = new FluidTankGT[] {new FluidTankGT(), new FluidTankGT(), new FluidTankGT()};
43 43
 	public FluidTankGT[] mTanks = new FluidTankGT[] {mInputTank, mTanksOutput[0], mTanksOutput[1], mTanksOutput[2]};
44 44
 	public RecipeMap mRecipes = FM.Gas;
45 45
 	public Recipe mLastRecipe = null;

+ 2
- 2
src/main/java/gregtech/tileentity/multiblocks/MultiTileEntityLargeTurbineSteam.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2019 Gregorius Techneticies
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -39,7 +39,7 @@ import net.minecraftforge.fluids.IFluidTank;
39 39
  * @author Gregorius Techneticies
40 40
  */
41 41
 public class MultiTileEntityLargeTurbineSteam extends MultiTileEntityLargeTurbine {
42
-	public FluidTankGT[] mTanks = new FluidTankGT[] {new FluidTankGT(Integer.MAX_VALUE), new FluidTankGT(Integer.MAX_VALUE)};
42
+	public FluidTankGT[] mTanks = new FluidTankGT[] {new FluidTankGT(), new FluidTankGT()};
43 43
 	public long mSteamCounter = 0, mEnergyProducedNextTick = 0; 
44 44
 	public static final int STEAM_PER_WATER = 170;
45 45
 	

+ 2
- 2
src/main/java/gregtech/worldgen/WorldgenHives.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2020 GregTech-6 Team
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -103,7 +103,7 @@ public class WorldgenHives extends WorldgenObject {
103 103
 				tCount = 0;
104 104
 			}
105 105
 			return rResult;
106
-		case DIM_OVERWORLD: case DIM_ALFHEIM: case DIM_TROPICS: case DIM_UNKNOWN: case DIM_TWILIGHT:
106
+		case DIM_OVERWORLD: case DIM_ALFHEIM: case DIM_TROPICS: case DIM_UNKNOWN: case DIM_TWILIGHT: case DIM_AROMA:
107 107
 			for (tY = 8; tY < 28; tY++) {
108 108
 				Block tBlock = WD.block(aWorld, tX, tY, tZ);
109 109
 				if (tBlock.getMaterial() == Material.rock && WD.opq(tBlock) && WD.stone(tBlock, WD.meta(aWorld, tX, tY, tZ))) {

+ 5
- 5
src/main/java/gregtech/worldgen/WorldgenStoneLayers.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2020 GregTech-6 Team
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -97,13 +97,13 @@ public class WorldgenStoneLayers extends WorldgenObject {
97 97
 					tCanPlaceRocks = T;
98 98
 					boolean temp = T;
99 99
 					if (tScan[5] == tScan[1]) {
100
-						for (StoneLayerOres tOres : tScan[3].mOres) if (tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && (tScan[6] == tScan[0] ? tOres.normal(tScan[3], aWorld, tX, tY, tZ, aBiome) : tOres.small(tScan[3], aWorld, tX, tY, tZ, aBiome))) {
100
+						for (StoneLayerOres tOres : tScan[3].mOres) if (tOres.mMaterial.mID > 0 && tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && (tScan[6] == tScan[0] ? tOres.normal(tScan[3], aWorld, tX, tY, tZ, aBiome) : tOres.small(tScan[3], aWorld, tX, tY, tZ, aBiome))) {
101 101
 							tLastOre = tOres.mMaterial;
102 102
 							temp = F;
103 103
 							break;
104 104
 						}
105 105
 					} else {
106
-						for (StoneLayerOres tOres : StoneLayer.get(tScan[5], tScan[1])) if (tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && tOres.set(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom)) {
106
+						for (StoneLayerOres tOres : StoneLayer.get(tScan[5], tScan[1])) if (tOres.mMaterial.mID > 0 && tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && tOres.set(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom)) {
107 107
 							tLastOre = tOres.mMaterial;
108 108
 							temp = F;
109 109
 							break;
@@ -141,13 +141,13 @@ public class WorldgenStoneLayers extends WorldgenObject {
141 141
 					tCanPlaceRocks = T;
142 142
 					boolean temp = T;
143 143
 					if (tScan[5] == tScan[1]) {
144
-						for (StoneLayerOres tOres : tScan[3].mOres) if (tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && (tScan[6] == tScan[0] ? tOres.normal(tScan[3], aWorld, tX, tY, tZ, aBiome) : tOres.small(tScan[3], aWorld, tX, tY, tZ, aBiome))) {
144
+						for (StoneLayerOres tOres : tScan[3].mOres) if (tOres.mMaterial.mID > 0 && tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && (tScan[6] == tScan[0] ? tOres.normal(tScan[3], aWorld, tX, tY, tZ, aBiome) : tOres.small(tScan[3], aWorld, tX, tY, tZ, aBiome))) {
145 145
 							tLastOre = tOres.mMaterial;
146 146
 							temp = F;
147 147
 							break;
148 148
 						}
149 149
 					} else {
150
-						for (StoneLayerOres tOres : StoneLayer.get(tScan[5], tScan[1])) if (tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && tOres.set(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom)) {
150
+						for (StoneLayerOres tOres : StoneLayer.get(tScan[5], tScan[1])) if (tOres.mMaterial.mID > 0 && tOres.check(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom) && tOres.set(tScan[3], aWorld, tX, tY, tZ, aBiome, aRandom)) {
151 151
 							tLastOre = tOres.mMaterial;
152 152
 							temp = F;
153 153
 							break;

Loading…
Cancel
Save