diff options
author | Raven Szewczyk <git@eigenraven.me> | 2024-05-24 19:50:35 +0100 |
---|---|---|
committer | Raven Szewczyk <git@eigenraven.me> | 2024-05-24 19:50:35 +0100 |
commit | 6d1b2216464d4dad449ac6fcfec476832224a55e (patch) | |
tree | 526a0c15f7056313c80e6c0386e025e9b3f61781 /src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java | |
parent | b5d35f40afa606ed1b07061dad82e0521a59c186 (diff) | |
download | GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.gz GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.bz2 GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.zip |
Merge addon sources
Diffstat (limited to 'src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java')
-rw-r--r-- | src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java b/src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java new file mode 100644 index 0000000000..d5f6feb1ca --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/SpecialBlockComb.java @@ -0,0 +1,71 @@ +package bloodasp.galacticgreg.api; + +import net.minecraft.block.Block; + +import bloodasp.galacticgreg.api.Enums.AllowedBlockPosition; + +public class SpecialBlockComb extends BlockMetaComb { + + private 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, 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, 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 = AllowedBlockPosition.AsteroidCoreAndShell; + } + + /** + * Internal function + * + * @return The position the block is supposed to spawn at + */ + public 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; + } +} |