aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java258
1 files changed, 125 insertions, 133 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
index eede58d65b..7508391f93 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
@@ -12,108 +12,130 @@ import gtPlusPlus.core.util.fluid.FluidUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
-public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank {
+public class GT_MetaTileEntity_TieredTank
+extends GT_MetaTileEntity_BasicTank {
- private NBTTagCompound mRecipeStuff = new NBTTagCompound();
- private String mFluidName;
- private int mFluidAmount;
+ private NBTTagCompound mRecipeStuff = new NBTTagCompound();
+ private String mFluidName;
+ private int mFluidAmount;
- public GT_MetaTileEntity_TieredTank(final int aID, final String aName, final String aNameRegional,
- final int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + (int) (Math.pow(2, aTier) * 32000) + "L of fluid");
+ public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid");
}
- public GT_MetaTileEntity_TieredTank(final String aName, final int aTier, final String aDescription,
- final ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, 3, aDescription, aTextures);
}
@Override
- public boolean canTankBeEmptied() {
- return true;
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
}
@Override
- public boolean canTankBeFilled() {
- return true;
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)};
}
- @Override
- public boolean displaysItemStack() {
+
+ private boolean setVars(){
+ //Utils.LOG_INFO("setting Vars.");
+ if (mFluidName.equals("") || !mFluidName.equals(null)){
+ if (mFluid != null) mFluidName = mFluid.getFluid().getName();
+ }
+ else{
+ if (mFluid != null){
+ if (!mFluidName.equalsIgnoreCase(mFluid.getFluid().getName())){
+ mFluidName = mFluid.getFluid().getName();
+ }
+ }
+ else {
+ // Leave Values Blank.
+ return false;
+ }
+ }
+
+ if (mFluidAmount <= 0){
+ if (mFluid != null) mFluidAmount = mFluid.amount;
+ }
+ else {
+ if (mFluid != null){
+ if (mFluidAmount != mFluid.amount){
+ mFluidAmount = mFluid.amount;
+ }
+ }
+ else {
+ // Leave Values Blank.
+ return false;
+ }
+ }
return true;
}
+
@Override
- public boolean displaysStackSize() {
- return false;
- }
+ public String[] getDescription() {
+
+ setVars();
- @Override
- public boolean doesEmptyContainers() {
- return true;
+
+ if ((mFluidName.equals("Empty")||mFluidName.equals("")) || mFluidAmount <= 0){
+ return new String[] {mDescription, CORE.GT_Tooltip};
+ }
+ return new String[] {mDescription, "Stored Fluid: "+mFluidName, "Stored Amount: "+mFluidAmount+"l", CORE.GT_Tooltip};
}
+
@Override
- public boolean doesFillContainers() {
- return true;
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ setVars();
+ mRecipeStuff.setString("mFluidName", mFluidName);
+ mRecipeStuff.setInteger("mFluidAmount", mFluidAmount);
+ aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
}
@Override
- public int getCapacity() {
- return (int) (Math.pow(2, this.mTier) * 32000);
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
+ mFluidName = mRecipeStuff.getString("mFluidName");
+ mFluidAmount = mRecipeStuff.getInteger("mFluidAmount");
+ mFluid = FluidUtils.getFluidStack(mFluidName, mFluidAmount);
+ setItemNBT(aNBT);
}
@Override
- public String[] getDescription() {
-
- this.setVars();
-
- if (this.mFluidName.equals("Empty") || this.mFluidName.equals("") || this.mFluidAmount <= 0) {
- return new String[] {
- this.mDescription, CORE.GT_Tooltip
- };
- }
- return new String[] {
- this.mDescription, "Stored Fluid: " + this.mFluidName, "Stored Amount: " + this.mFluidAmount + "l",
- CORE.GT_Tooltip
- };
+ public void setItemNBT(NBTTagCompound aNBT) {
+ super.setItemNBT(aNBT);
+ mRecipeStuff.setString("mFluidName", mFluidName);
+ mRecipeStuff.setInteger("mFluidAmount", mFluidAmount);
+ aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
}
- @Override
- public String[] getInfoData() {
- if (this.mFluid == null) {
- return new String[] {
- GT_Values.VOLTAGE_NAMES[this.mTier] + " Fluid Tank", "Stored Fluid:", "No Fluid",
- Integer.toString(0) + "L", Integer.toString(this.getCapacity()) + "L"
- };
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()){
+ return true;
}
- return new String[] {
- GT_Values.VOLTAGE_NAMES[this.mTier] + " Fluid Tank", "Stored Fluid:", this.mFluid.getLocalizedName(),
- Integer.toString(this.mFluid.amount) + "L", Integer.toString(this.getCapacity()) + "L"
- };
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
}
@Override
- public int getTankPressure() {
- return 100;
+ public boolean isSimpleMachine() {
+ return true;
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- return aSide == 1 ? new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)
- } : new ITexture[] {
- Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1],
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)
- };
+ public boolean isFacingValid(byte aFacing) {
+ return true;
}
@Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- return new ITexture[0][0][0];
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
}
@Override
@@ -122,114 +144,84 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank {
}
@Override
- public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ public boolean doesFillContainers() {
return true;
}
@Override
- public boolean isFacingValid(final byte aFacing) {
+ public boolean doesEmptyContainers() {
return true;
}
@Override
- public boolean isGivingInformation() {
+ public boolean canTankBeFilled() {
return true;
}
@Override
- public boolean isSimpleMachine() {
+ public boolean canTankBeEmptied() {
return true;
}
@Override
- public void loadNBTData(final NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- this.mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
- this.mFluidName = this.mRecipeStuff.getString("mFluidName");
- this.mFluidAmount = this.mRecipeStuff.getInteger("mFluidAmount");
- this.mFluid = FluidUtils.getFluidStack(this.mFluidName, this.mFluidAmount);
- this.setItemNBT(aNBT);
+ public boolean displaysItemStack() {
+ return true;
}
@Override
- public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_TieredTank(this.mName, this.mTier, this.mDescription, this.mTextures);
+ public boolean displaysStackSize() {
+ return false;
}
@Override
- public void onMachineBlockUpdate() {
- this.getBaseMetaTileEntity().markDirty();
- super.onMachineBlockUpdate();
+ public String[] getInfoData() {
+
+ if (mFluid == null) {
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ "No Fluid",
+ Integer.toString(0) + "L",
+ Integer.toString(getCapacity()) + "L"};
+ }
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ mFluid.getLocalizedName(),
+ Integer.toString(mFluid.amount) + "L",
+ Integer.toString(getCapacity()) + "L"};
}
@Override
- public void onRemoval() {
- this.getBaseMetaTileEntity().markDirty();
- super.onRemoval();
+ public boolean isGivingInformation() {
+ return true;
}
@Override
- public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) {
- return true;
- }
- aBaseMetaTileEntity.openGUI(aPlayer);
- return true;
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures);
}
@Override
- public void saveNBTData(final NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- this.setVars();
- this.mRecipeStuff.setString("mFluidName", this.mFluidName);
- this.mRecipeStuff.setInteger("mFluidAmount", this.mFluidAmount);
- aNBT.setTag("GT.CraftingComponents", this.mRecipeStuff);
+ public int getCapacity() {
+ return (int) (Math.pow(2, mTier) * 32000);
}
@Override
- public void setItemNBT(final NBTTagCompound aNBT) {
- super.setItemNBT(aNBT);
- this.mRecipeStuff.setString("mFluidName", this.mFluidName);
- this.mRecipeStuff.setInteger("mFluidAmount", this.mFluidAmount);
- aNBT.setTag("GT.CraftingComponents", this.mRecipeStuff);
+ public int getTankPressure() {
+ return 100;
}
- private boolean setVars() {
- // Utils.LOG_INFO("setting Vars.");
- if (this.mFluidName.equals("") || !this.mFluidName.equals(null)) {
- if (this.mFluid != null) {
- this.mFluidName = this.mFluid.getFluid().getName();
- }
- }
- else {
- if (this.mFluid != null) {
- if (!this.mFluidName.equalsIgnoreCase(this.mFluid.getFluid().getName())) {
- this.mFluidName = this.mFluid.getFluid().getName();
- }
- }
- else {
- // Leave Values Blank.
- return false;
- }
- }
+ @Override
+ public void onMachineBlockUpdate() {
+ this.getBaseMetaTileEntity().markDirty();
+ super.onMachineBlockUpdate();
+ }
- if (this.mFluidAmount <= 0) {
- if (this.mFluid != null) {
- this.mFluidAmount = this.mFluid.amount;
- }
- }
- else {
- if (this.mFluid != null) {
- if (this.mFluidAmount != this.mFluid.amount) {
- this.mFluidAmount = this.mFluid.amount;
- }
- }
- else {
- // Leave Values Blank.
- return false;
- }
- }
- return true;
+ @Override
+ public void onRemoval() {
+ this.getBaseMetaTileEntity().markDirty();
+ super.onRemoval();
}
} \ No newline at end of file