From 1b820de08a05070909a267e17f033fcf58ac8710 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 2 Sep 2024 23:17:17 +0200 Subject: The Great Renaming (#3014) * move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names --- src/main/java/gregtech/api/world/GTWorldgen.java | 123 ++++++++++++++++++++++ src/main/java/gregtech/api/world/GT_Worldgen.java | 123 ---------------------- 2 files changed, 123 insertions(+), 123 deletions(-) create mode 100644 src/main/java/gregtech/api/world/GTWorldgen.java delete mode 100644 src/main/java/gregtech/api/world/GT_Worldgen.java (limited to 'src/main/java/gregtech/api/world') diff --git a/src/main/java/gregtech/api/world/GTWorldgen.java b/src/main/java/gregtech/api/world/GTWorldgen.java new file mode 100644 index 0000000000..da3a66ef7e --- /dev/null +++ b/src/main/java/gregtech/api/world/GTWorldgen.java @@ -0,0 +1,123 @@ +package gregtech.api.world; + +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 net.minecraftforge.common.DimensionManager; + +import gregtech.common.WorldgenGTOreLayer; +import gregtech.common.WorldgenGTOreSmallPieces; + +public abstract class GTWorldgen { + + public final String mWorldGenName; + public final boolean mEnabled; + private final Map mDimensionMap = new ConcurrentHashMap<>(); + + @SuppressWarnings({ "unchecked", "rawtypes" }) // The adding of "this" needs a List which does not exist + public GTWorldgen(String aName, List aList, boolean aDefault) { + mWorldGenName = aName; + mEnabled = aDefault; + if (mEnabled) aList.add(this); + } + + /** + * @param aWorld The World Object + * @param aRandom The Random Generator to use + * @param aBiome The Name of the Biome (always != null) + * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End + * @param aChunkX xCoord of the Chunk + * @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) { + 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) { + return 4; // This is for the empty Orevein + } + + /** + * + * @param aDimName The Dimension Name + * @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(String aDimName, int aDimensionType, int aAllowedDimensionType) { + if (aDimName.equalsIgnoreCase("Underdark")) { + return false; + } + if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") + || aDimName.equalsIgnoreCase("The End") + || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; + + Boolean tAllowed = mDimensionMap.get(aDimName); + if (tAllowed == null) { + mDimensionMap.put(aDimName, aDimensionType == aAllowedDimensionType); + return aDimensionType == aAllowedDimensionType; + } + return tAllowed; + } + + public boolean isGenerationAllowed(World aWorld, int aAllowedDimensionType) { + World allowedWorld = DimensionManager.getWorld(aAllowedDimensionType); + if (allowedWorld != null && allowedWorld.provider != null) { + return isGenerationAllowed(aWorld, allowedWorld.provider.getClass()); + } else { + return aWorld.provider.dimensionId == aAllowedDimensionType; + } + } + + /** + * + * @param aWorld The World Object + * @param aAllowedDimensionTypes The Types 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, Class... aAllowedDimensionTypes) { + String aDimName = aWorld.provider.getDimensionName(); + if (aDimName.equalsIgnoreCase("Underdark")) { + return false; + } + if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") + || aDimName.equalsIgnoreCase("The End") + || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; + + Boolean tAllowed = mDimensionMap.get(aDimName); + if (tAllowed == null) { + boolean value = false; + for (int i = 0; i < aAllowedDimensionTypes.length; i++) { + if (aAllowedDimensionTypes[i].isInstance(aWorld.provider)) { + value = true; + } + } + + // ugly, but idk how to do it better without hard depping on tf provider in ore constructors + if (this instanceof WorldgenGTOreSmallPieces ore) { + if (ore.twilightForest && aWorld.provider.dimensionId == 7) { + value = true; + } + } + + if (this instanceof WorldgenGTOreLayer ore) { + if (ore.twilightForest && aWorld.provider.dimensionId == 7) { + value = true; + } + } + + mDimensionMap.put(aDimName, value); + return value; + } + return tAllowed; + } +} diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java deleted file mode 100644 index a3393324c2..0000000000 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ /dev/null @@ -1,123 +0,0 @@ -package gregtech.api.world; - -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 net.minecraftforge.common.DimensionManager; - -import gregtech.common.GT_Worldgen_GT_Ore_Layer; -import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; - -public abstract class GT_Worldgen { - - public final String mWorldGenName; - public final boolean mEnabled; - private final Map mDimensionMap = new ConcurrentHashMap<>(); - - @SuppressWarnings({ "unchecked", "rawtypes" }) // The adding of "this" needs a List which does not exist - public GT_Worldgen(String aName, List aList, boolean aDefault) { - mWorldGenName = aName; - mEnabled = aDefault; - if (mEnabled) aList.add(this); - } - - /** - * @param aWorld The World Object - * @param aRandom The Random Generator to use - * @param aBiome The Name of the Biome (always != null) - * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End - * @param aChunkX xCoord of the Chunk - * @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) { - 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) { - return 4; // This is for the empty Orevein - } - - /** - * - * @param aDimName The Dimension Name - * @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(String aDimName, int aDimensionType, int aAllowedDimensionType) { - if (aDimName.equalsIgnoreCase("Underdark")) { - return false; - } - if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") - || aDimName.equalsIgnoreCase("The End") - || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; - - Boolean tAllowed = mDimensionMap.get(aDimName); - if (tAllowed == null) { - mDimensionMap.put(aDimName, aDimensionType == aAllowedDimensionType); - return aDimensionType == aAllowedDimensionType; - } - return tAllowed; - } - - public boolean isGenerationAllowed(World aWorld, int aAllowedDimensionType) { - World allowedWorld = DimensionManager.getWorld(aAllowedDimensionType); - if (allowedWorld != null && allowedWorld.provider != null) { - return isGenerationAllowed(aWorld, allowedWorld.provider.getClass()); - } else { - return aWorld.provider.dimensionId == aAllowedDimensionType; - } - } - - /** - * - * @param aWorld The World Object - * @param aAllowedDimensionTypes The Types 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, Class... aAllowedDimensionTypes) { - String aDimName = aWorld.provider.getDimensionName(); - if (aDimName.equalsIgnoreCase("Underdark")) { - return false; - } - if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") - || aDimName.equalsIgnoreCase("The End") - || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; - - Boolean tAllowed = mDimensionMap.get(aDimName); - if (tAllowed == null) { - boolean value = false; - for (int i = 0; i < aAllowedDimensionTypes.length; i++) { - if (aAllowedDimensionTypes[i].isInstance(aWorld.provider)) { - value = true; - } - } - - // ugly, but idk how to do it better without hard depping on tf provider in ore constructors - if (this instanceof GT_Worldgen_GT_Ore_SmallPieces ore) { - if (ore.twilightForest && aWorld.provider.dimensionId == 7) { - value = true; - } - } - - if (this instanceof GT_Worldgen_GT_Ore_Layer ore) { - if (ore.twilightForest && aWorld.provider.dimensionId == 7) { - value = true; - } - } - - mDimensionMap.put(aDimName, value); - return value; - } - return tAllowed; - } -} -- cgit