diff options
author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-09-02 23:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 23:17:17 +0200 |
commit | 1b820de08a05070909a267e17f033fcf58ac8710 (patch) | |
tree | 02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/galacticgreg/api | |
parent | afd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff) | |
download | GT5-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')
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); + } + + /** + * 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 + * @param pBlockDefinitions The list of predefined blocks to be replaced by ores + */ + public ModDimensionDef(String pDimensionName, String pChunkProviderName, Enums.DimensionType pDimType, + List<ModDBMDef> pBlockDefinitions) { + _mInternalDimIdentifier = STR_NOTDEFINED; + _mDimensionName = pDimensionName; + _mChunkProvider = pChunkProviderName; + _mDimensionType = pDimType; + + _mReplaceableBlocks = new ArrayList<>(); + if (pBlockDefinitions != null) _mReplaceableBlocks.addAll(pBlockDefinitions); + + _mValidAsteroidMaterials = new ArrayList<>(); + _mSpecialBlocksForAsteroids = new ArrayList<>(); + _mSpaceObjectsGenerators = new ArrayList<>(); + _mSpaceStructureGenerators = new ArrayList<>(); + } + + /** + * Internal function + * + * Do not call this function by yourself. Ever. It will cause explosions, water to blood, death of firstborn,... + * Seriously, don't do it. + */ + protected void setParentModName(String pModName) { + if (_mInternalDimIdentifier.equals(STR_NOTDEFINED)) { + _mInternalDimIdentifier = String.format("%s_%s", pModName, _mDimensionName); + } + + // Else Don't update, we're already set + + } + + /** + * Internal function + * + * Check if pBlock can be replaced by an ore + * + * @param pBlock + * @param pMeta + * @return + */ + public Enums.ReplaceState getReplaceStateForBlock(Block pBlock, int pMeta) { + Enums.ReplaceState tFlag = Enums.ReplaceState.Unknown; + + for (ModDBMDef pDef : _mReplaceableBlocks) { + Enums.ReplaceState tResult = pDef.blockEquals(pBlock, pMeta); + if (tResult == Enums.ReplaceState.Unknown) continue; + + if (tResult == Enums.ReplaceState.CanReplace) { + // GalacticGreg.Logger.trace("Targetblock found and metadata match. Replacement allowed"); + tFlag = Enums.ReplaceState.CanReplace; + } else if (tResult == Enums.ReplaceState.CannotReplace) { + // GalacticGreg.Logger.trace("Targetblock found but metadata mismatch. Replacement denied"); + tFlag = Enums.ReplaceState.CannotReplace; + } + break; + } + + return tFlag; + } + + /** + * Internal function + * + * Randomly select one material out of all defined materials + * + * @return + */ + public AsteroidBlockComb getRandomAsteroidMaterial() { + if (_mValidAsteroidMaterials.size() == 0) return null; + + if (_mValidAsteroidMaterials.size() == 1) return _mValidAsteroidMaterials.get(0); + else { + return _mValidAsteroidMaterials.get(_mRandom.nextInt(_mValidAsteroidMaterials.size())); + } + } + + /** + * Internal function + * + * Randomly select one special block to be placed in the asteroids + * + * @return + */ + public SpecialBlockComb getRandomSpecialAsteroidBlock() { + if (_mSpecialBlocksForAsteroids.size() == 0) return null; + + if (_mSpecialBlocksForAsteroids.size() == 1) return _mSpecialBlocksForAsteroids.get(0); + else { + return _mSpecialBlocksForAsteroids.get(_mRandom.nextInt(_mSpecialBlocksForAsteroids.size())); + } + } + + /** + * Define the material the asteroid shall be made of. Limited to GT-Based Ores and their stones + * + * @param pMaterial + */ + public void addAsteroidMaterial(GTOreTypes pMaterial) { + addAsteroidMaterial(new AsteroidBlockComb(pMaterial)); + } + + /** + * Define the material the asteroid shall be made of, more advanced option to specify your own blocks + * + * @param pBlockComb + */ + public void addAsteroidMaterial(AsteroidBlockComb pBlockComb) { + if (!_mValidAsteroidMaterials.contains(pBlockComb)) { + _mValidAsteroidMaterials.add(pBlockComb); + } + } + + /** + * Adds a new material for asteroid generation. These will spawn randomly in asteroids if enabled. You can basically + * add every block you can imagine. Be warned though, if you use Liquids (Water / Lava / ..), it can affect + * performance if the liquid is flowing down to the void. So make sure you define "AsteroidCore" as position + * + * @param pBlock Block-Meta Combination that shall be used + */ + public void addSpecialAsteroidBlock(SpecialBlockComb pBlock) { + if (!_mSpecialBlocksForAsteroids.contains(pBlock)) { + _mSpecialBlocksForAsteroids.add(pBlock); + } + } + + /** + * Internal function Called when GalacticGreg will finalize all its internal structures. You should never call this + * yourself + */ + public void finalizeReplaceableBlocks(String pParentModName) { + for (ModDBMDef rpb : _mReplaceableBlocks) { + try { + rpb.updateBlockName(pParentModName); + if (_mStoneType == null) _mStoneType = GTOreTypes.NormalOres; + } catch (Exception e) { + // GalacticGreg.Logger.error("Unable to finalize replaceable block with modname for block %s. Dimension + // %s will probably have problems generating ores", rpb.getBlockName(), _mDimensionName); + } + } + } +} diff --git a/src/main/java/galacticgreg/api/SpecialBlockComb.java b/src/main/java/galacticgreg/api/SpecialBlockComb.java new file mode 100644 index 0000000000..2cf812169a --- /dev/null +++ b/src/main/java/galacticgreg/api/SpecialBlockComb.java @@ -0,0 +1,69 @@ +package galacticgreg.api; + +import net.minecraft.block.Block; + +public class SpecialBlockComb extends BlockMetaComb { + + private Enums.AllowedBlockPosition _mBlockPosition; + + /** + * Creates a simple instance for a block that has a meta value and a block position it is allowed to spawn + * + * @param pBlock The Block in question + * @param pMeta The meta value of the block + * @param pBlockPosition The position this block is allowed to generate + */ + public SpecialBlockComb(Block pBlock, int pMeta, Enums.AllowedBlockPosition pBlockPosition) { + super(pBlock, pMeta); + _mBlockPosition = pBlockPosition; + } + + /** + * Creates a simple instance for a block that has no meta value but a position it is allowed to spawn + * + * @param pBlock The Block in question. 0 is used as meta + * @param pBlockPosition The position this block is allowed to generate + */ + public SpecialBlockComb(Block pBlock, Enums.AllowedBlockPosition pBlockPosition) { + super(pBlock, 0); + _mBlockPosition = pBlockPosition; + } + + /** + * Creates a simple instance for a block that has no meta value and is allowed to spawn everywhere + * + * @param pBlock The Block in question. 0 is used as meta, and "CoreAndShell" is used as position + */ + public SpecialBlockComb(Block pBlock) { + super(pBlock, 0); + _mBlockPosition = Enums.AllowedBlockPosition.AsteroidCoreAndShell; + } + + /** + * Internal function + * + * @return The position the block is supposed to spawn at + */ + public Enums.AllowedBlockPosition getBlockPosition() { + return _mBlockPosition; + } + + @Override + public boolean equals(Object other) { + if (other == null) return false; + if (other == this) return true; + if (!(other instanceof SpecialBlockComb)) return false; + SpecialBlockComb otherObj = (SpecialBlockComb) other; + + boolean tFlag = true; + String otherName = Block.blockRegistry.getNameForObject(otherObj.getBlock()); + String thisName = Block.blockRegistry.getNameForObject(this.getBlock()); + if (!otherName.equals(thisName)) tFlag = false; + + if (!(otherObj.getMeta() == this.getMeta())) tFlag = false; + + if (!(otherObj.getBlockPosition() == this.getBlockPosition())) tFlag = false; + + return tFlag; + } +} diff --git a/src/main/java/galacticgreg/api/StructureInformation.java b/src/main/java/galacticgreg/api/StructureInformation.java new file mode 100644 index 0000000000..4c33f88c20 --- /dev/null +++ b/src/main/java/galacticgreg/api/StructureInformation.java @@ -0,0 +1,59 @@ +package galacticgreg.api; + +import net.minecraft.util.Vec3; + +import galacticgreg.api.Enums.TargetBlockPosition; + +/** + * Structural information container. Holds X/Y/Z and block/meta information + */ +public class StructureInformation { + + private Vec3 _mCoordinates; + private TargetBlockPosition _mBlockPosition; + private BlockMetaComb _mBlockMetaComb; + + public TargetBlockPosition getBlockPosition() { + return _mBlockPosition; + } + + public int getX() { + return (int) Math.round(_mCoordinates.xCoord); + } + + public int getY() { + return (int) Math.round(_mCoordinates.yCoord); + } + + public int getZ() { + return (int) Math.round(_mCoordinates.zCoord); + } + + public BlockMetaComb getBlock() { + return _mBlockMetaComb; + } + + /** + * Init StructureInfo only with Coords and block position + * + * @param pCoordinates The coords in question + * @param pPosition The position-enum value + */ + public StructureInformation(Vec3 pCoordinates, TargetBlockPosition pPosition) { + this(pCoordinates, pPosition, null); + } + + /** + * Init StructureInfo with Coords, block position and a populated block/meta info + * + * @param pCoordinates The coords in question + * @param pPosition The position-enum value + * @param pTargetBlock The target block in question + */ + public StructureInformation(Vec3 pCoordinates, TargetBlockPosition pPosition, BlockMetaComb pTargetBlock) { + _mCoordinates = pCoordinates; + _mBlockPosition = pPosition; + _mBlockMetaComb = pTargetBlock; + } + +} diff --git a/src/main/java/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java b/src/main/java/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java new file mode 100644 index 0000000000..a9cf4a4e79 --- /dev/null +++ b/src/main/java/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java @@ -0,0 +1,57 @@ +package galacticgreg.api.enums; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.init.Blocks; + +import galacticgreg.api.ModDBMDef; + +public enum DimensionBlockMetaDefinitionList { + + Moon(new ModDBMDef("tile.moonBlock", 4)), + Mars(new ModDBMDef("tile.mars", 9)), + Phobos(new ModDBMDef("phobosblocks", 2)), + Deimos(new ModDBMDef("deimosblocks", 1)), + Ceres(new ModDBMDef("ceresblocks", 1)), + Io(new ModDBMDef("ioblocks", 2)), + Ganymede(new ModDBMDef("ganymedeblocks", 1)), + Callisto(new ModDBMDef("callistoblocks", 1)), + Venus(new ModDBMDef("venusblocks", 1)), + Mercury(new ModDBMDef("mercuryblocks", 2)), + Enceladus(new ModDBMDef("enceladusblocks", 1)), + Titan(new ModDBMDef("titanblocks", 2)), + Oberon(new ModDBMDef("oberonblocks", 2)), + Proteus(new ModDBMDef("proteusblocks", 2)), + Triton(new ModDBMDef("tritonblocks", 2)), + Pluto(new ModDBMDef("plutoblocks", 5)), + MakeMake(new ModDBMDef("makemakegrunt", 1)), + Haumea(new ModDBMDef("haumeablocks")), + CentauriAlpha(new ModDBMDef("acentauribbsubgrunt")), + VegaB(new ModDBMDef("vegabsubgrunt")), + BarnardaC(new ModDBMDef("barnardaCdirt"), new ModDBMDef(Blocks.stone)), + BarnardaE(new ModDBMDef("barnardaEsubgrunt")), + BarnardaF(new ModDBMDef("barnardaFsubgrunt")), + TcetiE(new ModDBMDef("tcetieblocks", 2)), + Miranda(new ModDBMDef("mirandablocks", 2)), + Europa( + // Europa top layer turned off bc ores are too easy to spot + new ModDBMDef("europagrunt", 1), // Europa Ice Layer ~55-65 without top layer + new ModDBMDef(Blocks.water), new ModDBMDef(Blocks.flowing_water), new ModDBMDef(Blocks.ice), // Generates + // directly over + // bedrock + new ModDBMDef(Blocks.packed_ice), // Generates directly over bedrock + new ModDBMDef("europaunderwatergeyser") // Generates directly over bedrock + ), + Neper(new ModDBMDef(Blocks.stone), new ModDBMDef("tile.baseBlockRock", 10)), + Maahes(new ModDBMDef("tile.baseBlockRock", 1)), + Anubis(new ModDBMDef("tile.baseBlockRock", 1)), + Horus(new ModDBMDef(Blocks.obsidian)), + Seth(new ModDBMDef(Blocks.hardened_clay)); + + public final List<ModDBMDef> DBMDefList; + + private DimensionBlockMetaDefinitionList(ModDBMDef... DBMDefArray) { + DBMDefList = Arrays.asList(DBMDefArray); + } +} diff --git a/src/main/java/galacticgreg/api/enums/DimensionDef.java b/src/main/java/galacticgreg/api/enums/DimensionDef.java new file mode 100644 index 0000000000..96626ee7f3 --- /dev/null +++ b/src/main/java/galacticgreg/api/enums/DimensionDef.java @@ -0,0 +1,228 @@ +package galacticgreg.api.enums; + +import net.minecraft.world.gen.ChunkProviderEnd; + +import galacticgreg.api.Enums; +import galacticgreg.api.ModDimensionDef; + +public enum DimensionDef { + + EndAsteroids(new ModDimensionDef(DimNames.ENDASTEROIDS, ChunkProviderEnd.class, Enums.DimensionType.Asteroid)), + Moon(new ModDimensionDef( + DimNames.MOON, + "micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Moon.DBMDefList)), + Mars(new ModDimensionDef( + DimNames.MARS, + "micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Mars.DBMDefList)), + Asteroids(new ModDimensionDef( + DimNames.ASTEROIDS, + "micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids", + Enums.DimensionType.Asteroid)), + Pluto(new ModDimensionDef( + DimNames.PLUTO, + "galaxyspace.SolarSystem.planets.pluto.dimension.ChunkProviderPluto", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Pluto.DBMDefList)), + Triton(new ModDimensionDef( + DimNames.TRITON, + "galaxyspace.SolarSystem.moons.triton.dimension.ChunkProviderTriton", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Triton.DBMDefList)), + Proteus(new ModDimensionDef( + DimNames.PROTEUS, + "galaxyspace.SolarSystem.moons.proteus.dimension.ChunkProviderProteus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Proteus.DBMDefList)), + Oberon(new ModDimensionDef( + DimNames.OBERON, + "galaxyspace.SolarSystem.moons.oberon.dimension.ChunkProviderOberon", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Oberon.DBMDefList)), + Titan(new ModDimensionDef( + DimNames.TITAN, + "galaxyspace.SolarSystem.moons.titan.dimension.ChunkProviderTitan", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Titan.DBMDefList)), + Callisto(new ModDimensionDef( + DimNames.CALLISTO, + "galaxyspace.SolarSystem.moons.callisto.dimension.ChunkProviderCallisto", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Callisto.DBMDefList)), + Ganymede(new ModDimensionDef( + DimNames.GANYMEDE, + "galaxyspace.SolarSystem.moons.ganymede.dimension.ChunkProviderGanymede", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Ganymede.DBMDefList)), + Ceres(new ModDimensionDef( + DimNames.CERES, + "galaxyspace.SolarSystem.planets.ceres.dimension.ChunkProviderCeres", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Ceres.DBMDefList)), + Deimos(new ModDimensionDef( + DimNames.DEIMOS, + "galaxyspace.SolarSystem.moons.deimos.dimension.ChunkProviderDeimos", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Deimos.DBMDefList)), + Enceladus(new ModDimensionDef( + DimNames.ENCELADUS, + "galaxyspace.SolarSystem.moons.enceladus.dimension.ChunkProviderEnceladus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Enceladus.DBMDefList)), + Io(new ModDimensionDef( + DimNames.IO, + "galaxyspace.SolarSystem.moons.io.dimension.ChunkProviderIo", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Io.DBMDefList)), + Europa(new ModDimensionDef( + DimNames.EUROPA, + "galaxyspace.SolarSystem.moons.europa.dimension.ChunkProviderEuropa", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Europa.DBMDefList)), + Phobos(new ModDimensionDef( + DimNames.PHOBOS, + "galaxyspace.SolarSystem.moons.phobos.dimension.ChunkProviderPhobos", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Phobos.DBMDefList)), + Venus(new ModDimensionDef( + DimNames.VENUS, + "galaxyspace.SolarSystem.planets.venus.dimension.ChunkProviderVenus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Venus.DBMDefList)), + Mercury(new ModDimensionDef( + DimNames.MERCURY, + "galaxyspace.SolarSystem.planets.mercury.dimension.ChunkProviderMercury", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Mercury.DBMDefList)), + MakeMake(new ModDimensionDef( + DimNames.MAKEMAKE, + "galaxyspace.SolarSystem.planets.makemake.dimension.ChunkProviderMakemake", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.MakeMake.DBMDefList)), + Haumea(new ModDimensionDef( + DimNames.HAUMEA, + "galaxyspace.SolarSystem.planets.haumea.dimension.ChunkProviderHaumea", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Haumea.DBMDefList)), + CentauriAlpha(new ModDimensionDef( + DimNames.CENTAURIA, + "galaxyspace.ACentauriSystem.planets.aCentauriBb.dimension.ChunkProviderACentauri", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.CentauriAlpha.DBMDefList)), + VegaB(new ModDimensionDef( + DimNames.VEGAB, + "galaxyspace.VegaSystem.planets.vegaB.dimension.ChunkProviderVegaB", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.VegaB.DBMDefList)), + BarnardC(new ModDimensionDef( + DimNames.BARNARDC, + "galaxyspace.BarnardsSystem.planets.barnardaC.dimension.ChunkProviderBarnardaC", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaC.DBMDefList)), + BarnardE(new ModDimensionDef( + DimNames.BARNARDE, + "galaxyspace.BarnardsSystem.planets.barnardaE.dimension.ChunkProviderBarnardaE", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaE.DBMDefList)), + BarnardF(new ModDimensionDef( + DimNames.BARNARDF, + "galaxyspace.BarnardsSystem.planets.barnardaF.dimension.ChunkProviderBarnardaF", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaF.DBMDefList)), + TcetiE(new ModDimensionDef( + DimNames.TCETIE, + "galaxyspace.TCetiSystem.planets.tcetiE.dimension.ChunkProviderTCetiE", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.TcetiE.DBMDefList)), + Miranda(new ModDimensionDef( + DimNames.MIRANDA, + "galaxyspace.SolarSystem.moons.miranda.dimension.ChunkProviderMiranda", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Miranda.DBMDefList)), + KuiperBelt(new ModDimensionDef( + DimNames.KUIPERBELT, + "galaxyspace.SolarSystem.planets.kuiperbelt.dimension.ChunkProviderKuiper", + Enums.DimensionType.Asteroid)), + + Neper(new ModDimensionDef( + DimNames.NEPER, + "de.katzenpapst.amunra.world.neper.NeperChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Neper.DBMDefList)), + Maahes(new ModDimensionDef( + DimNames.MAAHES, + "de.katzenpapst.amunra.world.maahes.MaahesChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Maahes.DBMDefList)), + Anubis(new ModDimensionDef( + DimNames.ANUBIS, + "de.katzenpapst.amunra.world.anubis.AnubisChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Anubis.DBMDefList)), + Horus(new ModDimensionDef( + DimNames.HORUS, + "de.katzenpapst.amunra.world.horus.HorusChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Horus.DBMDefList)), + Seth(new ModDimensionDef( + DimNames.SETH, + "de.katzenpapst.amunra.world.seth.SethChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Seth.DBMDefList)), + MehenBelt(new ModDimensionDef( + DimNames.MEHENBELT, + "de.katzenpapst.amunra.world.mehen.MehenChunkProvider", + Enums.DimensionType.Asteroid)); + + public static class DimNames { + + public static final String ENDASTEROIDS = "EndAsteroids"; + public static final String MOON = "Moon"; + public static final String MARS = "Mars"; + public static final String ASTEROIDS = "Asteroids"; + public static final String PLUTO = "Pluto"; + public static final String TRITON = "Triton"; + public static final String PROTEUS = "Proteus"; + public static final String OBERON = "Oberon"; + public static final String TITAN = "Titan"; + public static final String ROSS128B = "Ross128b"; + public static final String ROSS128BA = "Ross128ba"; + public static final String CALLISTO = "Callisto"; + public static final String GANYMEDE = "Ganymede"; + public static final String CERES = "Ceres"; + public static final String DEIMOS = "Deimos"; + public static final String ENCELADUS = "Enceladus"; + public static final String IO = "Io"; + public static final String EUROPA = "Europa"; + public static final String PHOBOS = "Phobos"; + public static final String VENUS = "Venus"; + public static final String MERCURY = "Mercury"; + public static final String MAKEMAKE = "MakeMake"; + public static final String HAUMEA = "Haumea"; + public static final String CENTAURIA = "CentauriA"; + public static final String VEGAB = "VegaB"; + public static final String BARNARDC = "BarnardC"; + public static final String BARNARDE = "BarnardE"; + public static final String BARNARDF = "BarnardF"; + public static final String TCETIE = "TcetiE"; + public static final String MIRANDA = "Miranda"; + public static final String KUIPERBELT = "Kuiperbelt"; + public static final String NEPER = "Neper"; + public static final String MAAHES = "Maahes"; + public static final String ANUBIS = "Anubis"; + public static final String HORUS = "Horus"; + public static final String SETH = "Seth"; + public static final String MEHENBELT = "MehenBelt"; + public static final String DEEPDARK = "Underdark"; + + } + + public final ModDimensionDef modDimensionDef; + + private DimensionDef(ModDimensionDef modDimDef) { + this.modDimensionDef = modDimDef; + } +} diff --git a/src/main/java/galacticgreg/api/enums/ModContainers.java b/src/main/java/galacticgreg/api/enums/ModContainers.java new file mode 100644 index 0000000000..7352e5a75c --- /dev/null +++ b/src/main/java/galacticgreg/api/enums/ModContainers.java @@ -0,0 +1,19 @@ +package galacticgreg.api.enums; + +import galacticgreg.api.ModContainer; +import gregtech.api.enums.Mods; + +public enum ModContainers { + + GalactiCraftCore(new ModContainer(Mods.GalacticraftCore.ID)), + GalacticraftMars(new ModContainer(Mods.GalacticraftMars.ID)), + GalaxySpace(new ModContainer(Mods.GalaxySpace.ID)), + AmunRa(new ModContainer("GalacticraftAmunRa")), + Vanilla(new ModContainer("Vanilla")); + + public final ModContainer modContainer; + + private ModContainers(ModContainer modContainer) { + this.modContainer = modContainer; + } +} diff --git a/src/main/java/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java b/src/main/java/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java new file mode 100644 index 0000000000..bf5fecc78a --- /dev/null +++ b/src/main/java/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java @@ -0,0 +1,105 @@ +package galacticgreg.api.enums.properties; + +public class AsteroidPropertyBuilder { + + public int probability; + public int sizeMin, sizeMax; + public int specialBlockChance; + public OreSpawnPropertyBuilder oreSpawn; + public LootPropertyBuilder loot; + + public static class OreSpawnPropertyBuilder { + + public int baseOreChance; + public boolean obeyHeighLimits; + public boolean oresOnlyInsideAsteroids; + public int primaryToRareOreOffset; + public int smallOreChance; + + public OreSpawnPropertyBuilder baseOreChance(int baseOreChance) { + this.baseOreChance = baseOreChance; + return this; + } + + public OreSpawnPropertyBuilder doesObeyingHeightLimits(boolean obeyHeighLimits) { + this.obeyHeighLimits = obeyHeighLimits; + return this; + } + + public OreSpawnPropertyBuilder AreOresOnlyInsideAsteroids(boolean oresOnlyInsideAsteroids) { + this.oresOnlyInsideAsteroids = oresOnlyInsideAsteroids; + return this; + } + + public OreSpawnPropertyBuilder primaryToRareOreOffset(int primaryToRareOreOffset) { + this.primaryToRareOreOffset = primaryToRareOreOffset; + return this; + } + + public OreSpawnPropertyBuilder smallOreChance(int smallOreChance) { + this.smallOreChance = smallOreChance; + return this; + } + + } + + public static class LootPropertyBuilder { + + public int lootChestChance; + public int lootChestItemCount; + public int lootChestTable; + public boolean randomizeLootItemCount; + + public LootPropertyBuilder lootChestChance(int lootChestChance) { + this.lootChestChance = lootChestChance; + return this; + } + + public LootPropertyBuilder lootChestItemCount(int lootChestItemCount) { + this.lootChestItemCount = lootChestItemCount; + return this; + } + + public LootPropertyBuilder lootChestTable(int lootChestTable) { + this.lootChestTable = lootChestTable; + return this; + } + + public LootPropertyBuilder isLootItemCountRandomized(boolean randomizeLootItemCount) { + this.randomizeLootItemCount = randomizeLootItemCount; + return this; + } + + } + + public AsteroidPropertyBuilder() { + oreSpawn = new OreSpawnPropertyBuilder(); + loot = new LootPropertyBuilder(); + } + + public AsteroidPropertyBuilder probability(int probability) { + this.probability = probability; + return this; + } + + public AsteroidPropertyBuilder sizeRange(int sizeMin, int sizeMax) { + this.sizeMin = sizeMin; + this.sizeMax = sizeMax; + return this; + } + + public AsteroidPropertyBuilder specialBlockChance(int specialBlockChance) { + this.specialBlockChance = specialBlockChance; + return this; + } + + public AsteroidPropertyBuilder oreSpawn(OreSpawnPropertyBuilder oreSpawnPropertyBuilder) { + this.oreSpawn = oreSpawnPropertyBuilder; + return this; + } + + public AsteroidPropertyBuilder loot(LootPropertyBuilder lootPropertyBuilder) { + this.loot = lootPropertyBuilder; + return this; + } +} diff --git a/src/main/java/galacticgreg/api/enums/properties/Asteroids.java b/src/main/java/galacticgreg/api/enums/properties/Asteroids.java new file mode 100644 index 0000000000..2916031aaf --- /dev/null +++ b/src/main/java/galacticgreg/api/enums/properties/Asteroids.java @@ -0,0 +1,78 @@ +package galacticgreg.api.enums.properties; + +import galacticgreg.api.enums.DimensionDef; +import galacticgreg.api.enums.ModContainers; + +public enum Asteroids { + + // spotless : off + EndAsteroids(ModContainers.Vanilla, DimensionDef.EndAsteroids, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + KuiperBelt(ModContainers.GalaxySpace, DimensionDef.KuiperBelt, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + MehenBelt(ModContainers.AmunRa, DimensionDef.MehenBelt, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + Asteroids(ModContainers.GalacticraftMars, DimensionDef.Asteroids, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))),; + + // spotless : on + + public ModContainers modContainers; + public DimensionDef dimensionDef; + public AsteroidPropertyBuilder asteroidPropertyBuilder; + + private Asteroids(ModContainers modContainers, DimensionDef dimensionDef, + AsteroidPropertyBuilder asteroidPropertyBuilder) { + this.modContainers = modContainers; + this.dimensionDef = dimensionDef; + this.asteroidPropertyBuilder = asteroidPropertyBuilder; + } +} |