diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
commit | cbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch) | |
tree | b85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation | |
parent | c40416b036c0e89451e1558253ccf07bbee028d0 (diff) | |
download | GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2 GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip |
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
Revert "% Cleaned up Imports."
This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation')
2 files changed, 704 insertions, 666 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index a1093d67d3..0338871482 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -1,14 +1,16 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; +import static gtPlusPlus.core.lib.CORE.sTesseractGenerators; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.*; +import gregtech.api.interfaces.tileentity.IDigitalChest; +import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; +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.util.GT_Config; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -20,486 +22,521 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; - -public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_BasicTank { - public static int TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; - public static int TESSERACT_ENERGY_COST = 1024; - public byte isWorking = 0; - public int oFrequency = 0; - public int mNeededEnergy = 0; - public int mFrequency = 0; - - public GT_MetaTileEntity_TesseractGenerator(final int aID, final String aName, final String aNameRegional, - final int aTier) { +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +public class GT_MetaTileEntity_TesseractGenerator +extends GT_MetaTileEntity_BasicTank +{ + public static int TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; + public static int TESSERACT_ENERGY_COST = 1024; + public byte isWorking = 0; + public int oFrequency = 0; + public int mNeededEnergy = 0; + public int mFrequency = 0; + + public GT_MetaTileEntity_TesseractGenerator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 3, ""); } - public GT_MetaTileEntity_TesseractGenerator(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_TesseractGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); - } + } - public boolean addEnergyConsumption(final GT_MetaTileEntity_TesseractTerminal aTerminal) { - if (!this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - this.mNeededEnergy += aTerminal.getBaseMetaTileEntity().getWorld() == this.getBaseMetaTileEntity().getWorld() - ? GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST - : GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST_DIMENSIONAL; - return true; - } - - public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractGenerator(mName, mTier, mDescription, mTextures); } @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { - return false; + public boolean isTransformerUpgradable() + { + return true; } @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { + public boolean isOverclockerUpgradable() + { return false; } @Override - public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canDrain(aSide, aFluid); + public boolean isSimpleMachine() + { + return false; } @Override - public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - if (tTileEntity instanceof ISidedInventory) { - return ((ISidedInventory) tTileEntity).canExtractItem(aIndex, aStack, aSide); - } + public boolean isFacingValid(byte aFacing) + { return true; } @Override - public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canFill(aSide, aFluid); - } - - @Override - public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - if (tTileEntity instanceof ISidedInventory) { - return ((ISidedInventory) tTileEntity).canInsertItem(aIndex, aStack, aSide); - } + public boolean isEnetInput() + { return true; } @Override - public boolean canTankBeEmptied() { + public boolean isEnetOutput() + { return false; } @Override - public boolean canTankBeFilled() { - return false; + public boolean isInputFacing(byte aSide) + { + return true; } @Override - public ItemStack decrStackSize(final int aIndex, final int aAmount) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.decrStackSize(aIndex, aAmount); + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean displaysItemStack() { + public boolean isValidSlot(int aIndex) + { return false; } @Override - public boolean displaysStackSize() { - return false; + public long getMinimumStoredEU() + { + return getBaseMetaTileEntity().getEUCapacity() / 2; } @Override - public boolean doesEmptyContainers() { - return false; + public long maxEUInput() + { + return 2048; } - // To-Do? @Override - public boolean doesFillContainers() { - return false; + public long maxEUOutput() + { + return 0; } @Override - public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.drain(aSide, aFluid, doDrain); + public long maxEUStore() + { + return 100000; } @Override - public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.drain(aDirection, maxDrain, doDrain); + public long maxSteamStore() + { + return maxEUStore(); } @Override - public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; - } - return tTileEntity.fill(aDirection, aFluid, doFill); + public boolean isAccessAllowed(EntityPlayer aPlayer) + { + return true; } @Override - public int[] getAccessibleSlotsFromSide(final int aSide) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return new int[0]; - } - if (tTileEntity instanceof ISidedInventory) { - return ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(aSide); - } - final int[] rArray = new int[this.getSizeInventory()]; - for (int i = 0; i < this.getSizeInventory(); i++) { - rArray[i] = i; - } - return rArray; + public boolean ownerControl() + { + return true; } @Override - public String[] getDescription() { - return new String[] { - "Generates a Tesseract for the attached Inventory" - }; + public int getProgresstime() + { + return (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? 999 : 0; } @Override - public String[] getInfoData() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IGregTechDeviceInformation - && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { - return ((IGregTechDeviceInformation) tTileEntity).getInfoData(); - } - return new String[] { - "Tesseract Generator", "Freqency:", "" + this.mFrequency, - CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this && this.isWorking >= 20 - ? "Active" : "Inactive" - }; + public int maxProgresstime() + { + return 1000; } @Override - public String getInventoryName() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return ""; - } - return tTileEntity.getInventoryName(); + public void saveNBTData(NBTTagCompound aNBT) + { + aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public int getInventoryStackLimit() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; - } - return tTileEntity.getInventoryStackLimit(); + public void loadNBTData(NBTTagCompound aNBT) + { + this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public int getMaxItemCount() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IDigitalChest) { - return ((IDigitalChest) tTileEntity).getMaxItemCount(); - } - return 0; + public void onConfigLoad(GT_Config aConfig) + { + TESSERACT_ENERGY_COST = 1024; + TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; } @Override - public long getMinimumStoredEU() { - return this.getBaseMetaTileEntity().getEUCapacity() / 2; + public void onServerStart() + { + sTesseractGenerators.clear(); } - @Override - public int getProgresstime() { - return CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this && this.isWorking >= 20 ? 999 - : 0; + public void onServerStop() + { + sTesseractGenerators.clear(); } - + @Override - public int getSizeInventory() { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; - } - return tTileEntity.getSizeInventory(); + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ){ + if (aSide == getBaseMetaTileEntity().getFrontFacing()){ + float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))){ + case 0: + Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); + this.mFrequency -= 1; + break; + case 1: + Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); + this.mFrequency += 1; + default: + //Utils.LOG_INFO("Did not click the correct place."); + break; + } + PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); + PlayerUtils.messagePlayer(aPlayer, ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : "")); + } + return true; } @Override - public ItemStack getStackInSlot(final int aIndex) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + { + if (aSide == getBaseMetaTileEntity().getFrontFacing()) + { + float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) + { + case 0: + this.mFrequency -= 64; + break; + case 1: + this.mFrequency += 64; + break; + case 2: + this.mFrequency -= 512; + break; + case 3: + this.mFrequency += 512; + } + GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : "")); } - return tTileEntity.getStackInSlot(aIndex); } - @Override - public ItemStack[] getStoredItemData() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IDigitalChest) { - return ((IDigitalChest) tTileEntity).getStoredItemData(); - } - return null; + public boolean allowCoverOnSide(byte aSide, int aCoverID) + { + return aSide != getBaseMetaTileEntity().getFrontFacing(); } @Override - public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - final IFluidHandler tTileEntity = this.getBaseMetaTileEntity() - .getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return new FluidTankInfo[0]; + public String[] getInfoData() + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) { + return ((IGregTechDeviceInformation)tTileEntity).getInfoData(); } - return tTileEntity.getTankInfo(aSide); + return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? "Active" : "Inactive" }; } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - return aSide == aFacing ? new ITexture[] { - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) - } : new ITexture[] { - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(Textures.BlockIcons.VOID) - }; + public boolean isGivingInformation() + { + return true; } - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - return new ITexture[0][0][0]; + public boolean isSendingInformation() + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { + return ((IGregTechDeviceInformation)tTileEntity).isGivingInformation(); + } + return false; } @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; + public boolean isDigitalChest() + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + return ((IDigitalChest)tTileEntity).isDigitalChest(); + } + return false; } @Override - public boolean isDigitalChest() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IDigitalChest) { - return ((IDigitalChest) tTileEntity).isDigitalChest(); + public ItemStack[] getStoredItemData() + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + return ((IDigitalChest)tTileEntity).getStoredItemData(); } - return false; + return null; } @Override - public boolean isEnetInput() { - return true; + public void setItemCount(int aCount) + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + ((IDigitalChest)tTileEntity).setItemCount(aCount); + } } @Override - public boolean isEnetOutput() { - return false; + public int getMaxItemCount() + { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + return ((IDigitalChest)tTileEntity).getMaxItemCount(); + } + return 0; } @Override - public boolean isFacingValid(final byte aFacing) { - return true; + public boolean isItemValidForSlot(int aIndex, ItemStack aStack) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; + } + return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public boolean isGivingInformation() { - return true; + public int[] getAccessibleSlotsFromSide(int aSide) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return new int[0]; + } + if ((tTileEntity instanceof ISidedInventory)) { + return ((ISidedInventory)tTileEntity).getAccessibleSlotsFromSide(aSide); + } + int[] rArray = new int[getSizeInventory()]; + for (int i = 0; i < getSizeInventory(); i++) { + rArray[i] = i; + } + return rArray; } @Override - public boolean isInputFacing(final byte aSide) { + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; + } + if ((tTileEntity instanceof ISidedInventory)) { + return ((ISidedInventory)tTileEntity).canInsertItem(aIndex, aStack, aSide); + } return true; } @Override - public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { return false; } - return tTileEntity.isItemValidForSlot(aIndex, aStack); + if ((tTileEntity instanceof ISidedInventory)) { + return ((ISidedInventory)tTileEntity).canExtractItem(aIndex, aStack, aSide); + } + return true; } @Override - public boolean isOutputFacing(final byte aSide) { - return aSide == this.getBaseMetaTileEntity().getBackFacing(); + public int getSizeInventory() + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.getSizeInventory(); } @Override - public boolean isOverclockerUpgradable() { - return false; - } - - public boolean isSendingInformation() { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IGregTechDeviceInformation) { - return ((IGregTechDeviceInformation) tTileEntity).isGivingInformation(); + public ItemStack getStackInSlot(int aIndex) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; } - return false; + return tTileEntity.getStackInSlot(aIndex); } @Override - public boolean isSimpleMachine() { - return false; + public void setInventorySlotContents(int aIndex, ItemStack aStack) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return; + } + tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public boolean isTransformerUpgradable() { - return true; + public ItemStack decrStackSize(int aIndex, int aAmount) + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.decrStackSize(aIndex, aAmount); } @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - public boolean isValidTesseractGenerator(final String aOwnerName, final boolean aWorkIrrelevant) { - return this.getBaseMetaTileEntity() != null && !this.getBaseMetaTileEntity().isInvalidTileEntity() - && this.getBaseMetaTileEntity().isAllowedToWork() - && (aOwnerName == null || this.getBaseMetaTileEntity().getOwnerName().equals(aOwnerName)) - && (aWorkIrrelevant || this.isWorking >= 20); + public String getInventoryName() + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return ""; + } + return tTileEntity.getInventoryName(); } @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mFrequency = aNBT.getInteger("mFrequency"); + public int getInventoryStackLimit() + { + IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.getInventoryStackLimit(); } @Override - public long maxEUInput() { - return 2048; + public boolean canFill(ForgeDirection aSide, Fluid aFluid) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; + } + return tTileEntity.canFill(aSide, aFluid); } @Override - public long maxEUOutput() { - return 0; + public boolean canDrain(ForgeDirection aSide, Fluid aFluid) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; + } + return tTileEntity.canDrain(aSide, aFluid); } @Override - public long maxEUStore() { - return 100000; + public FluidTankInfo[] getTankInfo(ForgeDirection aSide) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return new FluidTankInfo[0]; + } + return tTileEntity.getTankInfo(aSide); } @Override - public int maxProgresstime() { - return 1000; + public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.fill(aDirection, aFluid, doFill); } @Override - public long maxSteamStore() { - return this.maxEUStore(); + public FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.drain(aDirection, maxDrain, doDrain); } @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); + public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + { + IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.drain(aSide, aFluid, doDrain); } - @Override - public void onConfigLoad(final GT_Config aConfig) { - GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST = 1024; - GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; + public boolean addEnergyConsumption(GT_MetaTileEntity_TesseractTerminal aTerminal) + { + if (!getBaseMetaTileEntity().isAllowedToWork()) { + return false; + } + this.mNeededEnergy += (aTerminal.getBaseMetaTileEntity().getWorld() == getBaseMetaTileEntity().getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); + return true; } - public void onPostTick() { - if (this.getBaseMetaTileEntity().isServerSide()) { - if (this.mFrequency != this.oFrequency) { + public boolean isValidTesseractGenerator(String aOwnerName, boolean aWorkIrrelevant) + { + return (getBaseMetaTileEntity() != null) && (!getBaseMetaTileEntity().isInvalidTileEntity()) && (getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20)); + } + public void onPostTick() + { + if (getBaseMetaTileEntity().isServerSide()){ + if (this.mFrequency != this.oFrequency){ + Utils.LOG_INFO("mFreq != oFreq"); - - if (CORE.sTesseractGenerators.get(Integer.valueOf(this.oFrequency)) == this) { - CORE.sTesseractGenerators.remove(Integer.valueOf(this.oFrequency)); - this.getBaseMetaTileEntity().issueBlockUpdate(); + + if (sTesseractGenerators.get(Integer.valueOf(this.oFrequency)) == this) + { + sTesseractGenerators.remove(Integer.valueOf(this.oFrequency)); + getBaseMetaTileEntity().issueBlockUpdate(); Utils.LOG_INFO("this Gen == oFreq on map - do block update"); } Utils.LOG_INFO("mFreq will be set to oFreq"); this.oFrequency = this.mFrequency; } - if (this.getBaseMetaTileEntity().isAllowedToWork() - && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false)) { + if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false))) + { Utils.LOG_INFO("Can Work & Has Energy"); - if (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null - || !CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) - .isValidTesseractGenerator(null, true)) { + if ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null) || (!((GT_MetaTileEntity_TesseractGenerator)sTesseractGenerators.get(Integer.valueOf(this.mFrequency))).isValidTesseractGenerator(null, true))) { Utils.LOG_INFO("storing TE I think to mFreq map?"); - CORE.sTesseractGenerators.put(Integer.valueOf(this.mFrequency), this); + sTesseractGenerators.put(Integer.valueOf(this.mFrequency), this); } } - else { - if (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) { + else + { + if (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) + { Utils.LOG_INFO("this gen == mFreq on map - do block update"); - CORE.sTesseractGenerators.remove(Integer.valueOf(this.mFrequency)); - this.getBaseMetaTileEntity().issueBlockUpdate(); + sTesseractGenerators.remove(Integer.valueOf(this.mFrequency)); + getBaseMetaTileEntity().issueBlockUpdate(); } this.isWorking = 0; } - if (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) { + if (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) + { Utils.LOG_INFO("mFreq == this - do work related things"); if (this.isWorking < 20) { - this.isWorking = (byte) (this.isWorking + 1); + this.isWorking = ((byte)(this.isWorking + 1)); } - if (this.isWorking == 20) { - this.getBaseMetaTileEntity().issueBlockUpdate(); - this.isWorking = (byte) (this.isWorking + 1); + if (this.isWorking == 20) + { + getBaseMetaTileEntity().issueBlockUpdate(); + this.isWorking = ((byte)(this.isWorking + 1)); } } - else { + else + { this.isWorking = 0; } this.mNeededEnergy = 0; @@ -507,93 +544,60 @@ public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_Basi } @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, - final byte aSide, final float aX, final float aY, final float aZ) { - if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + 2 * (byte) (int) (tCoords[1] * 2.0F))) { - case 0: - Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); - this.mFrequency -= 1; - break; - case 1: - Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); - this.mFrequency += 1; - default: - // Utils.LOG_INFO("Did not click the correct place."); - break; - } - PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); - PlayerUtils.messagePlayer(aPlayer, - CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null - && CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this - ? EnumChatFormatting.RED + " (Occupied)" : ""); - } - return true; + public String[] getDescription() + { + return new String[] {"Generates a Tesseract for the attached Inventory"}; } @Override - public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, - final float aZ) { - if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + 2 * (byte) (int) (tCoords[1] * 2.0F))) { - case 0: - this.mFrequency -= 64; - break; - case 1: - this.mFrequency += 64; - break; - case 2: - this.mFrequency -= 512; - break; - case 3: - this.mFrequency += 512; - } - GT_Utility.sendChatToPlayer(aPlayer, - "Frequency: " + this.mFrequency - + (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null - && CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this - ? EnumChatFormatting.RED + " (Occupied)" : "")); - } + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; } @Override - public void onServerStart() { - CORE.sTesseractGenerators.clear(); + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; } - public void onServerStop() { - CORE.sTesseractGenerators.clear(); + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; } @Override - public boolean ownerControl() { - return true; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return aSide == aFacing ? new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency)} : new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; } + + //To-Do? @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mFrequency", this.mFrequency); + public boolean doesFillContainers() { + return false; } @Override - public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - final IInventory tTileEntity = this.getBaseMetaTileEntity() - .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return; - } - tTileEntity.setInventorySlotContents(aIndex, aStack); + public boolean doesEmptyContainers() { + return false; } @Override - public void setItemCount(final int aCount) { - final TileEntity tTileEntity = this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity instanceof IDigitalChest) { - ((IDigitalChest) tTileEntity).setItemCount(aCount); - } + public boolean canTankBeFilled() { + return false; + } + + @Override + public boolean canTankBeEmptied() { + return false; + } + + @Override + public boolean displaysItemStack() { + return false; + } + + @Override + public boolean displaysStackSize() { + return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index 9a1a89cf47..aa8ddad326 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -17,478 +17,512 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; - -public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_BasicTank { - public static boolean sInterDimensionalTesseractAllowed = true; - public int mFrequency = 0; - public boolean mDidWork = false; - - public GT_MetaTileEntity_TesseractTerminal(final int aID, final String aName, final String aNameRegional, - final int aTier) { +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + +public class GT_MetaTileEntity_TesseractTerminal +extends GT_MetaTileEntity_BasicTank +{ + public int mFrequency = 0; + public boolean mDidWork = false; + public static boolean sInterDimensionalTesseractAllowed = true; + + public GT_MetaTileEntity_TesseractTerminal(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 3, ""); } - public GT_MetaTileEntity_TesseractTerminal(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_TesseractTerminal(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); - } + } - public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractTerminal(mName, mTier, mDescription, mTextures); } @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { + public boolean isTransformerUpgradable() + { return false; } @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { + public boolean isOverclockerUpgradable() + { return false; } @Override - public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canDrain(aSide, aFluid); + public boolean isSimpleMachine() + { + return false; } @Override - public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canExtractItem(aIndex, aStack, aSide); + public boolean isFacingValid(byte aFacing) + { + return true; } - + @Override - public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canFill(aSide, aFluid); + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; - } - return tTileEntity.canInsertItem(aIndex, aStack, aSide); + public boolean isValidSlot(int aIndex) + { + return false; } - + @Override - public boolean canTankBeEmptied() { - return false; + public long getMinimumStoredEU() + { + return getBaseMetaTileEntity().getEUCapacity() / 2; } @Override - public boolean canTankBeFilled() { - return false; + public long maxEUInput() + { + return 2048; } @Override - public ItemStack decrStackSize(final int aIndex, final int aAmount) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.decrStackSize(aIndex, aAmount); + public boolean isAccessAllowed(EntityPlayer aPlayer) + { + return true; } - + @Override - public boolean displaysItemStack() { - return false; + public long maxEUStore() + { + return 100000; } @Override - public boolean displaysStackSize() { - return false; + public long maxSteamStore() + { + return maxEUStore(); } @Override - public boolean doesEmptyContainers() { - return false; + public boolean ownerControl() + { + return true; } - // To-Do? @Override - public boolean doesFillContainers() { - return false; + public int getProgresstime() + { + return getTesseract(this.mFrequency, false) != null ? 999 : 0; } @Override - public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.drain(aSide, aFluid, doDrain); + public int maxProgresstime() + { + return 1000; } @Override - public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; - } - return tTileEntity.drain(aDirection, maxDrain, doDrain); + public void saveNBTData(NBTTagCompound aNBT) + { + aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; - } - return tTileEntity.fill(aDirection, aFluid, doFill); + public void loadNBTData(NBTTagCompound aNBT) + { + this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public int[] getAccessibleSlotsFromSide(final int aSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return new int[0]; - } - return tTileEntity.getAccessibleSlotsFromSide(aSide); + public void onConfigLoad(GT_Config aConfig) + { + sInterDimensionalTesseractAllowed = true; } - /* - * public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, - * float aY, float aZ) { if (aSide == - * getBaseMetaTileEntity().getFrontFacing()) { float[] tCoords = - * GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); switch - * ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * - * 2.0F))) { case 0: this.mFrequency -= 1; break; case 1: this.mFrequency += - * 1; } GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency - * + (getTesseract(this.mFrequency, false) == null ? "" : new - * StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)" - * ).toString())); } return true; } - */ + /*public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) + { + if (aSide == getBaseMetaTileEntity().getFrontFacing()) + { + float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) + { + case 0: + this.mFrequency -= 1; + break; + case 1: + this.mFrequency += 1; + } + GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + } + return true; + }*/ + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ){ + if (aSide == getBaseMetaTileEntity().getFrontFacing()){ + float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))){ + case 0: + Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); + this.mFrequency -= 1; + break; + case 1: + Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); + this.mFrequency += 1; + default: + //Utils.LOG_INFO("Did not click the correct place."); + break; + } + PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); + PlayerUtils.messagePlayer(aPlayer, (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + } + return true; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + { + if (aSide == getBaseMetaTileEntity().getFrontFacing()) + { + float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) + { + case 0: + this.mFrequency -= 64; + break; + case 1: + this.mFrequency += 64; + break; + case 2: + this.mFrequency -= 512; + break; + case 3: + this.mFrequency += 512; + } + GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + } + } - @Override - public String[] getDescription() { - return new String[] { - "Accesses Tesseracts remotely" - }; + public boolean allowCoverOnSide(byte aSide, int aCoverID) + { + return aSide != getBaseMetaTileEntity().getFrontFacing(); } - @Override - public String[] getInfoData() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork() - && tTileEntity.isSendingInformation()) { - return tTileEntity.getInfoData(); + public GT_MetaTileEntity_TesseractGenerator getTesseract(int aFrequency, boolean aWorkIrrelevant) + { + GT_MetaTileEntity_TesseractGenerator rTesseract = (GT_MetaTileEntity_TesseractGenerator)CORE.sTesseractGenerators.get(Integer.valueOf(aFrequency)); + if (rTesseract == null) { + return null; + } + if (rTesseract.mFrequency != aFrequency) + { + CORE.sTesseractGenerators.put(Integer.valueOf(aFrequency), null);return null; } - return new String[] { - "Tesseract Generator", "Freqency:", "" + this.mFrequency, - this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" - }; + if (!rTesseract.isValidTesseractGenerator(getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { + return null; + } + if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != getBaseMetaTileEntity().getWorld())) { + return null; + } + return rTesseract; } @Override - public String getInventoryName() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return ""; + public String[] getInfoData() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) { + return tTileEntity.getInfoData(); } - return tTileEntity.getInventoryName(); + return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; } @Override - public int getInventoryStackLimit() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; - } - return tTileEntity.getInventoryStackLimit(); + public boolean isGivingInformation() + { + return true; } @Override - public int getMaxItemCount() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return 0; + public boolean isDigitalChest() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; } - return tTileEntity.getMaxItemCount(); + return tTileEntity.isDigitalChest(); } @Override - public long getMinimumStoredEU() { - return this.getBaseMetaTileEntity().getEUCapacity() / 2; + public ItemStack[] getStoredItemData() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.getStoredItemData(); } @Override - public int getProgresstime() { - return this.getTesseract(this.mFrequency, false) != null ? 999 : 0; + public void setItemCount(int aCount) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return; + } + tTileEntity.setItemCount(aCount); } @Override - public int getSizeInventory() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { + public int getMaxItemCount() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { return 0; } - return tTileEntity.getSizeInventory(); + return tTileEntity.getMaxItemCount(); } @Override - public ItemStack getStackInSlot(final int aIndex) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; + public boolean isItemValidForSlot(int aIndex, ItemStack aStack) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; } - return tTileEntity.getStackInSlot(aIndex); + return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public ItemStack[] getStoredItemData() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return null; + public int[] getAccessibleSlotsFromSide(int aSide) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return new int[0]; } - return tTileEntity.getStoredItemData(); + return tTileEntity.getAccessibleSlotsFromSide(aSide); } @Override - public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return new FluidTankInfo[0]; + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; } - return tTileEntity.getTankInfo(aSide); + return tTileEntity.canInsertItem(aIndex, aStack, aSide); } - public GT_MetaTileEntity_TesseractGenerator getTesseract(final int aFrequency, final boolean aWorkIrrelevant) { - final GT_MetaTileEntity_TesseractGenerator rTesseract = CORE.sTesseractGenerators - .get(Integer.valueOf(aFrequency)); - if (rTesseract == null) { - return null; - } - if (rTesseract.mFrequency != aFrequency) { - CORE.sTesseractGenerators.put(Integer.valueOf(aFrequency), null); - return null; - } - if (!rTesseract.isValidTesseractGenerator(this.getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { - return null; - } - if (!GT_MetaTileEntity_TesseractTerminal.sInterDimensionalTesseractAllowed - && rTesseract.getBaseMetaTileEntity().getWorld() != this.getBaseMetaTileEntity().getWorld()) { - return null; + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; } - return rTesseract; + return tTileEntity.canExtractItem(aIndex, aStack, aSide); } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - return aSide == aFacing ? new ITexture[] { - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency) - } : new ITexture[] { - new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), - new GT_RenderedTexture(Textures.BlockIcons.VOID) - }; + public int getSizeInventory() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.getSizeInventory(); } @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - return new ITexture[0][0][0]; + public ItemStack getStackInSlot(int aIndex) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.getStackInSlot(aIndex); } @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; + public void setInventorySlotContents(int aIndex, ItemStack aStack) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return; + } + tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public boolean isDigitalChest() { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return false; + public ItemStack decrStackSize(int aIndex, int aAmount) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; } - return tTileEntity.isDigitalChest(); + return tTileEntity.decrStackSize(aIndex, aAmount); } @Override - public boolean isFacingValid(final byte aFacing) { - return true; + public String getInventoryName() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return ""; + } + return tTileEntity.getInventoryName(); } @Override - public boolean isGivingInformation() { - return true; + public int getInventoryStackLimit() + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.getInventoryStackLimit(); } @Override - public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { + public boolean canFill(ForgeDirection aSide, Fluid aFluid) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { return false; } - return tTileEntity.isItemValidForSlot(aIndex, aStack); - } - - @Override - public boolean isOutputFacing(final byte aSide) { - return aSide == this.getBaseMetaTileEntity().getBackFacing(); + return tTileEntity.canFill(aSide, aFluid); } @Override - public boolean isOverclockerUpgradable() { - return false; + public boolean canDrain(ForgeDirection aSide, Fluid aFluid) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return false; + } + return tTileEntity.canDrain(aSide, aFluid); } @Override - public boolean isSimpleMachine() { - return false; + public FluidTankInfo[] getTankInfo(ForgeDirection aSide) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return new FluidTankInfo[0]; + } + return tTileEntity.getTankInfo(aSide); } @Override - public boolean isTransformerUpgradable() { - return false; + public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return 0; + } + return tTileEntity.fill(aDirection, aFluid, doFill); } @Override - public boolean isValidSlot(final int aIndex) { - return false; + public FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.drain(aDirection, maxDrain, doDrain); } @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mFrequency = aNBT.getInteger("mFrequency"); + public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + return null; + } + return tTileEntity.drain(aSide, aFluid, doDrain); } - @Override - public long maxEUInput() { - return 2048; + public void onPostTick() + { + if ((getBaseMetaTileEntity().isServerSide()) && (getBaseMetaTileEntity().isAllowedToWork())) + { + GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, true); + if (tTileEntity != null) + { + tTileEntity.addEnergyConsumption(this); + if ((!this.mDidWork) && (getTesseract(this.mFrequency, false) != null)) + { + this.mDidWork = true; + getBaseMetaTileEntity().issueBlockUpdate(); + } + } + else if (this.mDidWork == true) + { + this.mDidWork = false; + getBaseMetaTileEntity().issueBlockUpdate(); + } + } } @Override - public long maxEUStore() { - return 100000; + public String[] getDescription() + { + return new String[] {"Accesses Tesseracts remotely"}; } @Override - public int maxProgresstime() { - return 1000; + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; } @Override - public long maxSteamStore() { - return this.maxEUStore(); + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; } @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescription, this.mTextures); + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; } @Override - public void onConfigLoad(final GT_Config aConfig) { - GT_MetaTileEntity_TesseractTerminal.sInterDimensionalTesseractAllowed = true; - } - - public void onPostTick() { - if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, true); - if (tTileEntity != null) { - tTileEntity.addEnergyConsumption(this); - if (!this.mDidWork && this.getTesseract(this.mFrequency, false) != null) { - this.mDidWork = true; - this.getBaseMetaTileEntity().issueBlockUpdate(); - } - } - else if (this.mDidWork == true) { - this.mDidWork = false; - this.getBaseMetaTileEntity().issueBlockUpdate(); - } - } + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return aSide == aFacing ? new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency)} : new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; } + //To-Do? @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, - final byte aSide, final float aX, final float aY, final float aZ) { - if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + 2 * (byte) (int) (tCoords[1] * 2.0F))) { - case 0: - Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); - this.mFrequency -= 1; - break; - case 1: - Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); - this.mFrequency += 1; - default: - // Utils.LOG_INFO("Did not click the correct place."); - break; - } - PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); - PlayerUtils.messagePlayer(aPlayer, this.getTesseract(this.mFrequency, false) == null ? "" - : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString()); - } - return true; + public boolean doesFillContainers() { + return false; } @Override - public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, - final float aZ) { - if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + 2 * (byte) (int) (tCoords[1] * 2.0F))) { - case 0: - this.mFrequency -= 64; - break; - case 1: - this.mFrequency += 64; - break; - case 2: - this.mFrequency -= 512; - break; - case 3: - this.mFrequency += 512; - } - GT_Utility.sendChatToPlayer(aPlayer, - "Frequency: " + this.mFrequency + (this.getTesseract(this.mFrequency, false) == null ? "" - : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); - } + public boolean doesEmptyContainers() { + return false; } @Override - public boolean ownerControl() { - return true; + public boolean canTankBeFilled() { + return false; } @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mFrequency", this.mFrequency); + public boolean canTankBeEmptied() { + return false; } @Override - public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return; - } - tTileEntity.setInventorySlotContents(aIndex, aStack); + public boolean displaysItemStack() { + return false; } @Override - public void setItemCount(final int aCount) { - final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); - if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) { - return; - } - tTileEntity.setItemCount(aCount); + public boolean displaysStackSize() { + return false; } } |