diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-04-22 17:59:17 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-04-22 17:59:17 +1000 |
commit | b33cfd02d8a367af0ba9a6689a0507440f44d07c (patch) | |
tree | e3832c9427e2f89f0ebc13bcb9c20de8c2328587 /src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java | |
parent | 1b722c6d3941371c6b1ef90b60775539ffaff06c (diff) | |
download | GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.tar.gz GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.tar.bz2 GT5-Unofficial-b33cfd02d8a367af0ba9a6689a0507440f44d07c.zip |
Refactoring like a champion.
Diffstat (limited to 'src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java')
-rw-r--r-- | src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java new file mode 100644 index 0000000000..de9a98c644 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java @@ -0,0 +1,67 @@ +package miscutil.gregtech.api.metatileentity.implementations.base; + +import static gregtech.api.enums.GT_Values.GT; +import gregtech.api.interfaces.ITexture; +import gregtech.api.metatileentity.MetaTileEntity; +import net.minecraft.util.EnumChatFormatting; + +public abstract class GregtechMetaTileEntity extends MetaTileEntity { + /** + * Value between [0 - 9] to describe the Tier of this Machine. + */ + public final byte mTier; + + /** + * A simple Description. + */ + public final String mDescription; + + /** + * Contains all Textures used by this Block. + */ + public final ITexture[][][] mTextures; + + public GregtechMetaTileEntity(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aInvSlotCount); + mTier = (byte)Math.max(0, Math.min(aTier, 9)); + mDescription = aDescription; + + // must always be the last call! + if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null; + } + + public GregtechMetaTileEntity(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aInvSlotCount); + mTier = (byte)aTier; + mDescription = aDescription; + mTextures = aTextures; + + } + + @Override + public byte getTileEntityBaseType() { + return (byte)(Math.min(3, mTier<=0?0:1+((mTier-1) / 4))); + } + + @Override + public long getInputTier() { + return mTier; + } + + @Override + public long getOutputTier() { + return mTier; + } + + @Override + public String[] getDescription() { + return new String[] {mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"}; + } + + /** + * Used Client Side to get a Texture Set for this Block. + * Called after setting the Tier and the Description so that those two are accessible. + * @param aTextures is the optional Array you can give to the Constructor. + */ + public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); +}
\ No newline at end of file |