aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/storage
diff options
context:
space:
mode:
authorKiwi <42833050+Kiwi233@users.noreply.github.com>2021-07-05 22:06:44 +0800
committerGitHub <noreply@github.com>2021-07-05 22:06:44 +0800
commit4eaefbb5455dc3402b43dcbf6cba208cea4e301a (patch)
treeb7e34b2e20af663cdd72c616fd7424301304e3e4 /src/main/java/gregtech/common/tileentities/storage
parent36406947fc5c0de1ee71da2644ec057b5fbc8d25 (diff)
parent703a8930bee25b1f908e9c4ea4f52cef24337d03 (diff)
downloadGT5-Unofficial-4eaefbb5455dc3402b43dcbf6cba208cea4e301a.tar.gz
GT5-Unofficial-4eaefbb5455dc3402b43dcbf6cba208cea4e301a.tar.bz2
GT5-Unofficial-4eaefbb5455dc3402b43dcbf6cba208cea4e301a.zip
Merge pull request #3 from GTNewHorizons/experimental
gregtech-5.09.35.00
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/storage')
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java450
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java52
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java144
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java26
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java144
5 files changed, 484 insertions, 332 deletions
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
index 606733658b..d78dd722fa 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
@@ -1,12 +1,12 @@
package gregtech.common.tileentities.storage;
import cpw.mods.fml.common.Optional;
-import gregtech.api.enums.Textures;
+import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.objects.AE2DigitalChestHandler;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_QuantumChest;
import gregtech.common.gui.GT_GUIContainer_QuantumChest;
@@ -17,10 +17,51 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2")
-public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEInventory<appeng.api.storage.data.IAEItemStack> {
+import java.util.HashMap;
+import java.util.Map;
+
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST_GLOW;
+
+@Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true)
+public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack> {
+ protected boolean mVoidOverflow = false;
+ private Map<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> listeners = null;
+
public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use a screwdriver to enable voiding items on overflow");
+ super(aID, aName, aNameRegional, aTier, 3, new String[]{
+ "This Chest stores " + commonSizeCompute(aTier) + " Blocks",
+ "Use a screwdriver to enable",
+ "voiding items on overflow"
+ });
+ }
+
+ protected static int commonSizeCompute(int tier) {
+ switch (tier) {
+ case 1:
+ return 4000000;
+ case 2:
+ return 8000000;
+ case 3:
+ return 16000000;
+ case 4:
+ return 32000000;
+ case 5:
+ return 64000000;
+ case 6:
+ return 128000000;
+ case 7:
+ return 256000000;
+ case 8:
+ return 512000000;
+ case 9:
+ return 1024000000;
+ case 10:
+ return 2147483640;
+ default:
+ return 0;
+ }
}
public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -31,39 +72,103 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
super(aName, aTier, 3, aDescription, aTextures);
}
+ @Optional.Method(modid = "appliedenergistics2")
+ public static void registerAEIntegration() {
+ appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler());
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
@Override
- public boolean isSimpleMachine() {
- return true;
+ public void addListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver, Object o) {
+ if (listeners == null)
+ listeners = new HashMap<>();
+ listeners.put(imeMonitorHandlerReceiver, o);
}
+ @Optional.Method(modid = "appliedenergistics2")
@Override
- public boolean isFacingValid(byte aFacing) {
- return true;
+ public void removeListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver) {
+ if (listeners == null)
+ listeners = new HashMap<>();
+ listeners.remove(imeMonitorHandlerReceiver);
}
+ @Optional.Method(modid = "appliedenergistics2")
@Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
+ public appeng.api.config.AccessRestriction getAccess() {
+ return appeng.api.config.AccessRestriction.READ_WRITE;
}
+ @Optional.Method(modid = "appliedenergistics2")
@Override
- public boolean isValidSlot(int aIndex) {
- return true;
+ public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) {
+ return false;
}
+ @Optional.Method(modid = "appliedenergistics2")
@Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- aBaseMetaTileEntity.openGUI(aPlayer);
+ public boolean canAccept(appeng.api.storage.data.IAEItemStack iaeItemStack) {
+ ItemStack s = getItemStack();
+ if (s == null || iaeItemStack == null)
+ return true;
+ return iaeItemStack.isSameType(s);
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ @Override
+ public int getPriority() {
+ return 0;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ @Override
+ public int getSlot() {
+ return 0;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ @Override
+ public boolean validForPass(int i) {
return true;
}
-
- protected boolean mVoidOverflow = false;
+
+ protected abstract ItemStack getItemStack();
+
+ protected abstract void setItemStack(ItemStack s);
@Override
- public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- mVoidOverflow = !mVoidOverflow;
- GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled"));
+ @Optional.Method(modid = "appliedenergistics2")
+ public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList out) {
+ ItemStack storedStack = getItemStack();
+ if (storedStack != null) {
+ appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack);
+ s.setStackSize(getItemCount());
+ out.add(s);
+ }
+ return out;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ @Override
+ public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getStorageList() {
+ appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> res = new appeng.util.item.ItemList();
+ ItemStack storedStack = getItemStack();
+ if (storedStack != null) {
+ appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack);
+ s.setStackSize(getItemCount());
+ res.add(s);
+ }
+ return res;
+ }
+
+ protected abstract int getItemCount();
+
+ @Override
+ public abstract void setItemCount(int aCount);
+
+ @Override
+ public int getMaxItemCount() {
+ return commonSizeCompute(mTier);
}
@Override
@@ -77,6 +182,87 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
}
@Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) {
+ final ItemStack inputStack = input.getItemStack();
+ if (inputStack == null)
+ return null;
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ getBaseMetaTileEntity().markDirty();
+ ItemStack storedStack = getItemStack();
+ if (storedStack != null) {
+ if (GT_Utility.areStacksEqual(storedStack, inputStack)) {
+ if (input.getStackSize() + getItemCount() > getMaxItemCount()) {
+ if (mVoidOverflow) {
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(getMaxItemCount());
+ return null;
+ }
+ return createOverflowStack(input.getStackSize() + getItemCount(), mode);
+ }
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(getItemCount() + (int) input.getStackSize());
+ return null;
+ }
+ return input;
+ }
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemStack(inputStack.copy());
+ if (input.getStackSize() > getMaxItemCount())
+ return createOverflowStack(input.getStackSize(), mode);
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount((int) input.getStackSize());
+ return null;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ private appeng.api.storage.data.IAEItemStack createOverflowStack(long size, appeng.api.config.Actionable mode) {
+ final appeng.api.storage.data.IAEItemStack overflow = appeng.util.item.AEItemStack.create(getItemStack());
+ overflow.setStackSize(size - getMaxItemCount());
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(getMaxItemCount());
+ return overflow;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public appeng.api.storage.data.IAEItemStack extractItems(final appeng.api.storage.data.IAEItemStack request, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) {
+ if (request.isSameType(getItemStack())) {
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ getBaseMetaTileEntity().markDirty();
+ if (request.getStackSize() >= getItemCount()) {
+ appeng.util.item.AEItemStack result = appeng.util.item.AEItemStack.create(getItemStack());
+ result.setStackSize(getItemCount());
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(0);
+ return result;
+ } else {
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(getItemCount() - (int) request.getStackSize());
+ return request.copy();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public appeng.api.storage.StorageChannel getChannel() {
+ return appeng.api.storage.StorageChannel.ITEMS;
+ }
+
+ @Override
+ public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mVoidOverflow = !mVoidOverflow;
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled"));
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) {
@@ -89,9 +275,10 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
}
int count = getItemCount();
ItemStack stack = getItemStack();
- if ((mInventory[0] != null) && ((count < getMaxItemCount())|| mVoidOverflow ) && GT_Utility.areStacksEqual(mInventory[0], stack)) {
- count += mInventory[0].stackSize;
+ int savedCount = count;
+ if ((mInventory[0] != null) && ((count < getMaxItemCount()) || mVoidOverflow) && GT_Utility.areStacksEqual(mInventory[0], stack)) {
+ count += mInventory[0].stackSize;
if (count <= getMaxItemCount()) {
mInventory[0] = null;
} else {
@@ -119,107 +306,53 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
} else {
mInventory[2] = null;
}
- }
- }
- abstract protected int getItemCount();
- abstract public void setItemCount(int aCount);
- abstract protected ItemStack getItemStack();
- abstract protected void setItemStack(ItemStack s);
-
- @Override
- public int getProgresstime() {
- return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize);
- }
-
- @Override
- public int maxProgresstime() {
- return getMaxItemCount();
- }
-
- protected static int CommonSizeCompute(int tier){
- switch(tier){
- case 1:
- return 4000000;
- case 2:
- return 8000000;
- case 3:
- return 16000000;
- case 4:
- return 32000000;
- case 5:
- return 64000000;
- case 6:
- return 128000000;
- case 7:
- return 256000000;
- case 8:
- return 512000000;
- case 9:
- return 1024000000;
- case 10:
- return 2147483640;
- default:
- return 0;
+ if (GregTech_API.mAE2)
+ notifyListeners(count - savedCount, stack);
+ if (count != savedCount)
+ getBaseMetaTileEntity().markDirty();
}
}
@Override
- public int getMaxItemCount() {
- return CommonSizeCompute(mTier);
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
}
@Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aIndex == 1;
+ public boolean isFacingValid(byte aFacing) {
+ return true;
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack));
- }
-
- abstract protected String chestName();
-
- @Optional.Method(modid = "appliedenergistics2")
- public static void registerAEIntegration() {
- appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler());
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
}
@Override
- public boolean isGivingInformation() {
+ public boolean isValidSlot(int aIndex) {
return true;
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("mItemCount", getItemCount());
- if (getItemStack() != null)
- aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound()));
- aNBT.setBoolean("mVoidOverflow", mVoidOverflow);
+ public boolean isSimpleMachine() {
+ return true;
}
@Override
- public void loadNBTData(NBTTagCompound aNBT) {
- if (aNBT.hasKey("mItemCount"))
- setItemCount(aNBT.getInteger("mItemCount"));
- if (aNBT.hasKey("mItemStack"))
- setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")));
- mVoidOverflow = aNBT.getBoolean("mVoidOverflow");
-
+ public int getProgresstime() {
+ return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize);
}
@Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)};
- }
- return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]);
+ public int maxProgresstime() {
+ return getMaxItemCount();
}
@Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
+ public boolean isGivingInformation() {
+ return true;
}
@Override
@@ -243,85 +376,68 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
};
}
+ @Override
+ public ItemStack[] getStoredItemData() {
+ return mInventory;
+ }
+
+ protected abstract String chestName();
+
@Optional.Method(modid = "appliedenergistics2")
- public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) {
- final ItemStack inputStack = input.getItemStack();
- if (inputStack == null)
- return null;
- ItemStack storedStack = getItemStack();
- if (storedStack != null) {
- if (GT_Utility.areStacksEqual(storedStack, inputStack)) {
- if (input.getStackSize() + getItemCount() > getMaxItemCount())
- {
- if (mVoidOverflow)
- {
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount(getMaxItemCount());
- return null;
- }
- else
- {
- return createOverflowStack(input.getStackSize() + getItemCount(), mode);
- }
- }
- else {
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount(getItemCount() + (int) input.getStackSize());
- }
- return null;
- } else
- return input;
- } else {
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemStack(inputStack.copy());
- if (input.getStackSize() > getMaxItemCount())
- return createOverflowStack(input.getStackSize(), mode);
- else if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount((int) input.getStackSize());
- return null;
+ private void notifyListeners(int count, ItemStack stack) {
+ if (listeners == null) {
+ listeners = new HashMap<>();
+ return;
}
+ if (count == 0 || stack == null)
+ return;
+ appeng.util.item.ItemList change = new appeng.util.item.ItemList();
+ appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(stack);
+ s.setStackSize(count);
+ change.add(s);
+ listeners.forEach((l, o) -> {
+ if (l.isValid(o))
+ l.postChange(this, change, null);
+ else
+ removeListener(l);
+ });
}
- @Optional.Method(modid = "appliedenergistics2")
- private appeng.api.storage.data.IAEItemStack createOverflowStack(long size, appeng.api.config.Actionable mode) {
- final appeng.api.storage.data.IAEItemStack overflow = appeng.util.item.AEItemStack.create(getItemStack());
- overflow.setStackSize(size - getMaxItemCount());
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount(getMaxItemCount());
- return overflow;
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mItemCount", getItemCount());
+ if (getItemStack() != null)
+ aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound()));
+ aNBT.setBoolean("mVoidOverflow", mVoidOverflow);
}
- @Optional.Method(modid = "appliedenergistics2")
- public appeng.api.storage.data.IAEItemStack extractItems(final appeng.api.storage.data.IAEItemStack request, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) {
- if (request.equals(getItemStack())) {
- if (request.getStackSize() >= getItemCount()) {
- appeng.util.item.AEItemStack result = appeng.util.item.AEItemStack.create(getItemStack());
- result.setStackSize(getItemCount());
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount(0);
- return result;
- } else {
- if (mode != appeng.api.config.Actionable.SIMULATE)
- setItemCount(getItemCount() - (int) request.getStackSize());
- return request.copy();
- }
- }
- return null;
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ if (aNBT.hasKey("mItemCount"))
+ setItemCount(aNBT.getInteger("mItemCount"));
+ if (aNBT.hasKey("mItemStack"))
+ setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")));
+ mVoidOverflow = aNBT.getBoolean("mVoidOverflow");
+
}
- @Optional.Method(modid = "appliedenergistics2")
- public appeng.api.storage.StorageChannel getChannel() {
- return appeng.api.storage.StorageChannel.ITEMS;
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 1;
}
- @Optional.Method(modid = "appliedenergistics2")
- public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> out) {
- ItemStack storedStack = getItemStack();
- if (storedStack != null) {
- appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack);
- s.setStackSize(getItemCount());
- out.add(s);
- }
- return out;
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack));
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide != aFacing) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ return new ITexture[]{
+ MACHINE_CASINGS[mTier][aColorIndex + 1],
+ TextureFactory.of(OVERLAY_SCHEST),
+ TextureFactory.builder().addIcon(OVERLAY_SCHEST_GLOW).glow().build()
+ };
}
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java
index 1eb62153e7..2295042d1a 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java
@@ -1,24 +1,27 @@
package gregtech.common.tileentities.storage;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-public class GT_MetaTileEntity_Locker
- extends GT_MetaTileEntity_TieredMachineBlock {
+import static gregtech.api.enums.Textures.BlockIcons.LOCKERS;
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_IN;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_LOCKER;
+
+public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlock {
public byte mType = 0;
public GT_MetaTileEntity_Locker(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 4, "Stores and recharges Armor", new ITexture[0]);
+ super(aID, aName, aNameRegional, aTier, 4, "Stores and recharges Armor");
}
public GT_MetaTileEntity_Locker(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -29,6 +32,7 @@ public class GT_MetaTileEntity_Locker
super(aName, aTier, 4, aDescription, aTextures);
}
+ @Override
public String[] getDescription() {
String[] desc = new String[mDescriptionArray.length + 1];
System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length);
@@ -36,114 +40,138 @@ public class GT_MetaTileEntity_Locker
return desc;
}
+ @Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[3][17][];
for (byte i = -1; i < 16; i = (byte) (i + 1)) {
- ITexture[] tmp0 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)]};
+ ITexture[] tmp0 = {MACHINE_CASINGS[this.mTier][(i + 1)]};
rTextures[0][(i + 1)] = tmp0;
- ITexture[] tmp1 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)], Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]};
+ ITexture[] tmp1 = {MACHINE_CASINGS[this.mTier][(i + 1)], OVERLAYS_ENERGY_IN[this.mTier]};
rTextures[1][(i + 1)] = tmp1;
- ITexture[] tmp2 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_LOCKER)};
+ ITexture[] tmp2 = {MACHINE_CASINGS[this.mTier][(i + 1)], TextureFactory.of(OVERLAY_LOCKER)};
rTextures[2][(i + 1)] = tmp2;
}
return rTextures;
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], Textures.BlockIcons.LOCKERS[Math.abs(this.mType % Textures.BlockIcons.LOCKERS.length)]};
+ return new ITexture[]{this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], LOCKERS[Math.abs(this.mType % LOCKERS.length)]};
}
return this.mTextures[0][(aColorIndex + 1)];
}
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_Locker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
}
+ @Override
public boolean isSimpleMachine() {
return false;
}
+ @Override
public boolean isElectric() {
return true;
}
+ @Override
public boolean isValidSlot(int aIndex) {
return true;
}
+ @Override
public boolean isFacingValid(byte aFacing) {
return aFacing > 1;
}
+ @Override
public boolean isEnetInput() {
return true;
}
+ @Override
public boolean isInputFacing(byte aSide) {
return aSide == getBaseMetaTileEntity().getBackFacing();
}
+ @Override
public boolean isTeleporterCompatible() {
return false;
}
+ @Override
public long maxEUStore() {
return gregtech.api.enums.GT_Values.V[this.mTier] * maxAmperesIn();
}
+ @Override
public long maxEUInput() {
return gregtech.api.enums.GT_Values.V[this.mTier];
}
+ @Override
public long maxAmperesIn() {
- return this.mInventory.length * 2;
+ return this.mInventory.length * 2L;
}
+ @Override
public int rechargerSlotStartIndex() {
return 0;
}
+ @Override
public int rechargerSlotCount() {
return getBaseMetaTileEntity().isAllowedToWork() ? this.mInventory.length : 0;
}
+ @Override
public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
+ @Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setByte("mType", this.mType);
}
+ @Override
public void loadNBTData(NBTTagCompound aNBT) {
this.mType = aNBT.getByte("mType");
}
+ @Override
public void onValueUpdate(byte aValue) {
this.mType = aValue;
}
+ @Override
public byte getUpdateData() {
return this.mType;
}
+ @Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
if (aIndex == 16) {
- GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(3)), 1, 1.0F);
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(3), 1, 1.0F);
}
}
+ @Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
this.mType = ((byte) (this.mType + 1));
}
}
+ @Override
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
return aSide != getBaseMetaTileEntity().getFrontFacing();
}
+ @Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
if ((aBaseMetaTileEntity.isServerSide()) && (aSide == aBaseMetaTileEntity.getFrontFacing())) {
for (int i = 0; i < 4; i++) {
@@ -157,10 +185,12 @@ public class GT_MetaTileEntity_Locker
return true;
}
+ @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
+ @Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
index 10a1a14bda..396b6d6464 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java
@@ -1,19 +1,38 @@
package gregtech.common.tileentities.storage;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
-public class GT_MetaTileEntity_QuantumTank
- extends GT_MetaTileEntity_BasicTank {
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW;
+
+public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank {
public GT_MetaTileEntity_QuantumTank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + CommonSizeCompute(aTier) + "L of fluid");
+ super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid");
+ }
+
+ private static int commonSizeCompute(int tier) {
+ switch (tier) {
+ case 6:
+ return 128000000;
+ case 7:
+ return 256000000;
+ case 8:
+ return 512000000;
+ case 9:
+ return 1024000000;
+ case 10:
+ return 2147483640;
+ default:
+ return 0;
+ }
}
public GT_MetaTileEntity_QuantumTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -30,96 +49,84 @@ public class GT_MetaTileEntity_QuantumTank
}
@Override
- 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_QTANK)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ public boolean isSimpleMachine() {
+ return true;
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
+ public boolean doesFillContainers() {
+ return true;
}
@Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- aBaseMetaTileEntity.openGUI(aPlayer);
+ public boolean doesEmptyContainers() {
return true;
}
@Override
- public boolean isSimpleMachine() {
+ public boolean canTankBeFilled() {
return true;
}
@Override
- public boolean isFacingValid(byte aFacing) {
+ public boolean canTankBeEmptied() {
return true;
}
@Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ public boolean displaysItemStack() {
return true;
}
@Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
+ public boolean displaysStackSize() {
+ return false;
}
@Override
- public final byte getUpdateData() {
- return 0x00;
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_QuantumTank(mName, mTier, mDescriptionArray, mTextures);
}
@Override
- public boolean doesFillContainers() {
- return true;
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ return new ITexture[]{
+ MACHINE_CASINGS[mTier][aColorIndex + 1],
+ TextureFactory.of(OVERLAY_QTANK),
+ TextureFactory.builder().addIcon(OVERLAY_QTANK_GLOW).glow().build()
+ };
}
@Override
- public boolean doesEmptyContainers() {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
@Override
- public boolean canTankBeFilled() {
- return true;
+ public final byte getUpdateData() {
+ return 0x00;
}
@Override
- public boolean canTankBeEmptied() {
+ public boolean isFacingValid(byte aFacing) {
return true;
}
@Override
- public boolean displaysItemStack() {
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
@Override
- public boolean displaysStackSize() {
- return false;
+ public int getTankPressure() {
+ return 100;
}
@Override
- public String[] getInfoData() {
-
- if (mFluid == null) {
- return new String[]{
- EnumChatFormatting.BLUE + "Quantum Tank"+ EnumChatFormatting.RESET,
- "Stored Fluid:",
- EnumChatFormatting.GOLD + "No Fluid"+ EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(0) + " L"+ EnumChatFormatting.RESET+" "+
- EnumChatFormatting.YELLOW + Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET
- };
- }
- return new String[]{
- EnumChatFormatting.BLUE + "Quantum Tank"+ EnumChatFormatting.RESET,
- "Stored Fluid:",
- EnumChatFormatting.GOLD + mFluid.getLocalizedName()+ EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L"+ EnumChatFormatting.RESET+" "+
- EnumChatFormatting.YELLOW+ Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET
- };
+ public int getCapacity() {
+ return commonSizeCompute(mTier);
}
@Override
@@ -128,35 +135,24 @@ public class GT_MetaTileEntity_QuantumTank
}
@Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_QuantumTank(mName, mTier, mDescriptionArray, mTextures);
- }
+ public String[] getInfoData() {
- private static int CommonSizeCompute(int tier){
- switch(tier){
- case 6:
- return 128000000;
- case 7:
- return 256000000;
- case 8:
- return 512000000;
- case 9:
- return 1024000000;
- case 10:
- return 2147483640;
- default:
- return 0;
+ if (mFluid == null) {
+ return new String[]{
+ EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET,
+ "Stored Fluid:",
+ EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET,
+ EnumChatFormatting.GREEN + Integer.toString(0) + " L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ };
}
- }
-
- @Override
- public int getCapacity() {
- return CommonSizeCompute(mTier);
- }
-
- @Override
- public int getTankPressure() {
- return 100;
+ return new String[]{
+ EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET,
+ "Stored Fluid:",
+ EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET,
+ EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ };
}
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java
index 3f53058f8d..e566ba9ed5 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java
@@ -20,20 +20,34 @@ public class GT_MetaTileEntity_SuperChest extends GT_MetaTileEntity_DigitalChest
public GT_MetaTileEntity_SuperChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
+
@Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_SuperChest(mName, mTier, mDescriptionArray, mTextures);
+ protected ItemStack getItemStack() {
+ return mItemStack;
}
+
@Override
- protected String chestName(){ return "Super Chest"; }
+ protected void setItemStack(ItemStack s) {
+ mItemStack = s;
+ }
+
@Override
- protected int getItemCount() { return mItemCount; }
+ protected int getItemCount() {
+ return mItemCount;
+ }
+
@Override
public void setItemCount(int aCount) {
mItemCount = aCount;
}
+
@Override
- protected ItemStack getItemStack(){ return mItemStack; }
+ protected String chestName() {
+ return "Super Chest";
+ }
+
@Override
- protected void setItemStack(ItemStack s){ mItemStack = s; }
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_SuperChest(mName, mTier, mDescriptionArray, mTextures);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
index a6e4d11599..41171720f5 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
@@ -1,19 +1,38 @@
package gregtech.common.tileentities.storage;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
-public class GT_MetaTileEntity_SuperTank
- extends GT_MetaTileEntity_BasicTank {
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW;
+
+public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank {
public GT_MetaTileEntity_SuperTank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + CommonSizeCompute(aTier) + "L of fluid");
+ super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid");
+ }
+
+ private static int commonSizeCompute(int tier) {
+ switch (tier) {
+ case 1:
+ return 4000000;
+ case 2:
+ return 8000000;
+ case 3:
+ return 16000000;
+ case 4:
+ return 32000000;
+ case 5:
+ return 64000000;
+ default:
+ return 0;
+ }
}
public GT_MetaTileEntity_SuperTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -30,96 +49,84 @@ public class GT_MetaTileEntity_SuperTank
}
@Override
- 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_STANK)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ public boolean isSimpleMachine() {
+ return true;
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
+ public boolean doesFillContainers() {
+ return true;
}
@Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- aBaseMetaTileEntity.openGUI(aPlayer);
+ public boolean doesEmptyContainers() {
return true;
}
@Override
- public boolean isSimpleMachine() {
+ public boolean canTankBeFilled() {
return true;
}
@Override
- public boolean isFacingValid(byte aFacing) {
+ public boolean canTankBeEmptied() {
return true;
}
@Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ public boolean displaysItemStack() {
return true;
}
@Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
+ public boolean displaysStackSize() {
+ return false;
}
@Override
- public final byte getUpdateData() {
- return 0x00;
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_SuperTank(mName, mTier, mDescription, mTextures);
}
@Override
- public boolean doesFillContainers() {
- return true;
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ return new ITexture[]{
+ MACHINE_CASINGS[mTier][aColorIndex + 1],
+ TextureFactory.of(OVERLAY_QTANK),
+ TextureFactory.builder().addIcon(OVERLAY_QTANK_GLOW).glow().build()
+ };
}
@Override
- public boolean doesEmptyContainers() {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
@Override
- public boolean canTankBeFilled() {
- return true;
+ public final byte getUpdateData() {
+ return 0x00;
}
@Override
- public boolean canTankBeEmptied() {
+ public boolean isFacingValid(byte aFacing) {
return true;
}
@Override
- public boolean displaysItemStack() {
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
@Override
- public boolean displaysStackSize() {
- return false;
+ public int getTankPressure() {
+ return 100;
}
@Override
- public String[] getInfoData() {
-
- if (mFluid == null) {
- return new String[]{
- EnumChatFormatting.BLUE + "Super Tank"+ EnumChatFormatting.RESET,
- "Stored Fluid:",
- EnumChatFormatting.GOLD + "No Fluid"+ EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(0) + " L"+ EnumChatFormatting.RESET+" "+
- EnumChatFormatting.YELLOW + Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET
- };
- }
- return new String[]{
- EnumChatFormatting.BLUE + "Super Tank"+ EnumChatFormatting.RESET,
- "Stored Fluid:",
- EnumChatFormatting.GOLD + mFluid.getLocalizedName()+ EnumChatFormatting.RESET,
- EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L"+ EnumChatFormatting.RESET+" "+
- EnumChatFormatting.YELLOW+ Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET
- };
+ public int getCapacity() {
+ return commonSizeCompute(mTier);
}
@Override
@@ -128,35 +135,24 @@ public class GT_MetaTileEntity_SuperTank
}
@Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_SuperTank(mName, mTier, mDescription, mTextures);
- }
+ public String[] getInfoData() {
- private static int CommonSizeCompute(int tier){
- switch(tier){
- case 1:
- return 4000000;
- case 2:
- return 8000000;
- case 3:
- return 16000000;
- case 4:
- return 32000000;
- case 5:
- return 64000000;
- default:
- return 0;
+ if (mFluid == null) {
+ return new String[]{
+ EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET,
+ "Stored Fluid:",
+ EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET,
+ EnumChatFormatting.GREEN + "0 L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ };
}
- }
-
- @Override
- public int getCapacity() {
- return CommonSizeCompute(mTier);
- }
-
- @Override
- public int getTankPressure() {
- return 100;
+ return new String[]{
+ EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET,
+ "Stored Fluid:",
+ EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET,
+ EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " +
+ EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET
+ };
}
}