aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/galacticgreg/api
diff options
context:
space:
mode:
authorNotAPenguin <michiel.vandeginste@gmail.com>2024-09-02 23:17:17 +0200
committerGitHub <noreply@github.com>2024-09-02 23:17:17 +0200
commit1b820de08a05070909a267e17f033fcf58ac8710 (patch)
tree02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/galacticgreg/api
parentafd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff)
downloadGT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip
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
Diffstat (limited to 'src/main/java/galacticgreg/api')
-rw-r--r--src/main/java/galacticgreg/api/AsteroidBlockComb.java77
-rw-r--r--src/main/java/galacticgreg/api/BlockMetaComb.java50
-rw-r--r--src/main/java/galacticgreg/api/Enums.java51
-rw-r--r--src/main/java/galacticgreg/api/GTOreTypes.java66
-rw-r--r--src/main/java/galacticgreg/api/ISpaceObjectGenerator.java58
-rw-r--r--src/main/java/galacticgreg/api/ModContainer.java85
-rw-r--r--src/main/java/galacticgreg/api/ModDBMDef.java159
-rw-r--r--src/main/java/galacticgreg/api/ModDimensionDef.java461
-rw-r--r--src/main/java/galacticgreg/api/SpecialBlockComb.java69
-rw-r--r--src/main/java/galacticgreg/api/StructureInformation.java59
-rw-r--r--src/main/java/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java57
-rw-r--r--src/main/java/galacticgreg/api/enums/DimensionDef.java228
-rw-r--r--src/main/java/galacticgreg/api/enums/ModContainers.java19
-rw-r--r--src/main/java/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java105
-rw-r--r--src/main/java/galacticgreg/api/enums/properties/Asteroids.java78
15 files changed, 1622 insertions, 0 deletions
diff --git a/src/main/java/galacticgreg/api/AsteroidBlockComb.java b/src/main/java/galacticgreg/api/AsteroidBlockComb.java
new file mode 100644
index 0000000000..208d8faed3
--- /dev/null
+++ b/src/main/java/galacticgreg/api/AsteroidBlockComb.java
@@ -0,0 +1,77 @@
+package galacticgreg.api;
+
+import net.minecraft.block.Block;
+
+/**
+ * Class for a bit more advanced combinations for Asteroids, which supports Custom Blocks as base material and Values
+ * required to generate Gregtech ores
+ */
+public class AsteroidBlockComb extends BlockMetaComb {
+
+ private final GTOreTypes _mGTOreMaterial;
+
+ /**
+ * Create an advanced definition which uses the GregTech-OreType values for ores, and your own definition of Block
+ * for the asteroid material
+ *
+ * @param pOreType The GregTech oreType
+ * @param pBlock Your block
+ */
+ public AsteroidBlockComb(GTOreTypes pOreType, Block pBlock) {
+ super(pBlock, 0);
+ _mGTOreMaterial = pOreType;
+ }
+
+ /**
+ * Create an advanced definition which uses the GregTech-OreType values for ores, and your own definition of Block
+ * for the asteroid material
+ *
+ * @param pOreType The GregTech oreType
+ * @param pBlock Your block
+ * @param pMeta The metavalue for your block (If required)
+ */
+ public AsteroidBlockComb(GTOreTypes pOreType, Block pBlock, int pMeta) {
+ super(pBlock, pMeta);
+ _mGTOreMaterial = pOreType;
+ }
+
+ /**
+ * Create a simple definition which uses the GregTech-OreType values for both asteroidStone and ores
+ *
+ * @param pOreType The GregTech oreType
+ */
+ public AsteroidBlockComb(GTOreTypes pOreType) {
+ super(pOreType.getBlock(), pOreType.getMeta());
+ _mGTOreMaterial = pOreType;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The GT Material for the oregen
+ */
+ public GTOreTypes getOreMaterial() {
+ return _mGTOreMaterial;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null) return false;
+ if (other == this) return true;
+ if (!(other instanceof AsteroidBlockComb)) return false;
+ AsteroidBlockComb otherObj = (AsteroidBlockComb) other;
+
+ boolean tFlag = true;
+ String otherName = Block.blockRegistry.getNameForObject(otherObj.getBlock());
+ String thisName = Block.blockRegistry.getNameForObject(this.getBlock());
+ if (otherName != null && thisName != null) {
+ if (!otherName.equals(thisName)) tFlag = false;
+
+ if (!(otherObj.getMeta() == this.getMeta())) tFlag = false;
+
+ if (!(otherObj.getOreMaterial() == this.getOreMaterial())) tFlag = false;
+ } else tFlag = false;
+
+ return tFlag;
+ }
+}
diff --git a/src/main/java/galacticgreg/api/BlockMetaComb.java b/src/main/java/galacticgreg/api/BlockMetaComb.java
new file mode 100644
index 0000000000..f4dc416c6b
--- /dev/null
+++ b/src/main/java/galacticgreg/api/BlockMetaComb.java
@@ -0,0 +1,50 @@
+package galacticgreg.api;
+
+import net.minecraft.block.Block;
+
+/**
+ * Class used for Simple Block - Meta constructs
+ */
+public class BlockMetaComb {
+
+ private int mMeta;
+ private Block mBlock;
+
+ /**
+ * Creates a simple instance for a block that has no meta value
+ *
+ * @param pBlock The Block in question. 0 is used as meta
+ */
+ public BlockMetaComb(Block pBlock) {
+ this(pBlock, 0);
+ }
+
+ /**
+ * Creates a simple instance for a block with a meta value
+ *
+ * @param pBlock The Block in question
+ * @param pMeta The MetaValue in question ([block]:[meta])
+ */
+ public BlockMetaComb(Block pBlock, int pMeta) {
+ mMeta = pMeta;
+ mBlock = pBlock;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The metadata for this block
+ */
+ public int getMeta() {
+ return mMeta;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The block
+ */
+ public Block getBlock() {
+ return mBlock;
+ }
+}
diff --git a/src/main/java/galacticgreg/api/Enums.java b/src/main/java/galacticgreg/api/Enums.java
new file mode 100644
index 0000000000..f60c5602dd
--- /dev/null
+++ b/src/main/java/galacticgreg/api/Enums.java
@@ -0,0 +1,51 @@
+package galacticgreg.api;
+
+public class Enums {
+
+ public enum SpaceObjectType {
+ OreAsteroid,
+ NonOreSchematic
+ }
+
+ public enum TargetBlockPosition {
+ Invalid,
+ AsteroidInnerCore,
+ AsteroidCore,
+ AsteroidShell,
+ StructureBlock
+ }
+
+ public enum AllowedBlockPosition {
+ AsteroidInnerCore,
+ AsteroidCore,
+ AsteroidShell,
+ AsteroidCoreAndShell
+ }
+
+ public enum AirReplaceRule {
+ NeverReplaceAir,
+ AllowReplaceAir,
+ OnlyReplaceAir
+ }
+
+ public enum ReplaceState {
+ Unknown,
+ Airblock,
+ CanReplace,
+ CannotReplace
+ }
+
+ public enum DimensionType {
+ /**
+ * The Dimension is a void dimension and asteroids shall be generated. They will randomly spawn bewteen 0 and
+ * 250 Additional config values will be generated in worldconfig
+ */
+ Asteroid,
+
+ /**
+ * The Dimension is a planet, and only ores shall be generated in the ground
+ */
+ Planet,
+ }
+
+}
diff --git a/src/main/java/galacticgreg/api/GTOreTypes.java b/src/main/java/galacticgreg/api/GTOreTypes.java
new file mode 100644
index 0000000000..fdc4ea61ff
--- /dev/null
+++ b/src/main/java/galacticgreg/api/GTOreTypes.java
@@ -0,0 +1,66 @@
+package galacticgreg.api;
+
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+
+import gregtech.api.GregTechAPI;
+
+/**
+ * Representation of the various GregTech ores, with their counterpart in VanillaBlocks, and the OreOffset that is
+ * required to generate the proper ores
+ */
+public enum GTOreTypes {
+
+ /**
+ * The Definition for Gregtech's RedGranite
+ **/
+ RedGranite(4000, GregTechAPI.sBlockGranites, 8, 3),
+ /**
+ * The Definition for Gregtech's BlackGranite
+ */
+ BlackGranite(3000, GregTechAPI.sBlockGranites, 0, 3),
+ /**
+ * The Definition for EndStone
+ */
+ EndStone(2000, Blocks.end_stone, 0, 0),
+ /**
+ * The Definition for Netherrack
+ */
+ Netherrack(1000, Blocks.netherrack, 0, 0), // Unsure about blockupdate value!
+ /**
+ * The Definition for SmallOres (And BlockType Stone)
+ */
+ SmallOres(16000, Blocks.stone, 0, 0), // Unsure about blockupdate value!
+ /**
+ * The Definition for Ores (And BlockType Stone)
+ */
+ NormalOres(0, Blocks.stone, 0, 0); // Unsure about blockupdate value!
+
+ private int _mOffset;
+ private Block _mStoneBlock;
+ private int _mBlockMeta;
+ private int _mUpdateMode;
+
+ GTOreTypes(int pOffset, Block pBlock, int pMeta, int pUpdateMode) {
+ _mOffset = pOffset;
+ _mStoneBlock = pBlock;
+ _mBlockMeta = pMeta;
+ _mUpdateMode = pUpdateMode;
+ }
+
+ public Block getBlock() {
+ return _mStoneBlock;
+ }
+
+ public int getMeta() {
+ return _mBlockMeta;
+ }
+
+ public int getOffset() {
+ return _mOffset;
+ }
+
+ public int getUpdateMode() {
+ return _mUpdateMode;
+ }
+}
diff --git a/src/main/java/galacticgreg/api/ISpaceObjectGenerator.java b/src/main/java/galacticgreg/api/ISpaceObjectGenerator.java
new file mode 100644
index 0000000000..3cf16c8791
--- /dev/null
+++ b/src/main/java/galacticgreg/api/ISpaceObjectGenerator.java
@@ -0,0 +1,58 @@
+package galacticgreg.api;
+
+import java.util.List;
+
+import net.minecraft.util.Vec3;
+
+import galacticgreg.api.Enums.SpaceObjectType;
+
+public interface ISpaceObjectGenerator {
+
+ Vec3 getCenterPoint();
+
+ /**
+ * Set the center-point of the object to generate, by providing X, Y and Z directly
+ *
+ * @param pX
+ * @param pY
+ * @param pZ
+ */
+ void setCenterPoint(int pX, int pY, int pZ);
+
+ /**
+ * Set the center-point of the object to generate, by providing a Vec3 instance
+ *
+ * @param pCenter
+ */
+ void setCenterPoint(Vec3 pCenter);
+
+ List<StructureInformation> getStructure();
+
+ /**
+ * Calculate the structure Called after randomize()
+ */
+ void calculate();
+
+ /**
+ * Randomize the structure. Called before calculate()
+ *
+ * @param pSizeMin The minimum size for the structure. It is up to you how you handle this value. it's what the user
+ * sets in his config file
+ * @param pSizeMax The maximum size for the structure. It is up to you how you handle this value. it's what the user
+ * sets in his config file
+ */
+ void randomize(int pSizeMin, int pSizeMax);
+
+ /**
+ * Define the type of the generator. OreAsteroid will be used to spawn ores at given coordinates, where
+ * NonOreSchematic will use the Blocks provided in the structural information to generate your structure
+ *
+ * @return
+ */
+ SpaceObjectType getType();
+
+ /**
+ * This function is called every time the generator shall be reset in order to generate a blank, new structure
+ */
+ void reset();
+}
diff --git a/src/main/java/galacticgreg/api/ModContainer.java b/src/main/java/galacticgreg/api/ModContainer.java
new file mode 100644
index 0000000000..37721cd38c
--- /dev/null
+++ b/src/main/java/galacticgreg/api/ModContainer.java
@@ -0,0 +1,85 @@
+package galacticgreg.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Defines a Mod where this Generator shall be active. Note: This will only work (obviously) for Dimensions where
+ * either: - Gregtech has a hook in the OreGen or - For mods which are addons to GalactiCraft
+ *
+ */
+public class ModContainer {
+
+ private String _mModName;
+ private List<ModDimensionDef> _mDimensionLookup;
+ private boolean _mEnabled = false;
+
+ /**
+ * Internal function
+ *
+ * @return The state if the Registry could find the mod or not
+ */
+ public boolean getEnabled() {
+ return _mEnabled;
+ }
+
+ /**
+ * Internal function
+ *
+ * Never set this to true. This is an internal marker which is set by the registry if the mod could be found or not
+ *
+ * @param pEnabled
+ */
+ public void setEnabled(boolean pEnabled) {
+ _mEnabled = pEnabled;
+ }
+
+ /**
+ * Define a new Mod where GT OreGen shall be enabled
+ *
+ * @param pModName The modID. Make sure to use the proper mod-id, or it won't load correctly
+ */
+ public ModContainer(String pModName) {
+ _mModName = pModName;
+ _mDimensionLookup = new ArrayList<>();
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The mods name
+ */
+ public String getModName() {
+ return _mModName;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The list of attached dimensions for this mod
+ */
+ public List<ModDimensionDef> getDimensionList() {
+ return _mDimensionLookup;
+ }
+
+ /**
+ * Adds a new dimension to this modcontainer. Make sure you've added all blocks there first
+ *
+ * @param pDimDef The dimension definition to be added
+ * @return true if it could be added, false if not
+ */
+ public boolean addDimensionDef(ModDimensionDef pDimDef) {
+ for (ModDimensionDef mdd : _mDimensionLookup) {
+ if (mdd.getChunkProviderName()
+ .equals(pDimDef.getChunkProviderName())) {
+ // Cannot add DimensionDefinition; The Given chunk-provider name is already taken!
+ return false;
+ }
+ }
+
+ // Set the parent modName of this dimension. This will finalize it
+ pDimDef.setParentModName(_mModName);
+ _mDimensionLookup.add(pDimDef);
+ return true;
+ }
+}
diff --git a/src/main/java/galacticgreg/api/ModDBMDef.java b/src/main/java/galacticgreg/api/ModDBMDef.java
new file mode 100644
index 0000000000..11d6bc630e
--- /dev/null
+++ b/src/main/java/galacticgreg/api/ModDBMDef.java
@@ -0,0 +1,159 @@
+package galacticgreg.api;
+
+import net.minecraft.block.Block;
+
+/**
+ * Mod "Dimension Block Meta Definition" Defines the Block-Meta combination for Blocks that can be replaced by the
+ * oregen.
+ *
+ */
+public class ModDBMDef {
+
+ private String _targetBlockName;
+ private int _targetMeta;
+ private boolean _canAlwaysReplace;
+
+ public String getBlockName() {
+ return _targetBlockName;
+ }
+
+ public int getMeta() {
+ return _targetMeta;
+ }
+
+ public boolean getCanAlwaysReplace() {
+ return _canAlwaysReplace;
+ }
+
+ /**
+ * Internal function
+ *
+ * Check if the given Block is equal to the block in this instance
+ *
+ * @param pBlock the Block in question
+ * @return
+ */
+ public Enums.ReplaceState blockEquals(Block pBlock) {
+ if (pBlock == null) return Enums.ReplaceState.Unknown;
+
+ if (Block.blockRegistry.getNameForObject(pBlock)
+ .equals(_targetBlockName)) return Enums.ReplaceState.CanReplace;
+ else return Enums.ReplaceState.CannotReplace;
+ }
+
+ /**
+ * Internal function
+ *
+ * Check if the given Block is equal to the block in this instance and matches the metadata
+ *
+ * @param pBlock the block in question
+ * @param pMeta the metadata in question
+ * @return
+ */
+ public Enums.ReplaceState blockEquals(Block pBlock, int pMeta) {
+ Enums.ReplaceState tFlag = Enums.ReplaceState.Unknown;
+ if (blockEquals(pBlock) == Enums.ReplaceState.CanReplace) {
+ if (pMeta == _targetMeta || _canAlwaysReplace) tFlag = Enums.ReplaceState.CanReplace;
+ else tFlag = Enums.ReplaceState.CannotReplace;
+ }
+
+ return tFlag;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null) return false;
+ if (other == this) return true;
+ if (!(other instanceof ModDBMDef)) return false;
+ ModDBMDef otherModDBMDef = (ModDBMDef) other;
+ return (otherModDBMDef._targetBlockName.equals(_targetBlockName) && otherModDBMDef._targetMeta == _targetMeta);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition. Meta defaults to 0 here
+ *
+ * @param pTargetBlockName The unlocalizedName of the block
+ */
+ public ModDBMDef(String pTargetBlockName) {
+ this(pTargetBlockName, 0, false);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition
+ *
+ * @param pTargetBlockName The unlocalizedName of the block
+ * @param pMetaData The blocks metadata
+ */
+ public ModDBMDef(String pTargetBlockName, int pMetaData) {
+ this(pTargetBlockName, pMetaData, false);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition
+ *
+ * @param pTargetBlock The instance of the block that can be replaced
+ * @param pMetaData The blocks metadata
+ */
+ public ModDBMDef(Block pTargetBlock, int pMetaData) {
+ this(Block.blockRegistry.getNameForObject(pTargetBlock), pMetaData, false);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition. Meta defaults to 0 here
+ *
+ * @param pTargetBlock The instance of the block that can be replaced
+ */
+ public ModDBMDef(Block pTargetBlock) {
+ this(Block.blockRegistry.getNameForObject(pTargetBlock), 0, false);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition
+ *
+ * @param pTargetBlock
+ * @param pCanAlwaysReplace set to true if this block can always be replaced, regardless of it's metavalue. Like:
+ * [block]:*
+ */
+ public ModDBMDef(Block pTargetBlock, boolean pCanAlwaysReplace) {
+ this(Block.blockRegistry.getNameForObject(pTargetBlock), -1, pCanAlwaysReplace);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition
+ *
+ * @param pTargetBlockName The unlocalizedName of the block
+ * @param pCanAlwaysReplace set to true if this block can always be replaced, regardless of it's metavalue. Like:
+ * [block]:*
+ */
+ public ModDBMDef(String pTargetBlockName, boolean pCanAlwaysReplace) {
+ this(pTargetBlockName, -1, false);
+ }
+
+ /**
+ * Create a new "Block that can be replaced by ores" definition
+ *
+ * @param pTargetBlockName The unlocalizedName of the block
+ * @param pMetaData The blocks metadata
+ * @param pCanAlwaysReplace set to true if this block can always be replaced, regardless of it's metavalue. Like:
+ * [block]:*
+ */
+ public ModDBMDef(String pTargetBlockName, int pMetaData, boolean pCanAlwaysReplace) {
+ _targetBlockName = pTargetBlockName;
+ _targetMeta = pMetaData;
+ _canAlwaysReplace = pCanAlwaysReplace;
+ }
+
+ /**
+ * Internal function Never run this function. It is used to update the blocks name when GalacticGreg is initializing
+ * its internal structures
+ *
+ * @param pParentModName The modname to be attached to the block-name
+ */
+ public void updateBlockName(String pParentModName) {
+ // Do we already have a FQBN? then do nothing
+ if (_targetBlockName.contains(":")) {
+ return;
+ }
+ _targetBlockName = String.format("%s:%s", pParentModName, _targetBlockName);
+ }
+}
diff --git a/src/main/java/galacticgreg/api/ModDimensionDef.java b/src/main/java/galacticgreg/api/ModDimensionDef.java
new file mode 100644
index 0000000000..b456aa031e
--- /dev/null
+++ b/src/main/java/galacticgreg/api/ModDimensionDef.java
@@ -0,0 +1,461 @@
+package galacticgreg.api;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.world.chunk.IChunkProvider;
+
+// import galacticgreg.GalacticGreg;
+
+/**
+ * Class to define a Dimension. Supposed to be added to a ModContainer
+ */
+public class ModDimensionDef {
+
+ private static final String STR_NOTDEFINED = "iiznotdefined";
+ private String _mDimensionName;
+ private String _mInternalDimIdentifier;
+ private String _mChunkProvider;
+ private Enums.AirReplaceRule _mDimAirSetting;
+ private ArrayList<ModDBMDef> _mReplaceableBlocks;
+ private Enums.DimensionType _mDimensionType;
+
+ private List<ISpaceObjectGenerator> _mSpaceObjectsGenerators;
+ private List<ISpaceObjectGenerator> _mSpaceStructureGenerators;
+
+ // Special Planets config settings
+ private int _mGroundOreMaxY = 64;
+ private int _mFloatingAsteroidsMinY = 128;
+ // ------
+
+ // Override for stonetype
+ private GTOreTypes _mStoneType;
+
+ // Asteroid stuff
+ private List<AsteroidBlockComb> _mValidAsteroidMaterials;
+ private List<SpecialBlockComb> _mSpecialBlocksForAsteroids;
+
+ private Random _mRandom = new Random(System.currentTimeMillis());
+
+ /**
+ * Internal function
+ *
+ * @return A list of possible asteroid-mixes that shall be generated
+ */
+ public List<AsteroidBlockComb> getValidAsteroidMaterials() {
+ return _mValidAsteroidMaterials;
+ }
+
+ // =================================================
+ /**
+ * Internal function The only purpose of this functions is to get a default config value for this dim, that can be
+ * altered by the mod author which adds the dimension definition to his mod, but also provide the
+ * modpack-author/serveradmin to change these values aswell
+ */
+ public int getPreConfiguratedGroundOreMaxY() {
+ return _mGroundOreMaxY;
+ }
+
+ /**
+ * Internal function The only purpose of this functions is to get a default config value for this dim, that can be
+ * altered by the mod author which adds the dimension definition to his mod, but also provide the
+ * modpack-author/serveradmin to change these values aswell
+ */
+ public int getPreConfiguratedFloatingAsteroidMinY() {
+ return _mFloatingAsteroidsMinY;
+ }
+
+ /**
+ * Register new generator for objects in space. You can register as many as you want. If you don't register
+ * anything, no structures will generate and the default Asteroid-Generator will be used
+ *
+ * @param pSpaceObjectGenerator An instance of your own object generator
+ */
+ public void registerSpaceObjectGenerator(ISpaceObjectGenerator pSpaceObjectGenerator) {
+ Enums.SpaceObjectType tType = pSpaceObjectGenerator.getType();
+ switch (tType) {
+ case NonOreSchematic:
+ _mSpaceStructureGenerators.add(pSpaceObjectGenerator);
+ break;
+ case OreAsteroid:
+ _mSpaceObjectsGenerators.add(pSpaceObjectGenerator);
+ break;
+ default:
+ // GalacticGreg.Logger.error("registerSpaceObjectGenerator() found unhandled generator type %s. Please
+ // report asap, the author was lazy!", tType.toString());
+ break;
+
+ }
+ }
+
+ /**
+ * Internal function Return a random generator for space objects
+ */
+ public ISpaceObjectGenerator getRandomSOGenerator(Enums.SpaceObjectType pTargetType) {
+ ISpaceObjectGenerator tGen = null;
+ List<ISpaceObjectGenerator> tLst = null;
+ try {
+ switch (pTargetType) {
+ case NonOreSchematic:
+ tLst = _mSpaceStructureGenerators;
+ break;
+ case OreAsteroid:
+ tLst = _mSpaceObjectsGenerators;
+ break;
+ default:
+ break;
+ }
+
+ if (tLst != null) {
+ if (tLst.size() == 1) tGen = tLst.get(0);
+ else if (tLst.size() > 1) tGen = tLst.get(_mRandom.nextInt(tLst.size()));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return tGen;
+ }
+
+ /**
+ * Define the default values for the floating asteroids and the oregen here. As both generators run in the same
+ * dimension, and you probably don't want to have asteroids stuck in the ground, both generators are separated from
+ * each other. Basically, you can go with the default values. If you want to change them, make sure that pOregenMaxY
+ * is lower than pAsteroidMinY
+ *
+ * @param pOregenMaxY The maximum Y-height where ores will be allowed to spawn. Default: 64
+ * @param pAsteroidMinY The minimum Y-height that has to be reached before asteroids will spawn. Default: 128
+ * @throws IllegalArgumentException if the limits are invalid
+ *
+ */
+ public void setAsteroidAndPlanetLimits(int pOregenMaxY, int pAsteroidMinY) {
+ if (pOregenMaxY >= pAsteroidMinY)
+ throw new IllegalArgumentException("pOregenMaxY must be LOWER than pAsteroidMinY!");
+
+ _mFloatingAsteroidsMinY = pAsteroidMinY;
+ _mGroundOreMaxY = pOregenMaxY;
+ }
+ // =================================================
+
+ /**
+ * Internal function
+ *
+ * @return A list of all special blocks that shall be used to generate the asteroids.
+ */
+ public List<SpecialBlockComb> getSpecialBlocksForAsteroids() {
+ return _mSpecialBlocksForAsteroids;
+ }
+
+ public List<ISpaceObjectGenerator> getSpaceObjectGenerators() {
+ return _mSpaceObjectsGenerators;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The type for this dimension
+ */
+ public Enums.DimensionType getDimensionType() {
+ return _mDimensionType;
+ }
+
+ /**
+ * Set whether this DimensionDefinition defines an void-dimension that shall spawn asteroids instead of ores in
+ * stone
+ *
+ * @param pType The dimensiontype to be used
+ */
+ public void setDimensionType(Enums.DimensionType pType) {
+ _mDimensionType = pType;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The configuration for AirBlocks
+ */
+ public Enums.AirReplaceRule getAirSetting() {
+ return _mDimAirSetting;
+ }
+
+ /**
+ * Define how the oregen shall handle air-blocks. These settings should be pretty self-explandatory, but anyways:
+ * NeverReplaceAir: No matter what, if there is an Air-Block found, it will not replace it. AllowReplaceAir: This
+ * will generate Ores in Stones (defined by addBlockDefinition()) and air if found OnlyReplaceAir : This will not
+ * generate Ores in solid blocks, but only in air
+ *
+ * Note that "OnlyReplaceAir" is a special setting if you have a dimension that is not defined as "Asteroids" but
+ * you still need/want to generate ores in midair.
+ *
+ * @param pSetting
+ */
+ public void setAirSetting(Enums.AirReplaceRule pSetting) {
+ _mDimAirSetting = pSetting;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The dimension identifier that is used internally to identify the dimension
+ */
+ public String getDimIdentifier() {
+ return _mInternalDimIdentifier;
+ }
+
+ /**
+ * Set a manual override for ores that shall be generated. This setting is ignored if getIsAsteroidDimension()
+ * returns true
+ *
+ * For example, on GalactiCraft Mars, this value is set to GTOreTypes.RedGranite, because it matches the color
+ * better. If you don't set anything here, it will generate regular stone-ores.
+ *
+ * @param pStoneType
+ */
+ public void setStoneType(GTOreTypes pStoneType) {
+ _mStoneType = pStoneType;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The stone override for gregtech ores
+ */
+ public GTOreTypes getStoneType() {
+ return _mStoneType;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The attached chunk-provider for this dimension
+ */
+ public String getChunkProviderName() {
+ return _mChunkProvider;
+ }
+
+ /**
+ * Adds a new blockdefinition to this dimension. This block will then later be replaced by ores. You can add as many
+ * blocks as you want. Just don't add Blocks.Air, as there is another setting for allowing Air-Replacement
+ *
+ * @param pBlockDef
+ * @return
+ */
+ public boolean addBlockDefinition(ModDBMDef pBlockDef) {
+ if (_mReplaceableBlocks.contains(pBlockDef)) {
+ return false;
+ } else {
+ _mReplaceableBlocks.add(pBlockDef);
+ return true;
+ }
+ }
+
+ /**
+ * Internal function
+ *
+ * @return The DimensionName in a Human-readable format
+ */
+ public String getDimensionName() {
+ return _mDimensionName;
+ }
+
+ /**
+ * Internal function
+ *
+ * @return A list of all defined Blocks that can be replaced while generating ores
+ */
+ public ArrayList<ModDBMDef> getReplaceableBlocks() {
+ return _mReplaceableBlocks;
+ }
+
+ /**
+ * Define a new dimension
+ *
+ * @param pDimensionName The human-readable. Spaces will be removed
+ * @param pChunkProvider The chunkprovider class that shall be observed for the oregen
+ */
+ public ModDimensionDef(String pDimensionName, Class<? extends IChunkProvider> pChunkProvider,
+ Enums.DimensionType pDimType) {
+ this(
+ pDimensionName,
+ pChunkProvider.toString()
+ .substring(6),
+ pDimType,
+ null);
+ }
+
+ /**
+ * Define a new dimension
+ *
+ * @param pDimensionName The human-readable. Spaces will be removed
+ * @param pChunkProvider The chunkprovider class that shall be observed for the oregen
+ * @param pBlockDefinitions The list of predefined blocks to be replaced by ores
+ */
+ public ModDimensionDef(String pDimensionName, Class<? extends IChunkProvider> pChunkProvider,
+ Enums.DimensionType pDimType, List<ModDBMDef> pBlockDefinitions) {
+ this(
+ pDimensionName,
+ pChunkProvider.toString()
+ .substring(6),
+ pDimType,
+ pBlockDefinitions);
+ }
+
+ /**
+ * Define a new dimension
+ *
+ * @param pDimensionName The human-readable DimensionName. Spaces will be removed
+ * @param pChunkProviderName The human-readable, full-qualified classname for the chunkprovider
+ */
+ public ModDimensionDef(String pDimensionName, String pChunkProviderName, Enums.DimensionType pDimType) {
+ this(pDimensionName, pChunkProviderName, pDimType, null);