aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
commit0669f5eb9d5029a8b94ec552171b0837605f7747 (patch)
tree6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation
parent3654052fb63a571c5eaca7f20714b87c17f7e966 (diff)
downloadGT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java726
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java628
2 files changed, 661 insertions, 693 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 56f6a8d4f9..a1093d67d3 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,7 +1,5 @@
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.*;
@@ -10,6 +8,7 @@ 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;
@@ -23,516 +22,484 @@ 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(int aID, String aName, String aNameRegional, int aTier) {
+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) {
super(aID, aName, aNameRegional, aTier, 3, "");
}
- public GT_MetaTileEntity_TesseractGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_TesseractGenerator(final String aName, final int aTier, final String aDescription,
+ final ITexture[][][] aTextures) {
super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_TesseractGenerator(mName, mTier, mDescription, mTextures);
}
- @Override
- public boolean isTransformerUpgradable()
- {
+ 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 boolean isOverclockerUpgradable()
- {
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean isSimpleMachine()
- {
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean isFacingValid(byte aFacing)
- {
- return true;
+ 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);
}
@Override
- public boolean isEnetInput()
- {
+ 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);
+ }
return true;
}
@Override
- public boolean isEnetOutput()
- {
- return false;
+ 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 isInputFacing(byte aSide)
- {
+ 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);
+ }
return true;
}
@Override
- public boolean isOutputFacing(byte aSide) {
- return aSide == getBaseMetaTileEntity().getBackFacing();
+ public boolean canTankBeEmptied() {
+ return false;
}
@Override
- public boolean isValidSlot(int aIndex)
- {
+ public boolean canTankBeFilled() {
return false;
}
@Override
- public long getMinimumStoredEU()
- {
- return getBaseMetaTileEntity().getEUCapacity() / 2;
+ 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);
}
@Override
- public long maxEUInput()
- {
- return 2048;
+ public boolean displaysItemStack() {
+ return false;
}
@Override
- public long maxEUOutput()
- {
- return 0;
+ public boolean displaysStackSize() {
+ return false;
}
@Override
- public long maxEUStore()
- {
- return 100000;
+ public boolean doesEmptyContainers() {
+ return false;
}
+ // To-Do?
@Override
- public long maxSteamStore()
- {
- return maxEUStore();
+ public boolean doesFillContainers() {
+ return false;
}
@Override
- public boolean isAccessAllowed(EntityPlayer aPlayer)
- {
- return true;
+ 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);
}
@Override
- public boolean ownerControl()
- {
- return true;
+ 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);
}
@Override
- public int getProgresstime()
- {
- return (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? 999 : 0;
+ 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);
}
@Override
- public int maxProgresstime()
- {
- return 1000;
+ 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;
}
@Override
- public void saveNBTData(NBTTagCompound aNBT)
- {
- aNBT.setInteger("mFrequency", this.mFrequency);
+ public String[] getDescription() {
+ return new String[] {
+ "Generates a Tesseract for the attached Inventory"
+ };
}
@Override
- public void loadNBTData(NBTTagCompound aNBT)
- {
- this.mFrequency = aNBT.getInteger("mFrequency");
+ 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"
+ };
}
@Override
- public void onConfigLoad(GT_Config aConfig)
- {
- TESSERACT_ENERGY_COST = 1024;
- TESSERACT_ENERGY_COST_DIMENSIONAL = 2048;
+ public String getInventoryName() {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return "";
+ }
+ return tTileEntity.getInventoryName();
}
@Override
- public void onServerStart()
- {
- sTesseractGenerators.clear();
+ 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 onServerStop()
- {
- sTesseractGenerators.clear();
- }
-
@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, ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : ""));
- }
- return true;
+ 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;
}
@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 + ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : ""));
- }
+ public long getMinimumStoredEU() {
+ return this.getBaseMetaTileEntity().getEUCapacity() / 2;
}
- public boolean allowCoverOnSide(byte aSide, int aCoverID)
- {
- return aSide != getBaseMetaTileEntity().getFrontFacing();
+ @Override
+ public int getProgresstime() {
+ return CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this && this.isWorking >= 20 ? 999
+ : 0;
}
@Override
- public String[] getInfoData()
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) {
- return ((IGregTechDeviceInformation)tTileEntity).getInfoData();
+ public int getSizeInventory() {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return 0;
}
- return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? "Active" : "Inactive" };
+ return tTileEntity.getSizeInventory();
}
@Override
- public boolean isGivingInformation()
- {
- return true;
+ public ItemStack getStackInSlot(final int aIndex) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return null;
+ }
+ return tTileEntity.getStackInSlot(aIndex);
}
- public boolean isSendingInformation()
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) {
- return ((IGregTechDeviceInformation)tTileEntity).isGivingInformation();
+ @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 false;
+ return null;
}
@Override
- public boolean isDigitalChest()
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) {
- return ((IDigitalChest)tTileEntity).isDigitalChest();
+ 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];
}
- return false;
+ return tTileEntity.getTankInfo(aSide);
}
@Override
- public ItemStack[] getStoredItemData()
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) {
- return ((IDigitalChest)tTileEntity).getStoredItemData();
- }
- return null;
+ 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)
+ };
}
@Override
- public void setItemCount(int aCount)
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) {
- ((IDigitalChest)tTileEntity).setItemCount(aCount);
- }
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ return new ITexture[0][0][0];
}
@Override
- public int getMaxItemCount()
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) {
- return ((IDigitalChest)tTileEntity).getMaxItemCount();
- }
- return 0;
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
}
@Override
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack)
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return false;
+ 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();
}
- return tTileEntity.isItemValidForSlot(aIndex, aStack);
+ return false;
}
@Override
- 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;
+ public boolean isEnetInput() {
+ return true;
}
@Override
- 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);
- }
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
return true;
}
@Override
- public boolean canExtractItem(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).canExtractItem(aIndex, aStack, aSide);
- }
+ public boolean isGivingInformation() {
return true;
}
@Override
- public int getSizeInventory()
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return 0;
- }
- return tTileEntity.getSizeInventory();
+ public boolean isInputFacing(final byte aSide) {
+ return true;
}
@Override
- public ItemStack getStackInSlot(int aIndex)
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return null;
+ public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) {
+ final IInventory tTileEntity = this.getBaseMetaTileEntity()
+ .getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return false;
}
- return tTileEntity.getStackInSlot(aIndex);
+ return tTileEntity.isItemValidForSlot(aIndex, aStack);
}
@Override
- public void setInventorySlotContents(int aIndex, ItemStack aStack)
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return;
- }
- tTileEntity.setInventorySlotContents(aIndex, aStack);
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
}
@Override
- public ItemStack decrStackSize(int aIndex, int aAmount)
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return null;
+ 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();
}
- return tTileEntity.decrStackSize(aIndex, aAmount);
+ return false;
}
@Override
- public String getInventoryName()
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return "";
- }
- return tTileEntity.getInventoryName();
+ public boolean isSimpleMachine() {
+ return false;
}
@Override
- public int getInventoryStackLimit()
- {
- IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return 0;
- }
- return tTileEntity.getInventoryStackLimit();
+ public boolean isTransformerUpgradable() {
+ return true;
}
@Override
- 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);
+ 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);
}
@Override
- 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);
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mFrequency = aNBT.getInteger("mFrequency");
}
@Override
- public FluidTankInfo[] getTankInfo(ForgeDirection aSide)
- {
- IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing());
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return new FluidTankInfo[0];
- }
- return tTileEntity.getTankInfo(aSide);
+ public long maxEUInput() {
+ return 2048;
}
@Override
- 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);
+ public long maxEUOutput() {
+ return 0;
}
@Override
- 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);
+ public long maxEUStore() {
+ return 100000;
}
@Override
- 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);
+ public int maxProgresstime() {
+ return 1000;
}
- 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;
+ @Override
+ public long maxSteamStore() {
+ return this.maxEUStore();
}
- public boolean isValidTesseractGenerator(String aOwnerName, boolean aWorkIrrelevant)
- {
- return (getBaseMetaTileEntity() != null) && (!getBaseMetaTileEntity().isInvalidTileEntity()) && (getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20));
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void onConfigLoad(final GT_Config aConfig) {
+ GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST = 1024;
+ GT_MetaTileEntity_TesseractGenerator.TESSERACT_ENERGY_COST_DIMENSIONAL = 2048;
}
- public void onPostTick()
- {
- if (getBaseMetaTileEntity().isServerSide()){
- if (this.mFrequency != this.oFrequency){
-
+ public void onPostTick() {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (this.mFrequency != this.oFrequency) {
+
Utils.LOG_INFO("mFreq != oFreq");
-
- if (sTesseractGenerators.get(Integer.valueOf(this.oFrequency)) == this)
- {
- sTesseractGenerators.remove(Integer.valueOf(this.oFrequency));
- getBaseMetaTileEntity().issueBlockUpdate();
+
+ if (CORE.sTesseractGenerators.get(Integer.valueOf(this.oFrequency)) == this) {
+ CORE.sTesseractGenerators.remove(Integer.valueOf(this.oFrequency));
+ this.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 ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false)))
- {
+ if (this.getBaseMetaTileEntity().isAllowedToWork()
+ && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false)) {
Utils.LOG_INFO("Can Work & Has Energy");
- if ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null) || (!((GT_MetaTileEntity_TesseractGenerator)sTesseractGenerators.get(Integer.valueOf(this.mFrequency))).isValidTesseractGenerator(null, true))) {
+ if (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null
+ || !CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency))
+ .isValidTesseractGenerator(null, true)) {
Utils.LOG_INFO("storing TE I think to mFreq map?");
- sTesseractGenerators.put(Integer.valueOf(this.mFrequency), this);
+ CORE.sTesseractGenerators.put(Integer.valueOf(this.mFrequency), this);
}
}
- else
- {
- if (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this)
- {
+ else {
+ if (CORE.sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) {
Utils.LOG_INFO("this gen == mFreq on map - do block update");
- sTesseractGenerators.remove(Integer.valueOf(this.mFrequency));
- getBaseMetaTileEntity().issueBlockUpdate();
+ CORE.sTesseractGenerators.remove(Integer.valueOf(this.mFrequency));
+ this.getBaseMetaTileEntity().issueBlockUpdate();
}
this.isWorking = 0;
}
- if (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this)
- {
+ if (CORE.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)
- {
- getBaseMetaTileEntity().issueBlockUpdate();
- this.isWorking = ((byte)(this.isWorking + 1));
+ if (this.isWorking == 20) {
+ this.getBaseMetaTileEntity().issueBlockUpdate();
+ this.isWorking = (byte) (this.isWorking + 1);
}
}
- else
- {
+ else {
this.isWorking = 0;
}
this.mNeededEnergy = 0;
@@ -540,60 +507,93 @@ extends GT_MetaTileEntity_BasicTank
}
@Override
- public String[] getDescription()
- {
- return new String[] {"Generates a Tesseract for the attached Inventory"};
- }
-
- @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;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
+ 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;
}
@Override
- 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)};
+ 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)" : ""));
+ }
}
-
- //To-Do?
@Override
- public boolean doesFillContainers() {
- return false;
+ public void onServerStart() {
+ CORE.sTesseractGenerators.clear();
}
- @Override
- public boolean doesEmptyContainers() {
- return false;
+ public void onServerStop() {
+ CORE.sTesseractGenerators.clear();
}
@Override
- public boolean canTankBeFilled() {
- return false;
+ public boolean ownerControl() {
+ return true;
}
@Override
- public boolean canTankBeEmptied() {
- return false;
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mFrequency", this.mFrequency);
}
@Override
- public boolean displaysItemStack() {
- return false;
+ 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);
}
@Override
- public boolean displaysStackSize() {
- return false;
+ 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);
+ }
}
}
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 3544d2a124..9a1a89cf47 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
@@ -19,508 +19,476 @@ 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 int mFrequency = 0;
- public boolean mDidWork = false;
- public static boolean sInterDimensionalTesseractAllowed = true;
-
- public GT_MetaTileEntity_TesseractTerminal(int aID, String aName, String aNameRegional, int aTier) {
+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) {
super(aID, aName, aNameRegional, aTier, 3, "");
}
- public GT_MetaTileEntity_TesseractTerminal(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_TesseractTerminal(final String aName, final int aTier, final String aDescription,
+ final ITexture[][][] aTextures) {
super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_TesseractTerminal(mName, mTier, mDescription, mTextures);
}
- @Override
- public boolean isTransformerUpgradable()
- {
- return false;
+ public boolean allowCoverOnSide(final byte aSide, final int aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
}
@Override
- public boolean isOverclockerUpgradable()
- {
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean isSimpleMachine()
- {
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
+ final ItemStack aStack) {
return false;
}
@Override
- public boolean isFacingValid(byte aFacing)
- {
- return true;
- }
-
- @Override
- public boolean isOutputFacing(byte aSide) {
- return aSide == getBaseMetaTileEntity().getBackFacing();
+ 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);
}
@Override
- public boolean isValidSlot(int aIndex)
- {
- return false;
- }
-
- @Override
- public long getMinimumStoredEU()
- {
- return getBaseMetaTileEntity().getEUCapacity() / 2;
+ 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);
}
@Override
- public long maxEUInput()
- {
- return 2048;
+ 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);
}
@Override
- public boolean isAccessAllowed(EntityPlayer aPlayer)
- {
- return true;
- }
-
- @Override
- public long maxEUStore()
- {
- return 100000;
+ 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);
}
@Override
- public long maxSteamStore()
- {
- return maxEUStore();
+ public boolean canTankBeEmptied() {
+ return false;
}
@Override
- public boolean ownerControl()
- {
- return true;
+ public boolean canTankBeFilled() {
+ return false;
}
@Override
- public int getProgresstime()
- {
- return getTesseract(this.mFrequency, false) != null ? 999 : 0;
+ 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);
}
@Override
- public int maxProgresstime()
- {
- return 1000;
+ public boolean displaysItemStack() {
+ return false;
}
@Override
- public void saveNBTData(NBTTagCompound aNBT)
- {
- aNBT.setInteger("mFrequency", this.mFrequency);
+ public boolean displaysStackSize() {
+ return false;
}
@Override
- public void loadNBTData(NBTTagCompound aNBT)
- {
- this.mFrequency = aNBT.getInteger("mFrequency");
+ public boolean doesEmptyContainers() {
+ return false;
}
+ // To-Do?
@Override
- 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;
- }*/
-
- @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()));
- }
- }
-
- public boolean allowCoverOnSide(byte aSide, int aCoverID)
- {
- return aSide != getBaseMetaTileEntity().getFrontFacing();
+ public boolean doesFillContainers() {
+ return false;
}
- 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;
- }
- if (!rTesseract.isValidTesseractGenerator(getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) {
- return null;
- }
- if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != getBaseMetaTileEntity().getWorld())) {
+ @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 rTesseract;
+ return tTileEntity.drain(aSide, aFluid, doDrain);
}
@Override
- public String[] getInfoData()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) {
- return tTileEntity.getInfoData();
+ 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 new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" };
+ return tTileEntity.drain(aDirection, maxDrain, doDrain);
}
@Override
- public boolean isGivingInformation()
- {
- return true;
+ 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);
}
@Override
- public boolean isDigitalChest()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return false;
+ 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.isDigitalChest();
+ return tTileEntity.getAccessibleSlotsFromSide(aSide);
}
+ /*
+ * 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 ItemStack[] getStoredItemData()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return null;
- }
- return tTileEntity.getStoredItemData();
+ public String[] getDescription() {
+ return new String[] {
+ "Accesses Tesseracts remotely"
+ };
}
@Override
- public void setItemCount(int aCount)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return;
+ public String[] getInfoData() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity != null && this.getBaseMetaTileEntity().isAllowedToWork()
+ && tTileEntity.isSendingInformation()) {
+ return tTileEntity.getInfoData();
}
- tTileEntity.setItemCount(aCount);
+ return new String[] {
+ "Tesseract Generator", "Freqency:", "" + this.mFrequency,
+ this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive"
+ };
}
@Override
- public int getMaxItemCount()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return 0;
+ public String getInventoryName() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return "";
}
- return tTileEntity.getMaxItemCount();
+ return tTileEntity.getInventoryName();
}
@Override
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return false;
+ public int getInventoryStackLimit() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return 0;
}
- return tTileEntity.isItemValidForSlot(aIndex, aStack);
+ return tTileEntity.getInventoryStackLimit();
}
@Override
- public int[] getAccessibleSlotsFromSide(int aSide)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return new int[0];
+ public int getMaxItemCount() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return 0;
}
- return tTileEntity.getAccessibleSlotsFromSide(aSide);
+ return tTileEntity.getMaxItemCount();
}
@Override
- 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.canInsertItem(aIndex, aStack, aSide);
+ public long getMinimumStoredEU() {
+ return this.getBaseMetaTileEntity().getEUCapacity() / 2;
}
@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 tTileEntity.canExtractItem(aIndex, aStack, aSide);
+ public int getProgresstime() {
+ return this.getTesseract(this.mFrequency, false) != null ? 999 : 0;
}
@Override
- public int getSizeInventory()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
+ public int getSizeInventory() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
return 0;
}
return tTileEntity.getSizeInventory();
}
@Override
- public ItemStack getStackInSlot(int aIndex)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
+ public ItemStack getStackInSlot(final int aIndex) {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
return null;
}
return tTileEntity.getStackInSlot(aIndex);
}
@Override
- public void setInventorySlotContents(int aIndex, ItemStack aStack)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return;
+ public ItemStack[] getStoredItemData() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
+ return null;
}
- tTileEntity.setInventorySlotContents(aIndex, aStack);
+ return tTileEntity.getStoredItemData();
}
@Override
- public ItemStack decrStackSize(int aIndex, int aAmount)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
+ 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];
+ }
+ return tTileEntity.getTankInfo(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;
}
- return tTileEntity.decrStackSize(aIndex, aAmount);
+ 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;
+ }
+ return rTesseract;
}
@Override
- public String getInventoryName()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return "";
- }
- return tTileEntity.getInventoryName();
+ 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)
+ };
}
@Override
- public int getInventoryStackLimit()
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return 0;
- }
- return tTileEntity.getInventoryStackLimit();
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ return new ITexture[0][0][0];
}
@Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return false;
- }
- return tTileEntity.canFill(aSide, aFluid);
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
}
@Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
+ public boolean isDigitalChest() {
+ final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false);
+ if (tTileEntity == null || !this.getBaseMetaTileEntity().isAllowedToWork()) {
return false;
}
- return tTileEntity.canDrain(aSide, aFluid);
+ return tTileEntity.isDigitalChest();
}
@Override
- 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);
+ public boolean isFacingValid(final byte aFacing) {
+ return true;
}
@Override
- 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);
+ public boolean isGivingInformation() {
+ return true;
}
@Override
- public FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain)
- {
- GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false);
- if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) {
- return null;
+ 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()) {
+ return false;
}
- return tTileEntity.drain(aDirection, maxDrain, doDrain);
+ return tTileEntity.isItemValidForSlot(aIndex, aStack);
}
@Override
- 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);
+ public boolean isOutputFacing(final byte aSide) {
+ return aSide == this.getBaseMetaTileEntity().getBackFacing();
}
- 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 boolean isOverclockerUpgradable() {
+ return false;
}
@Override
- public String[] getDescription()
- {
- return new String[] {"Accesses Tesseracts remotely"};
+ public boolean isSimpleMachine() {
+ return false;
}
@Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ public boolean isTransformerUpgradable() {
return false;
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ public boolean isValidSlot(final int aIndex) {
return false;
}
@Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mFrequency = aNBT.getInteger("mFrequency");
}
@Override
- 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)};
+ public long maxEUInput() {
+ return 2048;
}
- //To-Do?
@Override
- public boolean doesFillContainers() {
- return false;
+ public long maxEUStore() {
+ return 100000;
}
@Override
- public boolean doesEmptyContainers() {
- return false;
+ public int maxProgresstime() {
+ return 1000;
}
@Override
- public boolean canTankBeFilled() {
- return false;
+ public long maxSteamStore() {
+ return this.maxEUStore();
}
@Override
- public boolean canTankBeEmptied() {
- return false;
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescription, this.mTextures);
}
@Override
- public boolean displaysItemStack() {
- return false;
+ 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();
+ }
+ }
}
@Override
- public boolean displaysStackSize() {
- return false;
+ 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;
+ }
+
+ @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()));
+ }
+ }
+
+ @Override
+ public boolean ownerControl() {
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mFrequency", this.mFrequency);
+ }
+
+ @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);
+ }
+
+ @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);
}
}