aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/world
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
commit0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch)
tree1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/world
parentf8cc82edeb9810c45cba762d733a2c909a302faa (diff)
downloadGT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/world')
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen.java55
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Ore.java19
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java37
-rw-r--r--src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java39
4 files changed, 45 insertions, 105 deletions
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java
index 698ed0d1c9..3d2fe466c2 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen.java
@@ -1,13 +1,15 @@
package gregtech.api.world;
-import gregtech.api.GregTech_API;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
+
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
+import gregtech.api.GregTech_API;
+
public abstract class GT_Worldgen {
public final String mWorldGenName;
@@ -29,29 +31,13 @@ public abstract class GT_Worldgen {
* @param aChunkZ zCoord of the Chunk
* @return if the Worldgeneration has been successfully completed
*/
- public boolean executeWorldgen(
- World aWorld,
- Random aRandom,
- String aBiome,
- int aDimensionType,
- int aChunkX,
- int aChunkZ,
- IChunkProvider aChunkGenerator,
- IChunkProvider aChunkProvider) {
+ public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
+ int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
return false;
}
- public int executeWorldgenChunkified(
- World aWorld,
- Random aRandom,
- String aBiome,
- int aDimensionType,
- int aChunkX,
- int aChunkZ,
- int seedX,
- int seedZ,
- IChunkProvider aChunkGenerator,
- IChunkProvider aChunkProvider) {
+ public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
+ int aChunkZ, int seedX, int seedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
return 4; // This is for the empty Orevein
}
@@ -64,24 +50,18 @@ public abstract class GT_Worldgen {
* @param aChunkZ zCoord of the Chunk
* @return if the Worldgeneration has been successfully completed
*/
- public boolean executeCavegen(
- World aWorld,
- Random aRandom,
- String aBiome,
- int aDimensionType,
- int aChunkX,
- int aChunkZ,
- IChunkProvider aChunkGenerator,
- IChunkProvider aChunkProvider) {
+ public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
+ int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
return false;
}
/**
*
- * @param aWorld The World Object
- * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End
- * @param aAllowedDimensionType The Type of allowed Worldgeneration
- * @return if generation for this world is allowed for MoronTech (tm) OreGen (ATM (2.0.3.1Dev) only End, Nether, Overworld, Twilight Forest and Deep Dark)
+ * @param aWorld The World Object
+ * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End
+ * @param aAllowedDimensionType The Type of allowed Worldgeneration
+ * @return if generation for this world is allowed for MoronTech (tm) OreGen (ATM (2.0.3.1Dev) only End, Nether,
+ * Overworld, Twilight Forest and Deep Dark)
*/
public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) {
@@ -89,13 +69,14 @@ public abstract class GT_Worldgen {
|| (aWorld.provider.getDimensionName().equalsIgnoreCase("Nether"))
|| (aWorld.provider.getDimensionName().equalsIgnoreCase("The End"))
|| (aWorld.provider.getDimensionName().equalsIgnoreCase("Twilight Forest"))
- || (aWorld.provider.getDimensionName().equalsIgnoreCase("Underdark")))) return false;
+ || (aWorld.provider.getDimensionName().equalsIgnoreCase("Underdark"))))
+ return false;
String aDimName = aWorld.provider.getDimensionName();
Boolean tAllowed = mDimensionMap.get(aDimName);
if (tAllowed == null) {
- boolean tValue = GregTech_API.sWorldgenFile.get(
- "worldgen." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType);
+ boolean tValue = GregTech_API.sWorldgenFile
+ .get("worldgen." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType);
mDimensionMap.put(aDimName, tValue);
return tValue;
}
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
index c9d1325529..d3aa6b0e10 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java
@@ -1,29 +1,22 @@
package gregtech.api.world;
-import gregtech.api.GregTech_API;
import java.util.ArrayList;
import java.util.Collection;
+
import net.minecraft.block.Block;
+import gregtech.api.GregTech_API;
+
public abstract class GT_Worldgen_Ore extends GT_Worldgen {
+
public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType;
public final Block mBlock;
public final Collection<String> mBiomeList;
public final boolean mAllowToGenerateinVoid;
private final String aTextWorldgen = "worldgen.";
- public GT_Worldgen_Ore(
- String aName,
- boolean aDefault,
- Block aBlock,
- int aBlockMeta,
- int aDimensionType,
- int aAmount,
- int aSize,
- int aProbability,
- int aMinY,
- int aMaxY,
- Collection<String> aBiomeList,
+ public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType,
+ int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList,
boolean aAllowToGenerateinVoid) {
super(aName, GregTech_API.sWorldgenList, aDefault);
mDimensionType = aDimensionType;
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java
index 92c00bc455..5916d04a49 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java
@@ -2,24 +2,16 @@ package gregtech.api.world;
import java.util.Collection;
import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore {
- public GT_Worldgen_Ore_SingleBlock(
- String aName,
- boolean aDefault,
- Block aBlock,
- int aBlockMeta,
- int aDimensionType,
- int aAmount,
- int aSize,
- int aProbability,
- int aMinY,
- int aMaxY,
- Collection<String> aBiomeList,
+
+ public GT_Worldgen_Ore_SingleBlock(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType,
+ int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList,
boolean aAllowToGenerateinVoid) {
super(
aName,
@@ -37,28 +29,19 @@ public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore {
}
@Override
- public boolean executeWorldgen(
- World aWorld,
- Random aRandom,
- String aBiome,
- int aDimensionType,
- int aChunkX,
- int aChunkZ,
- IChunkProvider aChunkGenerator,
- IChunkProvider aChunkProvider) {
+ public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
+ int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType)
&& (mBiomeList.isEmpty() || mBiomeList.contains(aBiome))
&& (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
- int tX = aChunkX + aRandom.nextInt(16),
- tY = mMinY + aRandom.nextInt(mMaxY - mMinY),
+ int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY),
tZ = aChunkZ + aRandom.nextInt(16);
Block tBlock = aWorld.getBlock(tX, tY, tZ);
if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ))
- || (tBlock != null
- && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone)
- || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone)
- || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) {
+ || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone)
+ || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone)
+ || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) {
aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0);
}
}
diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java
index 940f923815..a1bd913ace 100644
--- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java
+++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java
@@ -2,25 +2,17 @@ package gregtech.api.world;
import java.util.Collection;
import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore {
- public GT_Worldgen_Ore_SingleBlock_UnderLava(
- String aName,
- boolean aDefault,
- Block aBlock,
- int aBlockMeta,
- int aDimensionType,
- int aAmount,
- int aSize,
- int aProbability,
- int aMinY,
- int aMaxY,
- Collection<String> aBiomeList,
- boolean aAllowToGenerateinVoid) {
+
+ public GT_Worldgen_Ore_SingleBlock_UnderLava(String aName, boolean aDefault, Block aBlock, int aBlockMeta,
+ int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY,
+ Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(
aName,
aDefault,
@@ -37,28 +29,19 @@ public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore {
}
@Override
- public boolean executeCavegen(
- World aWorld,
- Random aRandom,
- String aBiome,
- int aDimensionType,
- int aChunkX,
- int aChunkZ,
- IChunkProvider aChunkGenerator,
- IChunkProvider aChunkProvider) {
+ public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
+ int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType)
&& (mBiomeList.isEmpty() || mBiomeList.contains(aBiome))
&& (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
- int tX = aChunkX + aRandom.nextInt(16),
- tY = mMinY + aRandom.nextInt(mMaxY - mMinY),
+ int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY),
tZ = aChunkZ + aRandom.nextInt(16);
Block tBlock = aWorld.getBlock(tX, tY, tZ);
if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ))
- || (tBlock != null
- && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone)
- || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone)
- || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) {
+ || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone)
+ || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone)
+ || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) {
if (aWorld.getBlock(tX, tY + 1, tZ) == Blocks.lava
|| aWorld.getBlock(tX, tY, tZ) == Blocks.flowing_lava)
aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0);