diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
26 files changed, 2897 insertions, 2871 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 9fa42b0286..73eae3608c 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,6 +1,7 @@ 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.*; @@ -32,17 +33,17 @@ extends GT_MetaTileEntity_BasicTank public int mNeededEnergy = 0; public int mFrequency = 0; - public GT_MetaTileEntity_TesseractGenerator(int aID, String aName, String aNameRegional, int aTier) { + 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); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override @@ -64,7 +65,7 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isFacingValid(byte aFacing) + public boolean isFacingValid(final byte aFacing) { return true; } @@ -82,18 +83,18 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isInputFacing(byte aSide) + public boolean isInputFacing(final byte aSide) { return true; } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getBackFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean isValidSlot(int aIndex) + public boolean isValidSlot(final int aIndex) { return false; } @@ -101,7 +102,7 @@ extends GT_MetaTileEntity_BasicTank @Override public long getMinimumStoredEU() { - return getBaseMetaTileEntity().getEUCapacity() / 2; + return this.getBaseMetaTileEntity().getEUCapacity() / 2; } @Override @@ -125,11 +126,11 @@ extends GT_MetaTileEntity_BasicTank @Override public long maxSteamStore() { - return maxEUStore(); + return this.maxEUStore(); } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @@ -153,19 +154,19 @@ extends GT_MetaTileEntity_BasicTank } @Override - public void saveNBTData(NBTTagCompound aNBT) + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public void loadNBTData(NBTTagCompound aNBT) + public void loadNBTData(final NBTTagCompound aNBT) { this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public void onConfigLoad(GT_Config aConfig) + public void onConfigLoad(final GT_Config aConfig) { TESSERACT_ENERGY_COST = 1024; TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; @@ -181,17 +182,17 @@ extends GT_MetaTileEntity_BasicTank { 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: + 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: + case 1: Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); this.mFrequency += 1; default: @@ -200,44 +201,44 @@ extends GT_MetaTileEntity_BasicTank } 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 void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) + if (aSide == this.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))) + 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: + case 0: this.mFrequency -= 64; break; - case 1: + case 1: this.mFrequency += 64; break; - case 2: + case 2: this.mFrequency -= 512; break; - case 3: + 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 boolean allowCoverOnSide(byte aSide, int aCoverID) + public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } @Override public String[] getInfoData() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) { + 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, (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? "Active" : "Inactive" }; @@ -251,8 +252,8 @@ extends GT_MetaTileEntity_BasicTank public boolean isSendingInformation() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { return ((IGregTechDeviceInformation)tTileEntity).isGivingInformation(); } return false; @@ -261,8 +262,8 @@ extends GT_MetaTileEntity_BasicTank @Override public boolean isDigitalChest() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { return ((IDigitalChest)tTileEntity).isDigitalChest(); } return false; @@ -271,18 +272,18 @@ extends GT_MetaTileEntity_BasicTank @Override public ItemStack[] getStoredItemData() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { return ((IDigitalChest)tTileEntity).getStoredItemData(); } return null; } @Override - public void setItemCount(int aCount) + public void setItemCount(final int aCount) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { ((IDigitalChest)tTileEntity).setItemCount(aCount); } } @@ -290,45 +291,45 @@ extends GT_MetaTileEntity_BasicTank @Override public int getMaxItemCount() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + 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 boolean isItemValidForSlot(int aIndex, ItemStack aStack) + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public int[] getAccessibleSlotsFromSide(int aSide) + public int[] getAccessibleSlotsFromSide(final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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); } - int[] rArray = new int[getSizeInventory()]; - for (int i = 0; i < getSizeInventory(); i++) { + final int[] rArray = new int[this.getSizeInventory()]; + for (int i = 0; i < this.getSizeInventory(); i++) { rArray[i] = i; } return rArray; } @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } if ((tTileEntity instanceof ISidedInventory)) { @@ -338,10 +339,10 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } if ((tTileEntity instanceof ISidedInventory)) { @@ -353,38 +354,38 @@ extends GT_MetaTileEntity_BasicTank @Override public int getSizeInventory() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getSizeInventory(); } @Override - public ItemStack getStackInSlot(int aIndex) + public ItemStack getStackInSlot(final int aIndex) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.getStackInSlot(aIndex); } @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public ItemStack decrStackSize(int aIndex, int aAmount) + public ItemStack decrStackSize(final int aIndex, final int aAmount) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.decrStackSize(aIndex, aAmount); @@ -393,8 +394,8 @@ extends GT_MetaTileEntity_BasicTank @Override public String getInventoryName() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return ""; } return tTileEntity.getInventoryName(); @@ -403,107 +404,107 @@ extends GT_MetaTileEntity_BasicTank @Override public int getInventoryStackLimit() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getInventoryStackLimit(); } @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 canDrain(ForgeDirection aSide, Fluid aFluid) + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canDrain(aSide, aFluid); } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new FluidTankInfo[0]; } return tTileEntity.getTankInfo(aSide); } @Override - public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aSide, aFluid, doDrain); } - public boolean addEnergyConsumption(GT_MetaTileEntity_TesseractTerminal aTerminal) + public boolean addEnergyConsumption(final GT_MetaTileEntity_TesseractTerminal aTerminal) { - if (!getBaseMetaTileEntity().isAllowedToWork()) { + if (!this.getBaseMetaTileEntity().isAllowedToWork()) { return false; } - this.mNeededEnergy += (aTerminal.getBaseMetaTileEntity().getWorld() == getBaseMetaTileEntity().getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); + this.mNeededEnergy += (aTerminal.getBaseMetaTileEntity().getWorld() == this.getBaseMetaTileEntity().getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); return true; } - public boolean isValidTesseractGenerator(String aOwnerName, boolean aWorkIrrelevant) + public boolean isValidTesseractGenerator(final String aOwnerName, final boolean aWorkIrrelevant) { - return (getBaseMetaTileEntity() != null) && (!getBaseMetaTileEntity().isInvalidTileEntity()) && (getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20)); + return (this.getBaseMetaTileEntity() != null) && (!this.getBaseMetaTileEntity().isInvalidTileEntity()) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (this.getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20)); } public void onPostTick() { - if (getBaseMetaTileEntity().isServerSide()){ + 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(); + 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 ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null) || (!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); } @@ -514,7 +515,7 @@ extends GT_MetaTileEntity_BasicTank { Utils.LOG_INFO("this gen == mFreq on map - do block update"); sTesseractGenerators.remove(Integer.valueOf(this.mFrequency)); - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } this.isWorking = 0; } @@ -526,7 +527,7 @@ extends GT_MetaTileEntity_BasicTank } if (this.isWorking == 20) { - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); this.isWorking = ((byte)(this.isWorking + 1)); } } @@ -545,26 +546,26 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + 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)}; } - + //To-Do? @Override public boolean doesFillContainers() { 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..4056af5df8 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 @@ -26,17 +26,17 @@ extends GT_MetaTileEntity_BasicTank public boolean mDidWork = false; public static boolean sInterDimensionalTesseractAllowed = true; - public GT_MetaTileEntity_TesseractTerminal(int aID, String aName, String aNameRegional, int aTier) { + 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); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override @@ -58,26 +58,26 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isFacingValid(byte aFacing) + public boolean isFacingValid(final byte aFacing) { return true; } - + @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getBackFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean isValidSlot(int aIndex) + public boolean isValidSlot(final int aIndex) { return false; } - + @Override public long getMinimumStoredEU() { - return getBaseMetaTileEntity().getEUCapacity() / 2; + return this.getBaseMetaTileEntity().getEUCapacity() / 2; } @Override @@ -87,11 +87,11 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } - + @Override public long maxEUStore() { @@ -101,7 +101,7 @@ extends GT_MetaTileEntity_BasicTank @Override public long maxSteamStore() { - return maxEUStore(); + return this.maxEUStore(); } @Override @@ -113,7 +113,7 @@ extends GT_MetaTileEntity_BasicTank @Override public int getProgresstime() { - return getTesseract(this.mFrequency, false) != null ? 999 : 0; + return this.getTesseract(this.mFrequency, false) != null ? 999 : 0; } @Override @@ -123,19 +123,19 @@ extends GT_MetaTileEntity_BasicTank } @Override - public void saveNBTData(NBTTagCompound aNBT) + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public void loadNBTData(NBTTagCompound aNBT) + public void loadNBTData(final NBTTagCompound aNBT) { this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public void onConfigLoad(GT_Config aConfig) + public void onConfigLoad(final GT_Config aConfig) { sInterDimensionalTesseractAllowed = true; } @@ -147,10 +147,10 @@ extends GT_MetaTileEntity_BasicTank 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: + case 0: this.mFrequency -= 1; break; - case 1: + 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())); @@ -159,15 +159,15 @@ extends GT_MetaTileEntity_BasicTank }*/ @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: + 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: + case 1: Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); this.mFrequency += 1; default: @@ -175,43 +175,43 @@ extends GT_MetaTileEntity_BasicTank break; } PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); - PlayerUtils.messagePlayer(aPlayer, (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + PlayerUtils.messagePlayer(aPlayer, (this.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) + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) + if (aSide == this.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))) + 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: + case 0: this.mFrequency -= 64; break; - case 1: + case 1: this.mFrequency += 64; break; - case 2: + case 2: this.mFrequency -= 512; break; - case 3: + 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())); + GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (this.getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); } } - public boolean allowCoverOnSide(byte aSide, int aCoverID) + public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } - public GT_MetaTileEntity_TesseractGenerator getTesseract(int aFrequency, boolean aWorkIrrelevant) + public GT_MetaTileEntity_TesseractGenerator getTesseract(final int aFrequency, final boolean aWorkIrrelevant) { - GT_MetaTileEntity_TesseractGenerator rTesseract = (GT_MetaTileEntity_TesseractGenerator)CORE.sTesseractGenerators.get(Integer.valueOf(aFrequency)); + final GT_MetaTileEntity_TesseractGenerator rTesseract = CORE.sTesseractGenerators.get(Integer.valueOf(aFrequency)); if (rTesseract == null) { return null; } @@ -219,10 +219,10 @@ extends GT_MetaTileEntity_BasicTank { CORE.sTesseractGenerators.put(Integer.valueOf(aFrequency), null);return null; } - if (!rTesseract.isValidTesseractGenerator(getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { + if (!rTesseract.isValidTesseractGenerator(this.getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { return null; } - if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != getBaseMetaTileEntity().getWorld())) { + if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != this.getBaseMetaTileEntity().getWorld())) { return null; } return rTesseract; @@ -231,11 +231,11 @@ extends GT_MetaTileEntity_BasicTank @Override public String[] getInfoData() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) { return tTileEntity.getInfoData(); } - return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; + return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; } @Override @@ -247,8 +247,8 @@ extends GT_MetaTileEntity_BasicTank @Override public boolean isDigitalChest() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isDigitalChest(); @@ -257,18 +257,18 @@ extends GT_MetaTileEntity_BasicTank @Override public ItemStack[] getStoredItemData() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.getStoredItemData(); } @Override - public void setItemCount(int aCount) + public void setItemCount(final int aCount) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setItemCount(aCount); @@ -277,48 +277,48 @@ extends GT_MetaTileEntity_BasicTank @Override public int getMaxItemCount() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getMaxItemCount(); } @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public int[] getAccessibleSlotsFromSide(int aSide) + public int[] getAccessibleSlotsFromSide(final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new int[0]; } return tTileEntity.getAccessibleSlotsFromSide(aSide); } @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canExtractItem(aIndex, aStack, aSide); @@ -327,38 +327,38 @@ extends GT_MetaTileEntity_BasicTank @Override public int getSizeInventory() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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) + public ItemStack getStackInSlot(final int aIndex) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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) + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public ItemStack decrStackSize(int aIndex, int aAmount) + public ItemStack decrStackSize(final int aIndex, final int aAmount) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.decrStackSize(aIndex, aAmount); @@ -367,8 +367,8 @@ extends GT_MetaTileEntity_BasicTank @Override public String getInventoryName() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return ""; } return tTileEntity.getInventoryName(); @@ -377,68 +377,68 @@ extends GT_MetaTileEntity_BasicTank @Override public int getInventoryStackLimit() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getInventoryStackLimit(); } @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 canDrain(ForgeDirection aSide, Fluid aFluid) + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 FluidTankInfo[] getTankInfo(ForgeDirection aSide) + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new FluidTankInfo[0]; } return tTileEntity.getTankInfo(aSide); } @Override - public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + 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 FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aDirection, maxDrain, doDrain); } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aSide, aFluid, doDrain); @@ -446,22 +446,22 @@ extends GT_MetaTileEntity_BasicTank public void onPostTick() { - if ((getBaseMetaTileEntity().isServerSide()) && (getBaseMetaTileEntity().isAllowedToWork())) + if ((this.getBaseMetaTileEntity().isServerSide()) && (this.getBaseMetaTileEntity().isAllowedToWork())) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, true); + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, true); if (tTileEntity != null) { tTileEntity.addEnergyConsumption(this); - if ((!this.mDidWork) && (getTesseract(this.mFrequency, false) != null)) + if ((!this.mDidWork) && (this.getTesseract(this.mFrequency, false) != null)) { this.mDidWork = true; - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } } else if (this.mDidWork == true) { this.mDidWork = false; - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } } } @@ -473,22 +473,22 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + 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)}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java index c2cadab478..3c90bf6836 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java @@ -17,128 +17,135 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Boiler_Solar - extends GT_MetaTileEntity_Boiler { - public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, "Steam Power by the Sun", new ITexture[0]); - } +extends GT_MetaTileEntity_Boiler { + public GT_MetaTileEntity_Boiler_Solar(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, "Steam Power by the Sun", new ITexture[0]); + } - public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } + public GT_MetaTileEntity_Boiler_Solar(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[4][17][]; - for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)}; - rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[2][(i + 1)] = tmp2; - ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[3][(i + 1)] = tmp3; - } - return rTextures; - } + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[4][17][]; + for (byte i = -1; i < 16; i = (byte) (i + 1)) { + final ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[0][(i + 1)] = tmp0; + final ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)}; + rTextures[1][(i + 1)] = tmp1; + final ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[2][(i + 1)] = tmp2; + final ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; + rTextures[3][(i + 1)] = tmp3; + } + return rTextures; + } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1]; - } + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1]; + } - public int maxProgresstime() { - return 500; - } + @Override + public int maxProgresstime() { + return 500; + } - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000); - } + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000); + } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); - } + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); + } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures); - } - - private int mRunTime = 0; - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mRunTime", this.mRunTime); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mRunTime = aNBT.getInteger("mRunTime"); - } + private int mRunTime = 0; - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { - if (this.mTemperature <= 20) { - this.mTemperature = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 45) { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - if (this.mSteam != null) { - byte i = aBaseMetaTileEntity.getFrontFacing(); - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); - if (tTileEntity != null) { - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) { - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); - } - } - } - } - if (aTick % 25L == 0L) { - if (this.mTemperature > 100) { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { - this.mHadNoWater = true; - } else { - if (this.mHadNoWater) { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - mRunTime += 1; - int tOutput = 150; - if(mRunTime > 10000){ - tOutput = Math.max(50, 150 - ((mRunTime-10000)/100)); - } - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(tOutput); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += tOutput; - } else { - this.mSteam = GT_ModHandler.getSteam(tOutput); - } - } - } else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && - (this.mSteam.amount > 16000)) { - sendSound((byte) 1); - this.mSteam.amount = 12000; - } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 256L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; - mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; - } - if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { - this.mProcessingEnergy -= 1; - this.mTemperature += 1; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); - } - } + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mRunTime", this.mRunTime); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mRunTime = aNBT.getInteger("mRunTime"); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { + if (this.mTemperature <= 20) { + this.mTemperature = 20; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 45) { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + if (this.mSteam != null) { + final byte i = aBaseMetaTileEntity.getFrontFacing(); + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) { + final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) { + final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + if ((aTick % 25L) == 0L) { + if (this.mTemperature > 100) { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { + this.mHadNoWater = true; + } else { + if (this.mHadNoWater) { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + this.mRunTime += 1; + int tOutput = 150; + if(this.mRunTime > 10000){ + tOutput = Math.max(50, 150 - ((this.mRunTime-10000)/100)); + } + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(tOutput); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += tOutput; + } else { + this.mSteam = GT_ModHandler.getSteam(tOutput); + } + } + } else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 16000)) { + this.sendSound((byte) 1); + this.mSteam.amount = 12000; + } + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + } + if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { + this.mProcessingEnergy -= 1; + this.mTemperature += 1; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java index b3a1fb456c..6ba0cb0d76 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -11,124 +12,123 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityDoubleFuelGeneratorBase - extends GregtechRocketFuelGeneratorBase { +extends GregtechRocketFuelGeneratorBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntityDoubleFuelGeneratorBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires two liquid Fuels. Fuel A is Fastburn, Fuel B is slowburn.", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntityDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires two liquid Fuels. Fuel A is Fastburn, Fuel B is slowburn.", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntityDoubleFuelGeneratorBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntityDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityDoubleFuelGeneratorBase(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityDoubleFuelGeneratorBase(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 32000; - } + return 32000; + } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - this.mTier * 8)); - } + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8))); + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - private GT_RenderedTexture getCasingTexture(){ - if (this.mTier <= 4){ - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - else if (this.mTier == 5){ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); - } - else { - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); - } + return this.mEfficiency; + } + + @Override + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + private GT_RenderedTexture getCasingTexture(){ + if (this.mTier <= 4){ + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); + } + else if (this.mTier == 5){ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); + } + else { + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); + } //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; - } + } + + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index f4ee1c97b1..b6053d8d5e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -12,7 +13,6 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity_BasicGenerator @@ -20,24 +20,24 @@ extends GT_MetaTileEntity_BasicGenerator public int mEfficiency; - public GregtechMetaTileEntityGeothermalGenerator(int aID, String aName, String aNameRegional, int aTier) { + public GregtechMetaTileEntityGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); - onConfigLoad(); + this.onConfigLoad(); } - public GregtechMetaTileEntityGeothermalGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaTileEntityGeothermalGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + this.onConfigLoad(); + } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ return true; } aBaseMetaTileEntity.openGUI(aPlayer); return true; - } + } @Override public int getCapacity() { @@ -46,7 +46,7 @@ extends GT_MetaTileEntity_BasicGenerator } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - this.mTier * 7)); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - (this.mTier * 7))); } @Override @@ -55,8 +55,8 @@ extends GT_MetaTileEntity_BasicGenerator } @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); } @@ -64,62 +64,62 @@ extends GT_MetaTileEntity_BasicGenerator } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityGeothermalGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical)}; } @Override - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)}; } @Override - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER)}; } @Override - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT)}; } @Override - public ITexture[] getFrontActive(byte aColor) { + public ITexture[] getFrontActive(final byte aColor) { return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBackActive(byte aColor) { + public ITexture[] getBackActive(final byte aColor) { return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical_Active)}; } @Override - public ITexture[] getBottomActive(byte aColor) { + public ITexture[] getBottomActive(final byte aColor) { return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)}; } @Override - public ITexture[] getTopActive(byte aColor) { + public ITexture[] getTopActive(final byte aColor) { return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE)}; } @Override - public ITexture[] getSidesActive(byte aColor) { + public ITexture[] getSidesActive(final byte aColor) { return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE)}; } @@ -127,7 +127,7 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[] {"Generates power from Lava/Pahoehoe at " + getEfficiency() + "% Efficiency per tick"}; + return new String[] {"Generates power from Lava/Pahoehoe at " + this.getEfficiency() + "% Efficiency per tick"}; } @Override @@ -136,7 +136,7 @@ extends GT_MetaTileEntity_BasicGenerator return GT_Recipe_Map.sHotFuels; } - + public int getPollution() { return 100; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java index ee36a920b0..b63c367fd5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -11,124 +12,123 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityRocketFuelGenerator - extends GregtechRocketFuelGeneratorBase { +extends GregtechRocketFuelGeneratorBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntityRocketFuelGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires liquid Fuels.", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires liquid Fuels.", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntityRocketFuelGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntityRocketFuelGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 32000; - } + return 32000; + } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - this.mTier * 8)); - } + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8))); + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - private GT_RenderedTexture getCasingTexture(){ - if (this.mTier <= 4){ - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - else if (this.mTier == 5){ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); - } - else{ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); - } + return this.mEfficiency; + } + + @Override + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + private GT_RenderedTexture getCasingTexture(){ + if (this.mTier <= 4){ + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); + } + else if (this.mTier == 5){ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); + } + else{ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); + } //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; - } + } + + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java index c41c1851fa..a268ade81e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Textures; @@ -16,45 +17,45 @@ import net.minecraft.entity.player.InventoryPlayer; public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGenerator { - public GregtechMetaTileEntitySolarGenerator(int aID, String aName, String aNameRegional, int aTier) { + public GregtechMetaTileEntitySolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Feasts on the power of the Sun!", new ITexture[0]); - onConfigLoad(); + this.onConfigLoad(); } - public GregtechMetaTileEntitySolarGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaTileEntitySolarGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + this.onConfigLoad(); } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, 16000); } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntitySolarGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SunAbsorber.efficiency.tier." + this.mTier, 100 - this.mTier * 10); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SunAbsorber.efficiency.tier." + this.mTier, 100 - (this.mTier * 10)); } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()) { + && (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) { if (this.mSolarCharge <= 20) { //Utils.LOG_WARNING("1."); @@ -67,32 +68,32 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener this.mLossTimer = 0; } - if (aTick % 10L == 0L) { + if ((aTick % 10L) == 0L) { - Utils.LOG_WARNING("getUniversalEnergyStored: "+aBaseMetaTileEntity.getUniversalEnergyStored() + " maxEUOutput * 20 + getMinimumStoredEU: " + (maxEUOutput() * 20 + getMinimumStoredEU())); + Utils.LOG_WARNING("getUniversalEnergyStored: "+aBaseMetaTileEntity.getUniversalEnergyStored() + " maxEUOutput * 20 + getMinimumStoredEU: " + ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())); - if ((this.mSolarCharge > 100) && (aBaseMetaTileEntity.isAllowedToWork()) && - (!aBaseMetaTileEntity.getWorld().isThundering()) && - aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUStore() - getMinimumStoredEU())) { - getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * getEfficiency(), true); + if ((this.mSolarCharge > 100) && (aBaseMetaTileEntity.isAllowedToWork()) && + (!aBaseMetaTileEntity.getWorld().isThundering()) && + (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUStore() - this.getMinimumStoredEU()))) { + this.getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * this.getEfficiency(), true); } - } + } - if ((this.mSolarCharge < 500) && (this.mProcessingEnergy != 0) && (aTick % 32L == 0L)) { - Utils.LOG_WARNING("Adding Solar Charge. Currently "+mSolarCharge); + if ((this.mSolarCharge < 500) && (this.mProcessingEnergy != 0) && ((aTick % 32L) == 0L)) { + Utils.LOG_WARNING("Adding Solar Charge. Currently "+this.mSolarCharge); this.mProcessingEnergy -= 1; this.mSolarCharge += 1; } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 64L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - Utils.LOG_WARNING("Adding Processing Energy. Currently "+mProcessingEnergy); - boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; - mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 64L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { + Utils.LOG_WARNING("Adding Processing Energy. Currently "+this.mProcessingEnergy); + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; } if (aBaseMetaTileEntity.isServerSide()){ //Utils.LOG_WARNING("6."); - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } } @@ -109,65 +110,65 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener @Override public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 16000 + getMinimumStoredEU()); + return Math.max(this.getEUVar(), (V[this.mTier] * 16000) + this.getMinimumStoredEU()); } - ITexture SolarArray[] = {new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V), + ITexture SolarArray[] = {new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_MV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_HV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_EV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_ZPM), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; @Override - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; } @Override - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getFrontActive(byte aColor) { + public ITexture[] getFrontActive(final byte aColor) { return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } @Override - public ITexture[] getBackActive(byte aColor) { + public ITexture[] getBackActive(final byte aColor) { return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } @Override - public ITexture[] getBottomActive(byte aColor) { + public ITexture[] getBottomActive(final byte aColor) { return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } @Override - public ITexture[] getTopActive(byte aColor) { + public ITexture[] getTopActive(final byte aColor) { return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; } @Override - public ITexture[] getSidesActive(byte aColor) { + public ITexture[] getSidesActive(final byte aColor) { return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java index 5d1befbbad..89ed69e247 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java @@ -9,96 +9,96 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaSuperConductorNodeBase; public class GregtechMetaTileEntitySuperCondensor - extends GregtechMetaSuperConductorNodeBase { +extends GregtechMetaSuperConductorNodeBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntitySuperCondensor(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires liquid Nitrogen/Helium", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntitySuperCondensor(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires liquid Nitrogen/Helium", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntitySuperCondensor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntitySuperCondensor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntitySuperCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntitySuperCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 64000; - } + return 64000; + } - public void onConfigLoad() { - this.mEfficiency = 100; - } + public void onConfigLoad() { + this.mEfficiency = 100; + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } + return this.mEfficiency; + } + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java index 0d9fadc6df..b68c49c48c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,117 +14,118 @@ import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredMachineBlock { - public int mRange = 16; - - public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); - } - - public GregtechMetaTileEntityChunkLoader(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { - GT_SpawnEventHandler.mobReps.add(tCoords); - } - if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { - mRange = 16 + (48 * mTier); - } else { - mRange = 4 + (12 * mTier); - } - } - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.add(tCoords); - } - - @Override - public void onRemoval() { - int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.remove(tCoords); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(byte aSide) { - return true; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512; - } - - @Override - public long maxEUStore() { - return 512 + V[mTier] * 50; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxAmperesIn() { - return 2; - } - - @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 null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - } + public int mRange = 16; + + public GregtechMetaTileEntityChunkLoader(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); + } + + public GregtechMetaTileEntityChunkLoader(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { + final int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + if (((aTimer % 600) == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { + GT_SpawnEventHandler.mobReps.add(tCoords); + } + if (aBaseMetaTileEntity.isUniversalEnergyStored(this.getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { + this.mRange = 16 + (48 * this.mTier); + } else { + this.mRange = 4 + (12 * this.mTier); + } + } + } + + @Override + public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { + final int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.add(tCoords); + } + + @Override + public void onRemoval() { + final int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.remove(tCoords); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512; + } + + @Override + public long maxEUStore() { + return 512 + (V[this.mTier] * 50); + } + + @Override + public long maxEUInput() { + return V[this.mTier]; + } + + @Override + public long maxAmperesIn() { + return 2; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + return null; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index 9b11e82dbd..33bfbc2f1f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Collection; + import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -19,10 +22,6 @@ import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; -import java.util.Collection; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; @@ -42,17 +41,17 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); - public GregtechMTE_NuclearReactor(int aID, String aName, String aNameRegional) { + public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMTE_NuclearReactor(String aName) { + public GregtechMTE_NuclearReactor(final String aName) { super(aName); } @Override public long maxEUStore() { - return 640000000L * (Math.min(16, this.mEnergyHatches.size())) / 16L; + return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L; } @Override @@ -74,20 +73,20 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override public String[] getInfoData() { - String tRunning = (mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); - String tMaintainance = (getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); + final String tRunning = (this.mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); + final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); return new String[]{ "Liquid Fluoride Thorium Reactor", tRunning, tMaintainance, - "Current Output: "+(mEUt*mEfficiency/10000)+" EU/t", - "Fuel Consumption: "+fuelConsumption+"L/t", - "Fuel Value: "+fuelValue+" EU/L", - "Fuel Remaining: "+fuelRemaining+" Litres", - "Current Efficiency: "+(mEfficiency/100)+"%", - "Optimal Fuel Flow: "+(int)realOptFlow+" L/t", - "Current Speed: "+(mEfficiency/100)+"%",}; + "Current Output: "+((this.mEUt*this.mEfficiency)/10000)+" EU/t", + "Fuel Consumption: "+this.fuelConsumption+"L/t", + "Fuel Value: "+this.fuelValue+" EU/L", + "Fuel Remaining: "+this.fuelRemaining+" Litres", + "Current Efficiency: "+(this.mEfficiency/100)+"%", + "Optimal Fuel Flow: "+(int)this.realOptFlow+" L/t", + "Current Speed: "+(this.mEfficiency/100)+"%",}; } @Override @@ -96,12 +95,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[70], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; @@ -110,12 +109,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { // Life Lessons from Greg. /** @@ -135,22 +134,22 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase [23:46:06] <Alkalus> Noted, thanks :D */ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; for (int i = -3; i <= 3; i++) { for (int j = -3; j <= 3; j++) { for (int h = 0; h < 4; h++) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); // Reactor Floor/Roof inner 5x5 - if ((i != -3 && i != 3) && (j != -3 && j != 3)) { + if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. - if (h == 0 || h == 3) { + if ((h == 0) || (h == 3)) { //If not a hatch, continue, else add hatch and continue. - if ((!addMufflerToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { + if ((!this.addMufflerToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -160,16 +159,16 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); return false; } - } - } + } + } // Inside 2 layers, mostly air - else { + else { // Reactor Inner 5x5 //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); + Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } @@ -187,7 +186,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); return false; } - }*/ + }*/ } @@ -195,7 +194,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase else { //Deal with all 4 sides (Reactor walls) - if (h == 1 || h == 2) { + if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -205,13 +204,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with top and Bottom edges (Inner 5x5) - else if (h == 0 || h == 3) { - if ((!addToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + else if ((h == 0) || (h == 3)) { + if ((!this.addToMachineList(tTileEntity, 70)) && (!this.addInputToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer."); @@ -254,7 +253,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 5 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST V tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -272,79 +271,79 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } } - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - turnCasingActive(true); + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + this.turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { - return boostEu ? 30000 : 10000; + public int getMaxEfficiency(final ItemStack aStack) { + return this.boostEu ? 30000 : 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 5; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return true; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMTE_NuclearReactor(this.mName); } - public static int overclock(int mStartEnergy) { + public static int overclock(final int mStartEnergy) { return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1; } - public boolean turnCasingActive(boolean status) { + public boolean turnCasingActive(final boolean status) { if (this.mDynamoHatches != null) { - for (GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { + for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mMufflerHatches != null) { - for (GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { + for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputHatches != null) { - for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputHatches != null) { - for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputBusses != null) { - for (GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { + for (final GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputBusses != null) { - for (GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { + for (final GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } @@ -354,107 +353,107 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<FluidStack> tFluids = getStoredFluids(); - Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; - if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a LFTR fuel? + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<FluidStack> tFluids = this.getStoredFluids(); + final Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; + if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? Utils.LOG_INFO("Found more than one input fluid and a list of valid recipes."); - boolean containsFLIBE = false; - boolean containsPrimarySalt = false; - for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches + final boolean containsFLIBE = false; + final boolean containsPrimarySalt = false; + for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches Utils.LOG_INFO("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); - for(GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes + for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes Utils.LOG_INFO("Looping through Recipes. "+aFuel.mSpecialValue); - FluidStack tLiquid; - FluidStack testStack = aFuel.mFluidInputs[1]; + FluidStack tLiquid; + final FluidStack testStack = aFuel.mFluidInputs[1]; if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe Utils.LOG_INFO("Creating a fluidstack from the current recipe"); if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid - fuelConsumption = tLiquid.amount = boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption - Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+fuelConsumption); - if(depleteInput(tLiquid)) { //Deplete that amount + this.fuelConsumption = tLiquid.amount = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption + Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption); + if(this.depleteInput(tLiquid)) { //Deplete that amount Utils.LOG_INFO("Depleted some FLiBe fluid"); this.mMaxProgresstime = 500; - + if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(1)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(2)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(10))) { //Has a Primary fuel salt? //Deplete Primary Salt. 1000L should = 1 hour of runtime (if baseEU = 2048) && using 1l each time - if(mRuntime % 72 == 0 || mRuntime == 0){ + if(((this.mRuntime % 72) == 0) || (this.mRuntime == 0)){ //U235 fuel is 10x less efficient than UF4 with Thorium, UF4 with Zirconium is only 2x less efficient than UF4 with Thorium. //Most Efficient if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ - depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(boostEu ? 2 : 1)); - Utils.LOG_INFO("Depleted "+(boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); } //1/2 as Efficient if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ - depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(boostEu ? 4 : 2)); - Utils.LOG_INFO("Depleted "+(boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); } //10x less Efficient. - if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { - depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(boostEu ? 20 : 10)); - Utils.LOG_INFO("Depleted "+(boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); + if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { + this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); } } } else { return false; } - + //Try Sparge Noble Gases - if (depleteInput(Materials.Helium.getGas(1000L)) && heliumSparging){ + if (this.depleteInput(Materials.Helium.getGas(1000L)) && this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Helium"); - spargeOutput = getByproductsOfSparge(Materials.Helium.getGas(1000L)); - heliumSparging = false; + spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); + this.heliumSparging = false; //If Sparging occurred, try add the outputs to the output hatches. try { - if (spargeOutput.length >= 1){ - for (FluidStack F : spargeOutput){ - Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + if (spargeOutput.length >= 1){ + for (final FluidStack F : spargeOutput){ + Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); + this.addOutput(F); + } } - } - } catch (Throwable T){} + } catch (final Throwable T){} } - + //Try Sparge Fluorides - if (depleteInput(Materials.Fluorine.getGas(100L)) && !heliumSparging){ + if (this.depleteInput(Materials.Fluorine.getGas(100L)) && !this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Fluorine"); - spargeOutput = getByproductsOfSparge(Materials.Fluorine.getGas(100L)); - heliumSparging = true; + spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); + this.heliumSparging = true; //If Sparging occurred, try add the outputs to the output hatches. if (spargeOutput.length > 0){ - for (FluidStack F : spargeOutput){ + for (final FluidStack F : spargeOutput){ Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + this.addOutput(F); } } } - + if (aFuel != null){ Utils.LOG_INFO("Saving previous Recipe."); - this.mLastRecipe = aFuel; + this.mLastRecipe = aFuel; } - - fuelValue = aFuel.mSpecialValue; - fuelRemaining = hatchFluid1.amount; //Record available fuel - + + this.fuelValue = aFuel.mSpecialValue; + this.fuelRemaining = hatchFluid1.amount; //Record available fuel + if (this.mEfficiency < 500){ this.mEfficiency++; } - - this.mEUt = (mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% + + this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% Utils.LOG_INFO("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); - + this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEfficiencyIncrease = 15; @@ -522,18 +521,18 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } - protected FluidStack[] getByproductsOfSparge(FluidStack spargeGas){ + protected FluidStack[] getByproductsOfSparge(final FluidStack spargeGas){ FluidStack[] outputArrayOfGases = new FluidStack[]{}; if (spargeGas != null){ if (spargeGas.isFluidEqual(Materials.Helium.getGas(1000))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 600)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 400)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), - MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) + MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) }; - int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); + final int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); Utils.LOG_INFO("Helium remaining: "+heliumContent); outputArrayOfGases = new FluidStack[]{ ELEMENT.getInstance().XENON.getFluid(outputChances[0]), @@ -541,24 +540,24 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase ELEMENT.getInstance().ARGON.getFluid(outputChances[2]), ELEMENT.getInstance().KRYPTON.getFluid(outputChances[3]), ELEMENT.getInstance().RADON.getFluid(outputChances[4]), - Materials.Helium.getGas(heliumContent) + Materials.Helium.getGas(heliumContent) }; } else if (spargeGas.isFluidEqual(Materials.Fluorine.getGas(100))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randDouble(10, 100)), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), - MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) + MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) }; - int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); + final int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); Utils.LOG_INFO("Fluorine remaining: "+fluorineContent); outputArrayOfGases = new FluidStack[]{ FLUORIDES.URANIUM_HEXAFLUORIDE.getFluid(outputChances[0]), FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid(outputChances[1]), FLUORIDES.TECHNETIUM_HEXAFLUORIDE.getFluid(outputChances[2]), FLUORIDES.SELENIUM_HEXAFLUORIDE.getFluid(outputChances[3]), - Materials.Fluorine.getGas(fluorineContent) + Materials.Fluorine.getGas(fluorineContent) }; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java index 5a165c4072..2114bd1af2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.lang.reflect.Field; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,9 +17,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.lang.reflect.Field; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -33,20 +32,20 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //public ArrayList<GT_MetaTileEntity_TieredMachineBlock> mCasings = new ArrayList(); - private boolean running = false; + private final boolean running = false; private boolean p1, p2, p3, p4, p5, p6; public ItemStack mOutputItem1; public ItemStack mOutputItem2; private Block Humus; - private boolean isForestryLoaded = TreefarmManager.isForestryValid(); + private final boolean isForestryLoaded = TreefarmManager.isForestryValid(); - public GregtechMetaTileEntityAnimalFarm(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntityAnimalFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntityAnimalFarm(String aName) { + public GregtechMetaTileEntityAnimalFarm(final String aName) { super(aName); - } + } @Override public String[] getDescription() { @@ -55,11 +54,11 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo "How to get your first logs without an axe.", "Max Size(WxHxD): 9x1x9 (Controller, with upto 4 dirt out each direction on a flat plane.)", "Dirt for the rest! [D = Dirt, X = Controller]" - }; + }; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } @@ -77,39 +76,41 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityAnimalFarm(this.mName); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { Utils.LOG_INFO("Working"); /*if (!checkRecursiveBlocks()) { this.mEfficiency = 0; @@ -137,16 +138,16 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (!LoadedMods.Forestry){ return null; } - return TreefarmManager.getHumus(); + return TreefarmManager.getHumus(); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { //this.mCasings.clear(); Utils.LOG_INFO("Step 1"); - int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; - int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { Utils.LOG_INFO("Step 2"); @@ -155,10 +156,10 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo for (int h = 0; h <= 1; h++) { Utils.LOG_INFO("Step 4"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_INFO("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -172,40 +173,40 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo (aBaseMetaTileEntity.getZCoord()+(zDir+j)), Blocks.melon_block); return false; - } - } + } + } // Inside fenced area, mostly air or trees or saplings - else if (h == 1){ + else if (h == 1){ //Farm Inner 14x14 /*if (!TreefarmManager.isWoodLog(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !aBaseMetaTileEntity.getAirOffset(xDir+i, h, zDir+j)) { Utils.LOG_INFO("Wood like block missing from inner 14x14, layer 2."); //TODO - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); Utils.LOG_INFO("Found at x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)); //return false; - }*/ - } + }*/ + } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_INFO("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { try { - addCasingToCasingList(tTileEntity); - } catch (Throwable t){} + this.addCasingToCasingList(tTileEntity); + } catch (final Throwable t){} - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (!(aBaseMetaTileEntity.getMetaTileID() != 752)) { Utils.LOG_INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -241,7 +242,7 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -260,24 +261,24 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } } } - mSolderingTool = true; + this.mSolderingTool = true; //turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -287,29 +288,31 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - public boolean addCasingToCasingList(IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) + public boolean addCasingToCasingList(final IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) { return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { return false; + } if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { //return this.mCasings.add((GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity); } return false; } - private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(GT_MetaTileEntity_TieredMachineBlock casing, ITexture[][][] textureSet){ - GT_MetaTileEntity_TieredMachineBlock cv = casing; + private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(final GT_MetaTileEntity_TieredMachineBlock casing, final ITexture[][][] textureSet){ + final GT_MetaTileEntity_TieredMachineBlock cv = casing; //System.out.println("Before: "+cv.mTextures.hashCode()); //Get declared field from class Field f; try { - Field[] x = cv.getClass().getFields(); + final Field[] x = cv.getClass().getFields(); for (int i =0; i<x.length;i++){ //Utils.LOG_INFO(x[i].getName()); } @@ -317,13 +320,13 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //Try get the field variable f = cv.getClass().getField("mTextures"); // set the accessiblity of the field to true, this will enable you to change the value - f.setAccessible(true); + f.setAccessible(true); //change the field value f.set(cv, textureSet); //Verify change in texture set //System.out.println("After: "+cv.mTextures.hashCode()); return cv; - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { Utils.LOG_INFO("Could not find mTextures."); return casing; } @@ -336,60 +339,60 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo public ITexture[][][] getTextureSet() { - ITexture[][][] rTextures = new ITexture[10][17][]; + final ITexture[][][] rTextures = new ITexture[10][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); } return rTextures; } - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); } - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); } - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); } - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); } - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index aa5580858b..ac3f5622b1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + +import cpw.mods.fml.common.Optional; import forestry.api.arboriculture.ITree; import forestry.api.arboriculture.TreeManager; import forestry.api.genetics.IIndividual; @@ -28,9 +31,6 @@ import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_TreeFarmer; import gtPlusPlus.xmod.gregtech.api.gui.GUI_TreeFarmer; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.entity.player.*; import net.minecraft.item.ItemStack; @@ -38,30 +38,29 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.Optional; public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlockBase { /* private */ private int treeCheckTicks = 0; /* private */ private int plantSaplingTicks = 0; /* private */ private int cleanupTicks = 0; - /* private */ public long mInternalPower = 0; + /* private */ public long mInternalPower = 0; /* private */ private static int powerDrain = 32; private short energyHatchRetryCount = 0; //Too Many logs, lag breaker - private boolean takingBreak = false; - private int logsToBreakAfter = 500; + private final boolean takingBreak = false; + private final int logsToBreakAfter = 500; private EntityPlayerMP farmerAI; private SAWTOOL mCurrentMachineTool = SAWTOOL.NONE; private boolean canChop = false; - private int cuttingNumber = 0; - private int cuttingNumber2 = 0; - private int cuttingNumber3 = 0; + private final int cuttingNumber = 0; + private final int cuttingNumber2 = 0; + private final int cuttingNumber3 = 0; public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -69,7 +68,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock public GregtechMetaTileEntityTreeFarm(final String aName) { super(aName); - } + } @Override public String[] getDescription() { @@ -91,34 +90,34 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setLong("mInternalPower", this.mInternalPower); super.saveNBTData(aNBT); } @Override - public void loadNBTData(NBTTagCompound aNBT) { + public void loadNBTData(final NBTTagCompound aNBT) { this.mInternalPower = aNBT.getLong("mInternalPower"); super.loadNBTData(aNBT); } @Override - public boolean drainEnergyInput(long aEU) { + public boolean drainEnergyInput(final long aEU) { this.mInternalPower = (this.mInternalPower-32); - Utils.LOG_MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); + Utils.LOG_MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); return true; } - public boolean addPowerToInternalStorage(IGregTechTileEntity aBaseMetaTileEntity){ + public boolean addPowerToInternalStorage(final IGregTechTileEntity aBaseMetaTileEntity){ if (this.mEnergyHatches.size() > 0) { - for (final GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches){ + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches){ if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getEUVar() >= 128) { + if (tHatch.getEUVar() >= 128) { for (int o=0;o<(tHatch.getEUVar()/128);o++){ - if (this.mInternalPower<(maxEUStore()-128)){ - tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); - this.mInternalPower = (this.mInternalPower+128); - //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); + if (this.mInternalPower<(this.maxEUStore()-128)){ + tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); + this.mInternalPower = (this.mInternalPower+128); + //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); } } } @@ -127,18 +126,18 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_INFO("Bad Power hatch to obtain energy from."); } } - } - else { - if (energyHatchRetryCount <= 10){ - energyHatchRetryCount++; + } + else { + if (this.energyHatchRetryCount <= 10){ + this.energyHatchRetryCount++; Utils.LOG_INFO("No energy hatches found."); } else { Utils.LOG_MACHINE_INFO("Rechecking for Energy hatches."); - energyHatchRetryCount = 0; - this.mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - checkMachine(aBaseMetaTileEntity, mInventory[1]); - } + this.energyHatchRetryCount = 0; + this.mEnergyHatches = new ArrayList<>(); + this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } } return true; } @@ -151,7 +150,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { - return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(this.canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } @@ -187,17 +186,17 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "TreeFarmer.png"); - } + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); + } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; } @@ -208,13 +207,13 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean isCorrectMachinePart(final ItemStack aStack) { boolean isValid = false; - SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); + final SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); if (currentInputItem != SAWTOOL.NONE){ if (currentInputItem == SAWTOOL.SAW){ - mCurrentMachineTool = SAWTOOL.SAW; + this.mCurrentMachineTool = SAWTOOL.SAW; } else { - mCurrentMachineTool = SAWTOOL.BUZZSAW; + this.mCurrentMachineTool = SAWTOOL.BUZZSAW; } isValid = true; } @@ -226,7 +225,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(final ItemStack aStack) { - Utils.LOG_MACHINE_INFO("Working"); + Utils.LOG_MACHINE_INFO("Working"); this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; @@ -236,7 +235,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { Utils.LOG_WARNING("Step 1"); - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { @@ -247,7 +246,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_WARNING("Step 4"); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_WARNING("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -256,24 +255,24 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("Dirt like block missing from inner 14x14."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_WARNING("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_MACHINE_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (tTileEntity.getMetaTileID() != 752) { Utils.LOG_MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -303,7 +302,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -357,7 +356,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock private boolean isMachineRepaired(){ if (this.mSolderingTool || this.mCrowbar || this.mHardHammer || this.mScrewdriver || this.mSoftHammer || this.mWrench){ return true; - } + } return false; } @@ -368,12 +367,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("called findLogs()"); int logsCut = 0; boolean stopCheck = false; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; final World world = aBaseMetaTileEntity.getWorld(); int posX, posY, posZ; - if (mInternalPower >= 128) { + if (this.mInternalPower >= 128) { OUTER : for (int h=0;h<150;h++){ for (int i = -7; i <= 7; i++) { @@ -382,88 +381,88 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Cut too many logs, do this to prevent lag. - if (logsCut >= logsToBreakAfter){ + if (logsCut >= this.logsToBreakAfter){ stopCheck = true; - } + } //Already Breaking but first two layers are empty, let's do a full check. - else if (logsCut == 0 && h == 2 && takingBreak){ + else if ((logsCut == 0) && (h == 2) && this.takingBreak){ stopCheck = false; } //No Trees Grown and not breaking, take a break, reduce lag. - else if (logsCut == 0 && h == 3 && !takingBreak){ + else if ((logsCut == 0) && (h == 3) && !this.takingBreak){ stopCheck = true; - } + } else { stopCheck = false; } if (stopCheck){ Utils.LOG_MACHINE_INFO("Either found too many logs, so taking a break mid cut for lag conservation, or found no trees to cut, so stopping"); - Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+takingBreak); + Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+this.takingBreak); stopCheck = false; break OUTER; } - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ - long tempStoredEU = mInternalPower; - if (tempStoredEU >= powerDrain){ - Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+maxEUStore()); - drainEnergyInput(powerDrain); + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + final Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ + final long tempStoredEU = this.mInternalPower; + if (tempStoredEU >= powerDrain){ + Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+this.maxEUStore()); + this.drainEnergyInput(powerDrain); - long tempStoredEU2 = mInternalPower; + final long tempStoredEU2 = this.mInternalPower; if (tempStoredEU != tempStoredEU2){ if (tempStoredEU == (tempStoredEU2+powerDrain)){ - Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); + Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); } else { Utils.LOG_MACHINE_INFO(""+(tempStoredEU-tempStoredEU2)+"EU was drained."); } } else { - Utils.LOG_MACHINE_INFO("Stored EU did not change."); + Utils.LOG_MACHINE_INFO("Stored EU did not change."); } posX = aBaseMetaTileEntity.getXCoord()+xDir+i; posY = aBaseMetaTileEntity.getYCoord()+h; posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; - cutLog(world, posX, posY, posZ); + this.cutLog(world, posX, posY, posZ); if (TreefarmManager.isWoodLog(loopBlock)){ - logsCut++; - } + logsCut++; + } } else { Utils.LOG_MACHINE_INFO("Not enough power to cut."); - } + } } } } } - } + } } else { - Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); + Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+this.maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); } - canChop = false; - if (logsCut >= logsToBreakAfter){ + this.canChop = false; + if (logsCut >= this.logsToBreakAfter){ TreeFarmHelper.cleanUp(aBaseMetaTileEntity); } - return false; + return false; } private boolean growSaplingsWithBonemeal(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called growSaplingsWithBonemeal()"); int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { for (int j = -7; j <= 7; j++) { - int h = 1; + final int h = 1; //Utils.LOG_MACHINE_INFO("Looking for saplings."); if (TreefarmManager.isSapling(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ int posiX, posiY, posiZ; @@ -473,10 +472,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Utils.LOG_MACHINE_INFO("Found a sapling to grow."); saplings++; - if (depleteFertiliser()){ - if (drainEnergyInput(powerDrain)){ - short fertTier = getFertiliserTier(getCurrentFertiliserStack()); - TreeFarmHelper.applyBonemeal(getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); + if (this.depleteFertiliser()){ + if (this.drainEnergyInput(powerDrain)){ + final short fertTier = this.getFertiliserTier(this.getCurrentFertiliserStack()); + TreeFarmHelper.applyBonemeal(this.getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); } else { Utils.LOG_MACHINE_INFO("x3"); @@ -486,40 +485,40 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock else { Utils.LOG_MACHINE_INFO("x2"); break; - } - } + } + } } } Utils.LOG_MACHINE_INFO("Tried to grow saplings: | "+saplings ); - return true; + return true; } private boolean plantSaplings(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called plantSaplings()"); - World world = aBaseMetaTileEntity.getWorld(); - ArrayList<ItemStack> r = getStoredInputs(); - int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final World world = aBaseMetaTileEntity.getWorld(); + ArrayList<ItemStack> r = this.getStoredInputs(); + final int saplings = 0; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; int counter = 0; if (r.size() > 0){ Utils.LOG_MACHINE_INFO("| r was not null. "+r.size()+" |"); - OUTER : for (ItemStack n : r){ + OUTER : for (final ItemStack n : r){ Utils.LOG_MACHINE_INFO("found "+n.getDisplayName()); if (OrePrefixes.sapling.contains(n) || n.getDisplayName().toLowerCase().contains("sapling")){ Utils.LOG_MACHINE_INFO(""+n.getDisplayName()); counter = n.stackSize; - Block saplingToPlace = Block.getBlockFromItem(n.getItem()); + final Block saplingToPlace = Block.getBlockFromItem(n.getItem()); //Find Gaps for Saplings after scanning Item Busses for (int i = -7; i <= 7; i++) { INNER : for (int j = -7; j <= 7; j++) { - int h = 1; - if (counter > 0){ - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ + final int h = 1; + if (counter > 0){ + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ //Get block location to place sapling block int posX, posY, posZ; @@ -528,7 +527,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; //If sapling block is not null || Ignore if forestry is loaded. - if ((saplingToPlace != null && !LoadedMods.Forestry) || LoadedMods.Forestry){ + if (((saplingToPlace != null) && !LoadedMods.Forestry) || LoadedMods.Forestry){ //Plant Sapling if (!LoadedMods.Forestry){ @@ -536,33 +535,33 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock world.setBlockMetadataWithNotify(posX, posY, posZ, n.getItemDamage(), 4); } else { - plantSaplingAt(n, this.getBaseMetaTileEntity().getWorld(), posX, posY, posZ); - } + this.plantSaplingAt(n, this.getBaseMetaTileEntity().getWorld(), posX, posY, posZ); + } //Deplete Input stack - depleteInputEx(n); - drainEnergyInput(powerDrain); + this.depleteInputEx(n); + this.drainEnergyInput(powerDrain); counter--; //Update slot contents? - updateSlots(); + this.updateSlots(); //Test If Inputs Changed - ArrayList<ItemStack> temp = getStoredInputs(); + final ArrayList<ItemStack> temp = this.getStoredInputs(); if (r != temp){ Utils.LOG_MACHINE_INFO("Inputs changed, updating."); - for (ItemStack xr : r){ + for (final ItemStack xr : r){ Utils.LOG_MACHINE_INFO("xr:"+xr.getDisplayName()+"x"+xr.stackSize); } - for (ItemStack xc : temp){ + for (final ItemStack xc : temp){ Utils.LOG_MACHINE_INFO("xc:"+xc.getDisplayName()+"x"+xc.stackSize); } - r = temp; + r = temp; } } else { - Utils.LOG_MACHINE_INFO(n.getDisplayName()+" did not have a valid block."); + Utils.LOG_MACHINE_INFO(n.getDisplayName()+" did not have a valid block."); } - } + } else { //Utils.LOG_MACHINE_INFO("No space for sapling, no air."); continue INNER; @@ -590,63 +589,64 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock }*/ } Utils.LOG_MACHINE_INFO("Tried to plant saplings: | "+saplings ); - return true; + return true; } @Optional.Method(modid = "Forestry") - public boolean plantSaplingAt(ItemStack germling, World world, int x, int y, int z) { + public boolean plantSaplingAt(final ItemStack germling, final World world, final int x, final int y, final int z) { Utils.LOG_MACHINE_INFO("Planting Sapling with Forestry method, since it's installed."); if (PluginManager.Module.ARBORICULTURE.isEnabled()) { - IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling); + final IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling); if (!(tree instanceof ITree)) { return false; } - return TreeManager.treeRoot.plantSapling(world, (ITree) tree, getFakePlayer().getGameProfile(), x, y, z); + return TreeManager.treeRoot.plantSapling(world, (ITree) tree, this.getFakePlayer().getGameProfile(), x, y, z); } - return germling.copy().tryPlaceItemIntoWorld(getFakePlayer(), world, x, y - 1, z, 1, 0.0F, 0.0F, 0.0F); + return germling.copy().tryPlaceItemIntoWorld(this.getFakePlayer(), world, x, y - 1, z, 1, 0.0F, 0.0F, 0.0F); } private boolean cutLog(final World world, final int x, final int y, final int z){ //Utils.LOG_MACHINE_INFO("Cutting Log"); try { - final Block block = world.getBlock(x, y, z); + final Block block = world.getBlock(x, y, z); int chanceForLeaves = 1000; //is it leaves or a log? if leaves, heavily reduce chance to obtain rubber if (block.getUnlocalizedName().toLowerCase().contains("leaves")){ chanceForLeaves = MathUtils.randInt(1, 1000); - if (chanceForLeaves > 990) + if (chanceForLeaves > 990) { Utils.LOG_MACHINE_INFO("Found some leaves that will drop, chance to drop item "+chanceForLeaves+", needed 990-1000."); + } } //IC2 Sticky Rubber handling if (block.getUnlocalizedName().toLowerCase().contains("blockrubwood") || block.getUnlocalizedName().toLowerCase().contains("blockrubleaves")){ - ItemStack rubberResin = ItemUtils.getCorrectStacktype("IC2:itemHarz", 1); - int chanceForRubber = MathUtils.randInt(1, 10); - int multiplier = MathUtils.randInt(1, 3); - if (chanceForRubber > 7 && chanceForLeaves > 990){ + final ItemStack rubberResin = ItemUtils.getCorrectStacktype("IC2:itemHarz", 1); + final int chanceForRubber = MathUtils.randInt(1, 10); + final int multiplier = MathUtils.randInt(1, 3); + if ((chanceForRubber > 7) && (chanceForLeaves > 990)){ rubberResin.stackSize = multiplier; Utils.LOG_MACHINE_INFO("Adding "+rubberResin.getDisplayName()+" x"+rubberResin.stackSize); - addOutput(rubberResin); - updateSlots(); - } + this.addOutput(rubberResin); + this.updateSlots(); + } } - int dropMeta = world.getBlockMetadata(x, y, z); - ArrayList<ItemStack> blockDrops = block.getDrops(world, x, y, z, dropMeta, 0); - ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops); + final int dropMeta = world.getBlockMetadata(x, y, z); + final ArrayList<ItemStack> blockDrops = block.getDrops(world, x, y, z, dropMeta, 0); + final ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops); //Add Drops - if (drops != null){ - for (ItemStack outputs : drops){ + if (drops != null){ + for (final ItemStack outputs : drops){ if (chanceForLeaves > 990){ Utils.LOG_MACHINE_INFO("Adding 1x "+outputs.getDisplayName()); - addOutput(outputs); + this.addOutput(outputs); //Update bus contents. - updateSlots(); + this.updateSlots(); } - } + } - } + } //Remove drop that was added to the bus. world.setBlockToAir(x, y, z); @@ -654,31 +654,31 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock return true; - } catch (NullPointerException e){} + } catch (final NullPointerException e){} return false; } public FluidStack[] getStoredInputFluids(){ - ArrayList<FluidStack> fluidArray = this.getStoredFluids(); + final ArrayList<FluidStack> fluidArray = this.getStoredFluids(); if (fluidArray.size() < 1){ return new FluidStack[] {}; } - FluidStack storedInputFluids[] = new FluidStack[fluidArray.size()]; + final FluidStack storedInputFluids[] = new FluidStack[fluidArray.size()]; if (storedInputFluids.length >= 1){ int counter = 0; - for (FluidStack inputPuddle : fluidArray){ + for (final FluidStack inputPuddle : fluidArray){ storedInputFluids[counter] = inputPuddle; counter++; } - return storedInputFluids; + return storedInputFluids; } return new FluidStack[] {}; } public boolean doesInputHatchContainAnyFertiliser(){ - FluidStack[] tempFluids = getStoredInputFluids(); + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ + for (final FluidStack f : tempFluids){ if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ return true; } @@ -691,7 +691,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock return false; } - public short getFertiliserTier(FluidStack f){ + public short getFertiliserTier(final FluidStack f){ if (f.isFluidEqual(TreeFarmHelper.fertT1)){ return 1; } @@ -707,12 +707,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } public FluidStack getCurrentFertiliserStack(){ - if (!doesInputHatchContainAnyFertiliser()){ + if (!this.doesInputHatchContainAnyFertiliser()){ return null; - } - FluidStack[] tempFluids = getStoredInputFluids(); + } + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ + for (final FluidStack f : tempFluids){ if (f.isFluidEqual(TreeFarmHelper.fertT1)){ return TreeFarmHelper.fertT1; } @@ -729,10 +729,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock public boolean doesInputHatchContainEnoughFertiliser(){ - FluidStack[] tempFluids = getStoredInputFluids(); + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ - if (f.amount >= TreeFarmHelper.fertT1.amount || f.amount >= TreeFarmHelper.fertT2.amount || f.amount >= TreeFarmHelper.fertT3.amount){ + for (final FluidStack f : tempFluids){ + if ((f.amount >= TreeFarmHelper.fertT1.amount) || (f.amount >= TreeFarmHelper.fertT2.amount) || (f.amount >= TreeFarmHelper.fertT3.amount)){ return true; } } @@ -742,22 +742,22 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } public boolean depleteFertiliser(){ - if (!doesInputHatchContainEnoughFertiliser()){ + if (!this.doesInputHatchContainEnoughFertiliser()){ return false; - } - FluidStack[] tempFluids = getStoredInputFluids(); + } + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ - if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ - if (f.isFluidEqual(TreeFarmHelper.fertT1) && f.amount >= TreeFarmHelper.fertT1.amount){ + for (final FluidStack f : tempFluids){ + if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ + if (f.isFluidEqual(TreeFarmHelper.fertT1) && (f.amount >= TreeFarmHelper.fertT1.amount)){ this.depleteInput(TreeFarmHelper.fertT1); return true; } - else if(f.isFluidEqual(TreeFarmHelper.fertT2) && f.amount >= TreeFarmHelper.fertT2.amount){ + else if(f.isFluidEqual(TreeFarmHelper.fertT2) && (f.amount >= TreeFarmHelper.fertT2.amount)){ this.depleteInput(TreeFarmHelper.fertT2); return true; } - else if(f.isFluidEqual(TreeFarmHelper.fertT3) && f.amount >= TreeFarmHelper.fertT3.amount){ + else if(f.isFluidEqual(TreeFarmHelper.fertT3) && (f.amount >= TreeFarmHelper.fertT3.amount)){ this.depleteInput(TreeFarmHelper.fertT3); return true; } @@ -769,13 +769,15 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock - public boolean depleteInputEx(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; + public boolean depleteInputEx(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } Utils.LOG_MACHINE_INFO("Taking one sapling away from in input bus."); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; --i) { if ((!(GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i)))) || (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize < aStack.stackSize)){ @@ -793,39 +795,39 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Tree Manager private void tickTrees(){ - if (treeCheckTicks > 200){ - treeCheckTicks = 0; + if (this.treeCheckTicks > 200){ + this.treeCheckTicks = 0; } else { - treeCheckTicks++; + this.treeCheckTicks++; } } private void tickSaplings(){ - if (plantSaplingTicks > 200){ - plantSaplingTicks = 0; + if (this.plantSaplingTicks > 200){ + this.plantSaplingTicks = 0; } else { - plantSaplingTicks++; + this.plantSaplingTicks++; } } private void tickCleanup(){ - if (cleanupTicks > 600){ - cleanupTicks = 0; + if (this.cleanupTicks > 600){ + this.cleanupTicks = 0; } else { - cleanupTicks++; + this.cleanupTicks++; } } private void tickHandler(){ //Count Sapling Timer - tickSaplings(); + this.tickSaplings(); //Count Tree Cutting Timer - tickTrees(); + this.tickTrees(); //Tick Cleanup script Timer. - tickCleanup(); + this.tickCleanup(); } public EntityPlayerMP getFakePlayer() { @@ -833,7 +835,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } @Override - public boolean onRunningTick(ItemStack aStack) { + public boolean onRunningTick(final ItemStack aStack) { return super.onRunningTick(aStack); } @@ -844,82 +846,82 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Does it have a tool this cycle to cut? boolean validCuttingTool = false; - boolean isRepaired = isMachineRepaired(); + final boolean isRepaired = this.isMachineRepaired(); //Add some Power - addPowerToInternalStorage(aBaseMetaTileEntity); + this.addPowerToInternalStorage(aBaseMetaTileEntity); //Set Forestry Fake player Sapling Planter if (this.farmerAI == null) { this.farmerAI = new FakeFarmer(MinecraftServer.getServer().worldServerForDimension(this.getBaseMetaTileEntity().getWorld().provider.dimensionId)); - } + } //Check Inventory slots [1] - Find a valid Buzzsaw Blade or a Saw try { - validCuttingTool = isCorrectMachinePart(mInventory[1]); + validCuttingTool = this.isCorrectMachinePart(this.mInventory[1]); if (validCuttingTool){ this.mMaxProgresstime = 600; - String materialName = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]).mDefaultLocalName; + final String materialName = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]).mDefaultLocalName; if (materialName.toLowerCase().contains("null")){ } else { } - } + } else { this.mMaxProgresstime = 0; } - } catch (NullPointerException t){} + } catch (final NullPointerException t){} if (isRepaired){ //Utils.LOG_INFO("Ticking3"); //If Machine can work and it's only once every 5 seconds this will tick. - if (canChop){ + if (this.canChop){ //Set Machine State - if (treeCheckTicks == 200){ - Utils.LOG_MACHINE_INFO("Looking For Trees - Serverside | "+treeCheckTicks); + if (this.treeCheckTicks == 200){ + Utils.LOG_MACHINE_INFO("Looking For Trees - Serverside | "+this.treeCheckTicks); //Find wood to Cut if (validCuttingTool){ - findLogs(aBaseMetaTileEntity); + this.findLogs(aBaseMetaTileEntity); } else { Utils.LOG_MACHINE_INFO("Did not find a valid saw or Buzzsaw blade."); } } - } + } else { - if (plantSaplingTicks == 100){ - Utils.LOG_MACHINE_INFO("Looking For space to plant saplings - Serverside | "+plantSaplingTicks); + if (this.plantSaplingTicks == 100){ + Utils.LOG_MACHINE_INFO("Looking For space to plant saplings - Serverside | "+this.plantSaplingTicks); //Plant Some Saplings - plantSaplings(aBaseMetaTileEntity); - } - else if (plantSaplingTicks == 200){ - Utils.LOG_MACHINE_INFO("Looking For Saplings to grow - Serverside | "+plantSaplingTicks); + this.plantSaplings(aBaseMetaTileEntity); + } + else if (this.plantSaplingTicks == 200){ + Utils.LOG_MACHINE_INFO("Looking For Saplings to grow - Serverside | "+this.plantSaplingTicks); //Try Grow some Saplings - if (doesInputHatchContainAnyFertiliser()){ - growSaplingsWithBonemeal(aBaseMetaTileEntity); - } + if (this.doesInputHatchContainAnyFertiliser()){ + this.growSaplingsWithBonemeal(aBaseMetaTileEntity); + } //Set can work state - this.mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>(); - this.mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - canChop = checkMachine(aBaseMetaTileEntity, mInventory[1]); + this.mInputBusses = new ArrayList<>(); + this.mEnergyHatches = new ArrayList<>(); + this.canChop = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); } - } + } //Tick TE - tickHandler(); + this.tickHandler(); } else { - if (treeCheckTicks == 200 || plantSaplingTicks == 100 || plantSaplingTicks == 200){ - Utils.LOG_MACHINE_INFO("Machine is not fully repaired, not ticking."); + if ((this.treeCheckTicks == 200) || (this.plantSaplingTicks == 100) || (this.plantSaplingTicks == 200)){ + Utils.LOG_MACHINE_INFO("Machine is not fully repaired, not ticking."); } } - + //Call Cleanup Task last, before ticking. - if (cleanupTicks == 600){ - Utils.LOG_MACHINE_INFO("Looking For rubbish to cleanup - Serverside | "+cleanupTicks); + if (this.cleanupTicks == 600){ + Utils.LOG_MACHINE_INFO("Looking For rubbish to cleanup - Serverside | "+this.cleanupTicks); TreeFarmHelper.cleanUp(aBaseMetaTileEntity); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 4de7048ffd..b4f3254e2c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -10,221 +13,217 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.*; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_AlloyBlastSmelter - extends GT_MetaTileEntity_MultiBlockBase { - private int mHeatingCapacity = 0; +extends GT_MetaTileEntity_MultiBlockBase { + private int mHeatingCapacity = 0; - public GregtechMetaTileEntity_AlloyBlastSmelter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GregtechMetaTileEntity_AlloyBlastSmelter(String aName) { - super(aName); - } + public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) { + super(aName); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); - } + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); + } - @Override + @Override public String[] getDescription() { - return new String[]{ - "Controller Block for the Alloy Blast Smelter", //Outputs 144mb fluid for every inputStack.stackSize; Time to use those hot metals. - "Size: 3x3x4 (Hollow)", - "Controller (front middle at bottom)", - "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", - "1x Input bus (one of bottom)", - "1x Output Hatch (one of bottom)", - "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", - "1x Muffler Hatch (top middle)", - "Blast Smelter Casings for the rest"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png"); - } - - @Override + return new String[]{ + "Controller Block for the Alloy Blast Smelter", //Outputs 144mb fluid for every inputStack.stackSize; Time to use those hot metals. + "Size: 3x3x4 (Hollow)", + "Controller (front middle at bottom)", + "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", + "1x Input bus (one of bottom)", + "1x Output Hatch (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Blast Smelter Casings for the rest"}; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72]}; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "ElectricBlastFurnace.png"); + } + + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size()); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - Utils.LOG_WARNING("Found some Valid Inputs."); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - updateSlots(); - return true; - } - } - Utils.LOG_WARNING("Failed to find some Valid Inputs."); - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - - //this.mHeatingCapacity = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { - return false; - } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); - - byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); - - this.mHeatingCapacity = 20000; - - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((xDir + i != 0) || (zDir + j != 0)) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 72)) && (!addInputToMachineList(tTileEntity, 72)) && (!addOutputToMachineList(tTileEntity, 72)) && (!addEnergyInputToMachineList(tTileEntity, 72))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 15) { - return false; - } - } - } - } - } - this.mHeatingCapacity += 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2); - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 10; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override + return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; + } + + @Override + public boolean isCorrectMachinePart(final ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size()); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 1) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + Utils.LOG_WARNING("Found some Valid Inputs."); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.updateSlots(); + return true; + } + } + Utils.LOG_WARNING("Failed to find some Valid Inputs."); + return false; + } + + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + //this.mHeatingCapacity = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { + return false; + } + this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); + + final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); + + this.mHeatingCapacity = 20000; + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { + return false; + } + } + } + } + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 72)) && (!this.addInputToMachineList(tTileEntity, 72)) && (!this.addOutputToMachineList(tTileEntity, 72)) && (!this.addEnergyInputToMachineList(tTileEntity, 72))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 15) { + return false; + } + } + } + } + } + this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2); + return true; + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 10; + } + + @Override + public int getDamageToComponent(final ItemStack aStack) { + return 0; + } + + @Override public int getAmountOfOutputs() { - return 2; - } + return 2; + } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index 0838bdefbd..87aa5582f9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -16,18 +21,12 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase { private static boolean controller; @@ -38,18 +37,18 @@ extends GregtechMeta_MultiBlockBase { private static CustomIcon GT9_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5"); //public static double recipesComplete = 0; - public GregtechMetaTileEntity_IndustrialCentrifuge(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialCentrifuge(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); - frontFaceActive = new GT_RenderedTexture(GT9_5_Active); - frontFace = new GT_RenderedTexture(GT9_5); + frontFaceActive = new GT_RenderedTexture(GT9_5_Active); + frontFace = new GT_RenderedTexture(GT9_5); } - public GregtechMetaTileEntity_IndustrialCentrifuge(String aName) { + public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName); } @@ -57,7 +56,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Centrifuge", - "Size: 3x3x3 (Hollow)", + "Size: 3x3x3 (Hollow)", "Controller (Front Center) [Orange]", "1x Maintenance Hatch (Rear Center) [Green]", "The rest can be placed anywhere except the Front [Red]", @@ -73,14 +72,14 @@ extends GregtechMeta_MultiBlockBase { @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[57]}; } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "IndustrialCentrifuge.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialCentrifuge.png"); } @Override @@ -89,38 +88,38 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - ArrayList<ItemStack> tInputList = getStoredInputs(); + ArrayList<ItemStack> tInputList = this.getStoredInputs(); GT_Recipe mLastRecipe; @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { /*if (!isCorrectMachinePart(mInventory[1])) { return false; }*/ Utils.LOG_WARNING("Centrifuge Debug - 1"); - GT_Recipe.GT_Recipe_Map map = getRecipeMap(); + final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); if (map == null) { Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map"); return false; } Utils.LOG_WARNING("Centrifuge Debug - 2"); - ArrayList<ItemStack> tInputList = getStoredInputs(); - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier); - ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); - if (tInputList.size() > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + if ((tInputList.size() > 0) || (tFluids.length > 0)) { + final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { Utils.LOG_WARNING("Recipe was not invalid"); - mLastRecipe = tRecipe; + this.mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null; this.mOutputFluids = null; @@ -131,13 +130,13 @@ extends GregtechMeta_MultiBlockBase { } this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime); if (tRecipe.mEUt <= 16) { Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t"); - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); } else { Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t"); @@ -161,17 +160,20 @@ extends GregtechMeta_MultiBlockBase { tOut[h].stackSize = 0; } FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + if (tRecipe.getFluidOutput(0) != null) { + tFOut = tRecipe.getFluidOutput(0).copy(); + } for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) { for (int g = 0; g < 1; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } } } } if (tFOut != null) { - int tSize = tFOut.amount; + final int tSize = tFOut.amount; tFOut.amount = tSize * 6; } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); @@ -180,11 +182,11 @@ extends GregtechMeta_MultiBlockBase { this.mMaxProgresstime++; } Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); - List<ItemStack> overStacks = new ArrayList<ItemStack>(); + final List<ItemStack> overStacks = new ArrayList<>(); for (int f = 0; f < tOut.length; f++) { if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); + final ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); @@ -196,14 +198,16 @@ extends GregtechMeta_MultiBlockBase { tmp = overStacks.toArray(tmp); tOut = ArrayUtils.addAll(tOut, tmp); } - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); + final List<ItemStack> tSList = new ArrayList<>(); + for (final ItemStack tS : tOut) { + if (tS.stackSize > 0) { + tSList.add(tS); + } } tOut = tSList.toArray(new ItemStack[tSList.size()]); this.mOutputItems = tOut; this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); + this.updateSlots(); Utils.LOG_WARNING("Centrifuge: True"); return true; } @@ -228,7 +232,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { /*if (configSwitches.disableCentrifugeFormation){ EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(this.getBaseMetaTileEntity().getOwnerName()); if (!player.getEntityWorld().isRemote && isDisabled == false) @@ -236,9 +240,9 @@ extends GregtechMeta_MultiBlockBase { isDisabled = true; return false; }*/ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { return false; @@ -247,23 +251,23 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { //X-Dir for (int j = -1; j < 2; j++) { //Z-Dir for (int h = -1; h < 2; h++) { //Y-Dir - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); - if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { + if ((!this.addMaintenanceToMachineList(tTileEntity, 57)) && (!this.addInputToMachineList(tTileEntity, 57)) && (!this.addOutputToMachineList(tTileEntity, 57)) && (!this.addEnergyInputToMachineList(tTileEntity, 57))) { //Maintenance Hatch if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { - if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { + if ((tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord()) && (tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord()) && (tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2))) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { Utils.LOG_WARNING("MAINT HATCH IN CORRECT PLACE"); this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { return false; } - } + } else { Utils.LOG_WARNING("MAINT HATCH IN WRONG PLACE"); } @@ -281,25 +285,25 @@ extends GregtechMeta_MultiBlockBase { } } } - } + } return tAmount >= 16; } @SuppressWarnings("static-method") - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + public boolean ignoreController(final Block tTileEntity) { + if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) { return true; } return false; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -309,7 +313,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java index 5aa49c8395..08f186b992 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -1,6 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,145 +16,143 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialCokeOven - extends GregtechMeta_MultiBlockBase { - private int mLevel = 0; +extends GregtechMeta_MultiBlockBase { + private int mLevel = 0; - public GregtechMetaTileEntity_IndustrialCokeOven(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + public GregtechMetaTileEntity_IndustrialCokeOven(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GregtechMetaTileEntity_IndustrialCokeOven(String aName) { - super(aName); - } + public GregtechMetaTileEntity_IndustrialCokeOven(final String aName) { + super(aName); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName); - } + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName); + } - @Override + @Override public String[] getDescription() { - return new String[]{"Processes Logs and Coal into Charcoal and Coal Coke.", - "Controller Block for the Industrial Coke Oven", - "Size: 3x3x3 (Hollow)", - "Controller (front middle at bottom)", - "8x Heat Resistant/Proof Coils (middle Layer, hollow)", - "1x Input (one of bottom)", - "1x Output (one of bottom)", - "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", - "1x Muffler Hatch (top middle)", - "Structural Coke Oven Casings for the rest", - CORE.GT_Tooltip}; - } + return new String[]{"Processes Logs and Coal into Charcoal and Coal Coke.", + "Controller Block for the Industrial Coke Oven", + "Size: 3x3x3 (Hollow)", + "Controller (front middle at bottom)", + "8x Heat Resistant/Proof Coils (middle Layer, hollow)", + "1x Input Hatch (one of bottom)", + "1x Output Hatch (one of bottom)", + "1x Input Bus (one of bottom)", + "1x Output Bus (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Structural Coke Oven Casings for the rest", + CORE.GT_Tooltip}; + } - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1]}; - } + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1]}; + } - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); - } + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "CokeOven.png"); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes; - - } + return Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes; + + } - /* @Override + /* @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; }*/ - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + @Override + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - updateSlots(); - //Utils.LOG_INFO("Coke oven: True"); - return true; - } - } - //Utils.LOG_INFO("Coke oven: False"); - return false; - } + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.updateSlots(); + //Utils.LOG_INFO("Coke oven: True"); + return true; + } + } + //Utils.LOG_INFO("Coke oven: False"); + return false; + } /*public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { @@ -176,101 +178,101 @@ public class GregtechMetaTileEntity_IndustrialCokeOven return false; }*/ - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int xr = aBaseMetaTileEntity.getXCoord(); - int yr = aBaseMetaTileEntity.getYCoord(); - int zr = aBaseMetaTileEntity.getZCoord(); - this.mLevel = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), GTID+1); + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int xr = aBaseMetaTileEntity.getXCoord(); + int yr = aBaseMetaTileEntity.getYCoord(); + int zr = aBaseMetaTileEntity.getZCoord(); + this.mLevel = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), GTID+1); - byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); - switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; - } - this.mOutputItems = new ItemStack[12 * this.mLevel]; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - for (int j = -1; j < 2; j++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - if ((xDir + i != 0) || (zDir + j != 0)) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, GTID+1)) && (!addInputToMachineList(tTileEntity, GTID+1)) && (!addOutputToMachineList(tTileEntity, GTID+1)) && (!addEnergyInputToMachineList(tTileEntity, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { - return false; - } - } - } - } - } - return true; - } + final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); + switch (tUsedMeta) { + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + return false; + } + this.mOutputItems = new ItemStack[12 * this.mLevel]; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { + return false; + } + } + } + } + for (int i = -1; i < 2; i++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + for (int j = -1; j < 2; j++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, GTID+1)) && (!this.addInputToMachineList(tTileEntity, GTID+1)) && (!this.addOutputToMachineList(tTileEntity, GTID+1)) && (!this.addEnergyInputToMachineList(tTileEntity, GTID+1))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { + return false; + } + } + } + } + } + return true; + } - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } - /* @Override + /* @Override public int getDamageToComponent(ItemStack aStack) { return 0; }*/ - @Override + @Override public int getAmountOfOutputs() { - return 24; - } + return 24; + } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 81e2feea5c..70e0e9546e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.*; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -14,29 +19,24 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.*; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_IndustrialElectrolyzer extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialElectrolyzer(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialElectrolyzer(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialElectrolyzer(String aName) { + public GregtechMetaTileEntity_IndustrialElectrolyzer(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialElectrolyzer(this.mName); } @@ -57,7 +57,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+5], new GT_RenderedTexture(aActive ? Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE : Textures.BlockIcons.STEAM_TURBINE_SIDE)}; } @@ -65,8 +65,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "IndustrialElectrolyzer.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialElectrolyzer.png"); } @Override @@ -75,97 +75,100 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - - ArrayList<ItemStack> tInputList = getStoredInputs(); + + ArrayList<ItemStack> tInputList = this.getStoredInputs(); GT_Recipe mLastRecipe; @Override - public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { tOut[h] = tRecipe.getOutput(h).copy(); tOut[h].stackSize = 0; } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + FluidStack tFOut = null; + if (tRecipe.getFluidOutput(0) != null) { + tFOut = tRecipe.getFluidOutput(0).copy(); + } for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) { for (int g = 0; g < 1; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } } } } if (tFOut != null) { - int tSize = tFOut.amount; + final int tSize = tFOut.amount; tFOut.amount = tSize * 1; } - - List<ItemStack> overStacks = new ArrayList<ItemStack>(); + + final List<ItemStack> overStacks = new ArrayList<>(); for (int f = 0; f < tOut.length; f++) { if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); + final ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); @@ -177,66 +180,68 @@ extends GregtechMeta_MultiBlockBase { tmp = overStacks.toArray(tmp); tOut = ArrayUtils.addAll(tOut, tmp); } - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); + final List<ItemStack> tSList = new ArrayList<>(); + for (final ItemStack tS : tOut) { + if (tS.stackSize > 0) { + tSList.add(tS); + } } tOut = tSList.toArray(new ItemStack[tSList.size()]); this.mOutputItems = tOut; this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); - - /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.updateSlots(); + + /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; updateSlots();*/ - return true; - } - } - return false; - } + return true; + } + } + return false; + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 20) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); - } - } + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 62)) && (!addMufflerToMachineList(tTileEntity, 62)) && (!addInputToMachineList(tTileEntity, 62)) && (!addOutputToMachineList(tTileEntity, 62)) && (!addEnergyInputToMachineList(tTileEntity, 62))) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { - return false; - } - tAmount++; - } - } - } - } - } - return tAmount >= 16; - } + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 62)) && (!this.addMufflerToMachineList(tTileEntity, 62)) && (!this.addInputToMachineList(tTileEntity, 62)) && (!this.addOutputToMachineList(tTileEntity, 62)) && (!this.addEnergyInputToMachineList(tTileEntity, 62))) { + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -246,7 +251,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java index 34832d0bc5..497e2979f8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,9 +17,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.*; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -27,16 +26,16 @@ public class GregtechMetaTileEntity_IndustrialMacerator extends GregtechMeta_MultiBlockBase { private static boolean controller; - public GregtechMetaTileEntity_IndustrialMacerator(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialMacerator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialMacerator(String aName) { + public GregtechMetaTileEntity_IndustrialMacerator(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialMacerator(this.mName); } @@ -44,7 +43,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Maceration Stack", - "Size[WxHxL]: 3x6x3 (Hollow)", + "Size[WxHxL]: 3x6x3 (Hollow)", "Controller (Center Bottom)", "1x Input Bus (Any bottom layer casing)", "5x Output Bus (Any casing besides bottom layer)", @@ -55,7 +54,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[64], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_MatterFab_Active : TexturesGtBlock.Overlay_MatterFab)}; } @@ -63,8 +62,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MacerationStack.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MacerationStack.png"); } @Override @@ -78,41 +77,41 @@ extends GregtechMeta_MultiBlockBase { }*/ @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.3f + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 1.2F - tRandom.nextFloat() * 1.6F, 0.0D, 0.0D, 0.0D); + final Random tRandom = aBaseMetaTileEntity.getWorld().rand; + aBaseMetaTileEntity.getWorld().spawnParticle("smoke", (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F), (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D); } } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ); } } @Override public void startProcess() { - sendLoopStart((byte) 1); + this.sendLoopStart((byte) 1); } @Override - public boolean checkRecipe(ItemStack aStack) { - + public boolean checkRecipe(final ItemStack aStack) { + //Get inputs. - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -121,41 +120,41 @@ extends GregtechMeta_MultiBlockBase { } } } - + //Temp var - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); //Don't check the recipe if someone got around the output bus size check. if (this.mOutputBusses.size() != 5){ return false; } - + //Make a recipe instance for the rest of the method. - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); - - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { Utils.LOG_WARNING("Valid Recipe found - size "+tRecipe.mOutputs.length); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; this.mEUt = (-tRecipe.mEUt); this.mMaxProgresstime = Math.max(1, (tRecipe.mDuration/5)); - ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length]; + final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length]; for (int i = 0; i < tRecipe.mOutputs.length; i++){ if (i==0) { Utils.LOG_WARNING("Adding the default output"); outputs[0] = tRecipe.getOutput(i); } - else if (getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ + else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ Utils.LOG_WARNING("Adding a bonus output"); - outputs[i] = tRecipe.getOutput(i); + outputs[i] = tRecipe.getOutput(i); } else { Utils.LOG_WARNING("Adding null output"); @@ -164,8 +163,8 @@ extends GregtechMeta_MultiBlockBase { } this.mOutputItems = outputs; - sendLoopStart((byte) 20); - updateSlots(); + this.sendLoopStart((byte) 20); + this.updateSlots(); return true; } } @@ -173,9 +172,9 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { return false; } @@ -184,10 +183,10 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { for (int h = 0; h < 6; h++) { - if (!(i == 0 && j == 0 && (h > 0 && h < 5)))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) + if (!((i == 0) && (j == 0) && ((h > 0) && (h < 5))))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 64)) && (!addInputToMachineList(tTileEntity, 64)) && (!addOutputToMachineList(tTileEntity, 64)) && (!addEnergyInputToMachineList(tTileEntity, 64)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 64)) && (!this.addInputToMachineList(tTileEntity, 64)) && (!this.addOutputToMachineList(tTileEntity, 64)) && (!this.addEnergyInputToMachineList(tTileEntity, 64)) && (!this.ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Returned False 1"); return false; @@ -202,18 +201,18 @@ extends GregtechMeta_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 5) { + if ((this.mOutputHatches.size() != 0) || (this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 5)) { Utils.LOG_INFO("Returned False 3"); return false; } - int height = this.getBaseMetaTileEntity().getYCoord(); + final int height = this.getBaseMetaTileEntity().getYCoord(); if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) { Utils.LOG_INFO("height: "+height+" | Returned False 4"); return false; } - GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; + final GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; for (int i = 0; i < this.mOutputBusses.size(); i++) { - int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; + final int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; if (tmpHatches[hatchNumber] == null) { tmpHatches[hatchNumber] = this.mOutputBusses.get(i); } else { @@ -228,20 +227,20 @@ extends GregtechMeta_MultiBlockBase { return tAmount >= 26; } - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + public boolean ignoreController(final Block tTileEntity) { + if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) { return true; } return false; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -251,7 +250,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java index 96095698fa..5b56a4357c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -1,6 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -14,10 +18,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -26,16 +26,16 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialPlatePress(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialPlatePress(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialPlatePress(String aName) { + public GregtechMetaTileEntity_IndustrialPlatePress(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialPlatePress(this.mName); } @@ -54,7 +54,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+4], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -62,8 +62,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MaterialPress.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MaterialPress.png"); } @Override @@ -72,118 +72,118 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - @Override - public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); - Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); + @Override + public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); + Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (2500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - updateSlots(); - return true; - } - } - return false; - } + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (2500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.updateSlots(); + return true; + } + } + return false; + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 20) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); - } - } + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 61)) && (!addMufflerToMachineList(tTileEntity, 61)) && (!addInputToMachineList(tTileEntity, 61)) && (!addOutputToMachineList(tTileEntity, 61)) && (!addEnergyInputToMachineList(tTileEntity, 61))) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 4))) { - return false; - } - tAmount++; - } - } - } - } - } - return tAmount >= 16; - } + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 61)) && (!this.addMufflerToMachineList(tTileEntity, 61)) && (!this.addInputToMachineList(tTileEntity, 61)) && (!this.addOutputToMachineList(tTileEntity, 61)) && (!this.addEnergyInputToMachineList(tTileEntity, 61))) { + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 4))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -193,7 +193,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java index 8f928a9590..4e80445dcc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,9 +14,6 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.player.InventoryPlayer; @@ -22,26 +21,26 @@ import net.minecraft.item.ItemStack; public class GregtechMetaTileEntity_IndustrialSinter extends GT_MetaTileEntity_MultiBlockBase { - + RenderBlocks asdasd = RenderBlocks.getInstance(); - - public GregtechMetaTileEntity_IndustrialSinter(int aID, String aName, String aNameRegional) { + + public GregtechMetaTileEntity_IndustrialSinter(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialSinter(String aName) { + public GregtechMetaTileEntity_IndustrialSinter(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialSinter(this.mName); } @Override public String[] getDescription() { - return new String[]{ + return new String[]{ "Controller Block for the Industrial Sinter Furnace", "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", @@ -54,7 +53,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -62,8 +61,8 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "WireFactory.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @Override @@ -72,30 +71,30 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (final ItemStack tInput : tInputList) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; @@ -109,7 +108,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); + this.updateSlots(); return true; } } @@ -118,22 +117,22 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int controllerX = aBaseMetaTileEntity.getXCoord(); - int controllerY = aBaseMetaTileEntity.getYCoord(); - int controllerZ = aBaseMetaTileEntity.getZCoord(); + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int controllerX = aBaseMetaTileEntity.getXCoord(); + final int controllerY = aBaseMetaTileEntity.getYCoord(); + final int controllerZ = aBaseMetaTileEntity.getZCoord(); - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3)))) { + final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { int tAirCount = 0; for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { for (byte k = -1; k < 2; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getAirOffset(i, j, k)) { + if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) { Utils.LOG_INFO("Found Air at: "+(controllerX+i)+" "+(controllerY+k)+" "+(controllerZ+k)); //if (aBaseMetaTileEntity.getWorld().isRemote){ - //asdasd.renderStandardBlock(ModBlocks.MatterFabricatorEffectBlock, (controllerX+i), (controllerY+k), (controllerZ+k)); - //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.YELLOW_GREEN); + //asdasd.renderStandardBlock(ModBlocks.MatterFabricatorEffectBlock, (controllerX+i), (controllerY+k), (controllerZ+k)); + //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.YELLOW_GREEN); //} tAirCount++; } @@ -147,16 +146,16 @@ extends GT_MetaTileEntity_MultiBlockBase { for (byte i = 2; i < 6; i = (byte) (i + 1)) { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY), (controllerZ), Color.LIME_GREEN); IGregTechTileEntity tTileEntity; - if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && - (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && + if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && + (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialSinter))) { //Utils.LOG_INFO("False 1"); return false; } } - int tX = getBaseMetaTileEntity().getXCoord(); - int tY = getBaseMetaTileEntity().getYCoord(); - int tZ = getBaseMetaTileEntity().getZCoord(); + final int tX = this.getBaseMetaTileEntity().getXCoord(); + final int tY = this.getBaseMetaTileEntity().getYCoord(); + final int tZ = this.getBaseMetaTileEntity().getZCoord(); for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { if ((i != 0) || (j != 0)) { @@ -164,15 +163,15 @@ extends GT_MetaTileEntity_MultiBlockBase { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.ORANGE); if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.TOMATO); - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } - else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!addEnergyInputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { + if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } + else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { Utils.LOG_INFO("False 2"); return false; } - } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } + } + else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } else { Utils.LOG_INFO("False 3"); return false; @@ -181,26 +180,26 @@ extends GT_MetaTileEntity_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputHatches.size() != 0) { + if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() != 0)) { Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output."); return false; } - if (this.mInputBusses.size() != 2 || this.mOutputBusses.size() != 2) { + if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) { Utils.LOG_INFO("Incorrect amount of Input & Output busses."); return false; - } + } this.mMaintenanceHatches.clear(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 4); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4); if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back."); return false; } } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1) { + if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) { Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches."); return false; } @@ -213,17 +212,17 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -233,7 +232,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @@ -251,11 +250,11 @@ extends GT_MetaTileEntity_MultiBlockBase { return 63; } - private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex()))); } - private boolean addEnergyInputToMachineList(IGregTechTileEntity tTileEntity) { - return ((addEnergyInputToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java index ca300ba277..15dbb35dd3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -14,31 +16,28 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GregtechMetaTileEntity_IndustrialWireMill extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialWireMill(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialWireMill(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialWireMill(String aName) { + public GregtechMetaTileEntity_IndustrialWireMill(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialWireMill(this.mName); } @Override public String[] getDescription() { - return new String[]{ + return new String[]{ "Controller Block for the Industrial Wire Factory", "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", @@ -51,7 +50,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -59,8 +58,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "WireFactory.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @Override @@ -69,47 +68,47 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (final ItemStack tInput : tInputList) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); if (tRecipe != null) { - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), new ItemStack[]{tInput}); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), new ItemStack[]{tInput}); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - - if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.updateSlots(); + return true; } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; - } } } } @@ -117,14 +116,14 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3)))) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { int tAirCount = 0; for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { for (byte k = -1; k < 2; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getAirOffset(i, j, k)) { + if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) { tAirCount++; } } @@ -136,30 +135,30 @@ extends GregtechMeta_MultiBlockBase { } for (byte i = 2; i < 6; i = (byte) (i + 1)) { IGregTechTileEntity tTileEntity; - if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && - (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && + if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && + (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialWireMill))) { //Utils.LOG_INFO("False 1"); return false; } } - int tX = getBaseMetaTileEntity().getXCoord(); - int tY = getBaseMetaTileEntity().getYCoord(); - int tZ = getBaseMetaTileEntity().getZCoord(); + final int tX = this.getBaseMetaTileEntity().getXCoord(); + final int tY = this.getBaseMetaTileEntity().getYCoord(); + final int tZ = this.getBaseMetaTileEntity().getZCoord(); for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { if ((i != 0) || (j != 0)) { for (byte k = 0; k < 5; k = (byte) (k + 1)) { if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) { - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } - else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!addEnergyInputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { + if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } + else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { Utils.LOG_INFO("False 2"); return false; } - } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } + } + else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } else { Utils.LOG_INFO("False 3"); return false; @@ -168,26 +167,26 @@ extends GregtechMeta_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputHatches.size() != 0) { + if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() != 0)) { Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output."); return false; } - if (this.mInputBusses.size() != 2 || this.mOutputBusses.size() != 2) { + if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) { Utils.LOG_INFO("Incorrect amount of Input & Output busses."); return false; - } + } this.mMaintenanceHatches.clear(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 4); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4); if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back."); return false; } } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1) { + if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) { Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches."); return false; } @@ -200,12 +199,12 @@ extends GregtechMeta_MultiBlockBase { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -215,7 +214,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @@ -233,11 +232,11 @@ extends GregtechMeta_MultiBlockBase { return 63; } - private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex()))); } - - private boolean addEnergyInputToMachineList(IGregTechTileEntity tTileEntity) { - return ((addEnergyInputToMachineList(tTileEntity, getCasingTextureIndex()))); + + private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java index aa7aecc8c5..be28d3ef72 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java @@ -24,357 +24,357 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_IronBlastFurnace - extends MetaTileEntity { - private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)}; - private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - public int mMaxProgresstime = 0; - public int mUpdate = 30; - public int mProgresstime = 0; - public boolean mMachine = false; - public ItemStack mOutputItem1; - public ItemStack mOutputItem2; - - public GregtechMetaTileEntity_IronBlastFurnace(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 4); - } - - public GregtechMetaTileEntity_IronBlastFurnace(String aName) { - super(aName, 4); - } - - @Override +extends MetaTileEntity { + private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)}; + private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + public int mMaxProgresstime = 0; + public int mUpdate = 30; + public int mProgresstime = 0; + public boolean mMachine = false; + public ItemStack mOutputItem1; + public ItemStack mOutputItem2; + + public GregtechMetaTileEntity_IronBlastFurnace(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 4); + } + + public GregtechMetaTileEntity_IronBlastFurnace(final String aName) { + super(aName, 4); + } + + @Override public String[] getDescription() { - return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!", - "Multiblock: 3x3x5 hollow with opening on top", - "40 Iron Plated Bricks required", - "----", - "Even though Iron melts hotter than bronze,", - "this machine is to help players skip looking", - "for tin and copper, which are not as common", - "as Iron is. This machine takes 5x longer than the bronze", - "blast furnace as a result.", - "----", - CORE.GT_Tooltip}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return aActive ? FACING_ACTIVE : FACING_FRONT; - } - return FACING_SIDE; - } - - @Override + return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!", + "Multiblock: 3x3x5 hollow with opening on top", + "40 Iron Plated Bricks required", + "----", + "Even though Iron melts hotter than bronze,", + "this machine is to help players skip looking", + "for tin and copper, which are not as common", + "as Iron is. This machine takes 5x longer than the bronze", + "blast furnace as a result.", + "----", + CORE.GT_Tooltip}; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return aActive ? FACING_ACTIVE : FACING_FRONT; + } + return FACING_SIDE; + } + + @Override public boolean isSteampowered() { - return false; - } + return false; + } - @Override + @Override public boolean isElectric() { - return false; - } + return false; + } - @Override + @Override public boolean isPneumatic() { - return false; - } + return false; + } - @Override + @Override public boolean isEnetInput() { - return false; - } + return false; + } - @Override + @Override public boolean isEnetOutput() { - return false; - } + return false; + } - @Override - public boolean isInputFacing(byte aSide) { - return false; - } + @Override + public boolean isInputFacing(final byte aSide) { + return false; + } - @Override - public boolean isOutputFacing(byte aSide) { - return false; - } + @Override + public boolean isOutputFacing(final byte aSide) { + return false; + } - @Override + @Override public boolean isTeleporterCompatible() { - return false; - } + return false; + } - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } - @Override + @Override public int getProgresstime() { - return this.mProgresstime; - } + return this.mProgresstime; + } - @Override + @Override public int maxProgresstime() { - return this.mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - this.mProgresstime += aProgress; - return this.mMaxProgresstime - this.mProgresstime; - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IronBlastFurnace(this.mName); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", this.mProgresstime); - aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); - if (this.mOutputItem1 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem1.writeToNBT(tNBT); - aNBT.setTag("mOutputItem1", tNBT); - } - if (this.mOutputItem2 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem2.writeToNBT(tNBT); - aNBT.setTag("mOutputItem2", tNBT); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mUpdate = 30; - this.mProgresstime = aNBT.getInteger("mProgresstime"); - this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); - this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - private boolean checkMachine() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 4; j++) { //This is height - for (int k = -1; k < 2; k++) { - if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) { - if ((i != 0) || (j == -1) || (k != 0)) { - if ((getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { - return false; - } - } else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { - return false; - } - } - } - } - } - return true; - } - - @Override + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(final int aProgress) { + this.mProgresstime += aProgress; + return this.mMaxProgresstime - this.mProgresstime; + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); + } + + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IronBlastFurnace(this.mName); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + if (this.mOutputItem1 != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem1.writeToNBT(tNBT); + aNBT.setTag("mOutputItem1", tNBT); + } + if (this.mOutputItem2 != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem2.writeToNBT(tNBT); + aNBT.setTag("mOutputItem2", tNBT); + } + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mUpdate = 30; + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); + this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + private boolean checkMachine() { + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 4; j++) { //This is height + for (int k = -1; k < 2; k++) { + if (((xDir + i) != 0) || (j != 0) || ((zDir + k) != 0)) { + if ((i != 0) || (j == -1) || (k != 0)) { + if ((this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (this.getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { + return false; + } + } else if ((!GT_Utility.arrayContains(this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!this.getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { + return false; + } + } + } + } + } + return true; + } + + @Override public void onMachineBlockUpdate() { - this.mUpdate = 30; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if ((aBaseMetaTileEntity.isClientSide()) && - (aBaseMetaTileEntity.isActive())) { - aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); - } - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate-- == 0) { - this.mMachine = checkMachine(); - } - if (this.mMachine) { - if (this.mMaxProgresstime > 0) { - if (++this.mProgresstime >= this.mMaxProgresstime) { - addOutputProducts(); - this.mOutputItem1 = null; - this.mOutputItem2 = null; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - try { - // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); - } catch (Exception e) { - } - } - } else if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(); - } - } - aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); - if (aBaseMetaTileEntity.isActive()) { - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - } else { - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - } - } - } - - private void addOutputProducts() { - if (this.mOutputItem1 != null) { - if (this.mInventory[2] == null) { - this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); - } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { - this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); - } - } - if (this.mOutputItem2 != null) { - if (this.mInventory[3] == null) { - this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); - } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { - this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); - } - } - } - - private boolean spaceForOutput(ItemStack aStack1, ItemStack aStack2) { - if (((this.mInventory[2] == null) || (aStack1 == null) || ((this.mInventory[2].stackSize + aStack1.stackSize <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( - (this.mInventory[3] == null) || (aStack2 == null) || ((this.mInventory[3].stackSize + aStack2.stackSize <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { - return true; - } - return false; - } - - private boolean checkRecipe() { - if (!this.mMachine) { - return false; - } - if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 36000; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 4800*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 3600*5; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 1*3); - this.mMaxProgresstime = 2400*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 32400*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 64); - this.mMaxProgresstime = 64800*9; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 18*3); - this.mMaxProgresstime = 43200*5; - return true; - } - if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } - } - this.mOutputItem1 = null; - this.mOutputItem2 = null; - return false; - } - - @Override + this.mUpdate = 30; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + if ((aBaseMetaTileEntity.isClientSide()) && + (aBaseMetaTileEntity.isActive())) { + aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); + } + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mUpdate-- == 0) { + this.mMachine = this.checkMachine(); + } + if (this.mMachine) { + if (this.mMaxProgresstime > 0) { + if (++this.mProgresstime >= this.mMaxProgresstime) { + this.addOutputProducts(); + this.mOutputItem1 = null; + this.mOutputItem2 = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + try { + // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); + } catch (final Exception e) { + } + } + } else if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(); + } + } + aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); + if (aBaseMetaTileEntity.isActive()) { + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + } else { + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + } + } + } + + private void addOutputProducts() { + if (this.mOutputItem1 != null) { + if (this.mInventory[2] == null) { + this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); + } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { + this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); + } + } + if (this.mOutputItem2 != null) { + if (this.mInventory[3] == null) { + this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); + } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { + this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); + } + } + } + + private boolean spaceForOutput(final ItemStack aStack1, final ItemStack aStack2) { + if (((this.mInventory[2] == null) || (aStack1 == null) || (((this.mInventory[2].stackSize + aStack1.stackSize) <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( + (this.mInventory[3] == null) || (aStack2 == null) || (((this.mInventory[3].stackSize + aStack2.stackSize) <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { + return true; + } + return false; + } + + private boolean checkRecipe() { + if (!this.mMachine) { + return false; + } + if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 36000; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 4800*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 9); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 3600*5; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 1*3); + this.mMaxProgresstime = 2400*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 9); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 32400*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 64); + this.mMaxProgresstime = 64800*9; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 18*3); + this.mMaxProgresstime = 43200*5; + return true; + } + if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } + } + this.mOutputItem1 = null; + this.mOutputItem2 = null; + return false; + } + + @Override public boolean isGivingInformation() { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex > 1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aIndex < 2) { - } - return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); - } - - @Override + return false; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex > 1; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + if (aIndex < 2) { + } + return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); + } + + @Override public byte getTileEntityBaseType() { - return 0; - } + return 0; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java index f6e43f783a..67b592950b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,18 +20,12 @@ import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlockBase { public static int sUUAperUUM = 1; @@ -43,18 +42,18 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo GT_Recipe fakeRecipe; public int getAmplifierUsed(){ - return mAmplifierUsed; + return this.mAmplifierUsed; } public int getMatterProduced(){ - return mMatterProduced; + return this.mMatterProduced; } - public GregtechMetaTileEntity_MassFabricator(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_MassFabricator(String aName) { + public GregtechMetaTileEntity_MassFabricator(final String aName) { super(aName); } @@ -70,14 +69,14 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo "1x Output Hatch (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x Muffler Hatch (Centered 3x1x3 area in Top layer)", - "1x Energy Hatch (Any bottom layer casing)", + "1x Energy Hatch (Any bottom layer casing)", "24x IC2 Reinforced Glass for the walls", "Matter Fabricator Casings for the edges & top (40 at least!)", CORE.GT_Tooltip}; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[66], new GT_RenderedTexture(aActive ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1)}; @@ -86,12 +85,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad(final GT_Config aConfig) { super.onConfigLoad(aConfig); sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); @@ -101,18 +100,18 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { Utils.LOG_INFO("Fabricating Matter."); - if (mInputHatches.size() != 1){ - Utils.LOG_INFO("Too many input hatches. Found: "+mInputHatches.size()+" | Expected: 1"); + if (this.mInputHatches.size() != 1){ + Utils.LOG_INFO("Too many input hatches. Found: "+this.mInputHatches.size()+" | Expected: 1"); return false; } - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -120,17 +119,17 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } } - } + } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); @@ -140,16 +139,16 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); for (int scrapSlots=0;scrapSlots<tInputs.length;scrapSlots++){ - if (tInputs[scrapSlots].getItem() == scrapPile.getItem()){ + if (tInputs[scrapSlots].getItem() == this.scrapPile.getItem()){ if (tInputs[scrapSlots].stackSize >= 9 ){ Utils.LOG_INFO("Found enough scrap for a special recipe. x"+tInputs[scrapSlots].stackSize); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { if (isValidMetaTileEntity(tHatch)) { Utils.LOG_INFO("Input fluid empty - Time to generate 1UU-A."); if (tHatch.mFluid == null){ @@ -163,7 +162,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo Utils.LOG_INFO("Remaining after recipe. x"+tInputs[scrapSlots].stackSize); } } - } + } } } @@ -171,14 +170,14 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo if (tFluids.length > 0) { Utils.LOG_INFO("Input fluid found"); for(int i = 0;i<tFluids.length;i++){ - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << (tTier - 1))); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = (tRecipe.mDuration/**sDurationMultiplier*/); @@ -193,10 +192,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; this.mOutputFluids = tRecipe.mFluidOutputs.clone(); - ArrayUtils.reverse(mOutputFluids); - mMatterProduced++; - mAmplifierUsed++; - updateSlots(); + ArrayUtils.reverse(this.mOutputFluids); + this.mMatterProduced++; + this.mAmplifierUsed++; + this.updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+mMatterProduced); return true; } @@ -209,9 +208,9 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } else if (tFluids.length == 0) { Utils.LOG_INFO("Input fluid not found"); - fakeRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tempFake}, new ItemStack[]{}); + this.fakeRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{this.tempFake}, new ItemStack[]{}); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; this.mEUt = 32; @@ -225,13 +224,13 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo this.mEUt = (-this.mEUt); } - if (fakeRecipe != null) { + if (this.fakeRecipe != null) { this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{fakeRecipe.getOutput(0)}; - this.mOutputFluids = fakeRecipe.mFluidOutputs.clone(); - ArrayUtils.reverse(mOutputFluids); - mMatterProduced++; - updateSlots(); + this.mOutputItems = new ItemStack[]{this.fakeRecipe.getOutput(0)}; + this.mOutputFluids = this.fakeRecipe.mFluidOutputs.clone(); + ArrayUtils.reverse(this.mOutputFluids); + this.mMatterProduced++; + this.updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+mMatterProduced); return true; } @@ -244,16 +243,16 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { for (int h = 0; h < 4; h++) { //Utils.LOG_INFO("Logging Variables - xDir:"+xDir+" zDir:"+zDir+" h:"+h+" i:"+i+" j:"+j); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); /*if (tTileEntity != Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass"))) { Utils.LOG_INFO("h:"+h+" i:"+i+" j:"+j); double tX = tTileEntity.getXCoord(); @@ -262,7 +261,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo Utils.LOG_INFO("Found Glass at X:"+tX+" Y:"+tY+" Z:"+tZ); //return false; }*/ - if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// innerer 3x3 ohne h�he + if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {// innerer 3x3 ohne h�he if (h == 0) {// innen boden (kantal coils) if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3."); @@ -273,7 +272,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo return false; } } else if (h == 3) {// innen decke (ulv casings + input + muffler) - if ((!addMufflerToMachineList(tTileEntity, 66))) { + if ((!this.addMufflerToMachineList(tTileEntity, 66))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; @@ -291,8 +290,8 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } else {// Outer 5x5 if (h == 0) {// au�en boden (controller, output, energy, maintainance, rest ulv casings) - if ((!addMaintenanceToMachineList(tTileEntity, 66)) && (!addInputToMachineList(tTileEntity, 66)) && (!addOutputToMachineList(tTileEntity, 66)) && (!addEnergyInputToMachineList(tTileEntity, 66))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 66)) && (!this.addInputToMachineList(tTileEntity, 66)) && (!this.addOutputToMachineList(tTileEntity, 66)) && (!this.addEnergyInputToMachineList(tTileEntity, 66))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges of the bottom layer."); return false; @@ -306,7 +305,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } else {// au�en �ber boden (ulv casings) if (h == 1) { - if ((i == -2 || i == 2) && (j == -2 || j == 2)){ + if (((i == -2) || (i == 2)) && ((j == -2) || (j == 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer."); return false; @@ -317,7 +316,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - else if ((i != -2 || i != 2) && (j != -2 || j != 2)){ + else if (((i != -2) || (i != 2)) && ((j != -2) || (j != 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != IC2Glass) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); return false; @@ -325,7 +324,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } if (h == 2) { - if ((i == -2 || i == 2) && (j == -2 || j == 2)){ + if (((i == -2) || (i == 2)) && ((j == -2) || (j == 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer."); return false; @@ -336,7 +335,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - else if ((i != -2 || i != 2) && (j != -2 || j != 2)){ + else if (((i != -2) || (i != 2)) && ((j != -2) || (j != 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != IC2Glass) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the third layer."); return false; @@ -363,12 +362,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -378,12 +377,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_MassFabricator(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java index fec81aaa15..d8867f904d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -17,10 +20,6 @@ import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; @@ -32,83 +31,83 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_MultiTank extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_MultiTank(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_MultiTank(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } private short multiblockCasingCount = 0; private int mInternalSaveClock = 0; - private short storageMultiplier = 1; + private final short storageMultiplier = 1; private int maximumFluidStorage = 96000; private FluidStack internalStorageTank = null; - private NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); + private final NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); @Override public String[] getInfoData() { - ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches; + final ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches; if (!mTier.isEmpty()){ - int temp = mTier.get(0).mTier; - if (internalStorageTank == null) { + final int temp = mTier.get(0).mTier; + if (this.internalStorageTank == null) { return new String[]{ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", "Stored Fluid: No Fluid", "Internal | Current: "+Integer.toString(0) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } return new String[]{ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", - "Stored Fluid: "+internalStorageTank.getLocalizedName(), - "Internal | Current: "+Integer.toString(internalStorageTank.amount) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Stored Fluid: "+this.internalStorageTank.getLocalizedName(), + "Internal | Current: "+Integer.toString(this.internalStorageTank.amount) + "L", + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } return new String[]{ "Voltage Tier not set -" +" Large Fluid Tank", "Stored Fluid: No Fluid", "Internal | Current: "+Integer.toString(0) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); if (gtCraftingComponentsTag != null){ - + Utils.LOG_WARNING("Got Crafting Tag"); - - if (internalStorageTank != null){ - Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.setString("xFluid", internalStorageTank.getFluid().getName()); - gtCraftingComponentsTag.setInteger("xAmount", internalStorageTank.amount); - gtCraftingComponentsTag.setLong("xAmountMax", maximumFluidStorage); + if (this.internalStorageTank != null){ + Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } - else { - Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.removeTag("xFluid"); - gtCraftingComponentsTag.removeTag("xAmount"); - gtCraftingComponentsTag.removeTag("xAmountMax"); - gtCraftingComponentsTag.setLong("xAmountMax", maximumFluidStorage); + gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount); + gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage); + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } + else { + Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.removeTag("xFluid"); + gtCraftingComponentsTag.removeTag("xAmount"); + gtCraftingComponentsTag.removeTag("xAmountMax"); + gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage); - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } } } - + @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); String xFluid = null; int xAmount = 0; if (gtCraftingComponentsTag.hasNoTags()){ - if (internalStorageTank != null){ + if (this.internalStorageTank != null){ Utils.LOG_WARNING("mFluid was not null, Creating TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", internalStorageTank.amount); - gtCraftingComponentsTag.setString("xFluid", internalStorageTank.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount); + gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName()); aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); } } @@ -124,76 +123,76 @@ extends GregtechMeta_MultiBlockBase { Utils.LOG_WARNING("xAmount was not null, Loading TileEntity NBT data."); xAmount = gtCraftingComponentsTag.getInteger("xAmount"); } - if (xFluid != null && xAmount != 0){ + if ((xFluid != null) && (xAmount != 0)){ Utils.LOG_WARNING("Setting Internal Tank, loading "+xAmount+"L of "+xFluid); - setInternalTank(xFluid, xAmount); + this.setInternalTank(xFluid, xAmount); } } } - - private boolean setInternalTank(String fluidName, int amount){ - FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); + + private boolean setInternalTank(final String fluidName, final int amount){ + final FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); if (temp != null){ - if (internalStorageTank == null){ - internalStorageTank = temp; + if (this.internalStorageTank == null){ + this.internalStorageTank = temp; Utils.LOG_WARNING(temp.getFluid().getName()+" Amount: "+temp.amount+"L"); } else{ Utils.LOG_WARNING("Retained Fluid."); - Utils.LOG_WARNING(internalStorageTank.getFluid().getName()+" Amxount: "+internalStorageTank.amount+"L"); + Utils.LOG_WARNING(this.internalStorageTank.getFluid().getName()+" Amxount: "+this.internalStorageTank.amount+"L"); } - markDirty(); + this.markDirty(); return true; } return false; } - + @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - tryForceNBTUpdate(); + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + this.tryForceNBTUpdate(); super.onLeftclick(aBaseMetaTileEntity, aPlayer); } - + @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - tryForceNBTUpdate(); + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + this.tryForceNBTUpdate(); return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } - + @Override public void onRemoval() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.onRemoval(); } - + @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (internalStorageTank.amount >= maximumFluidStorage){ - if (internalStorageTank.amount > maximumFluidStorage){ - internalStorageTank.amount = (int) maximumFluidStorage; + if (this.internalStorageTank.amount >= this.maximumFluidStorage){ + if (this.internalStorageTank.amount > this.maximumFluidStorage){ + this.internalStorageTank.amount = this.maximumFluidStorage; } this.stopMachine(); } - - if (mInternalSaveClock != 20){ - mInternalSaveClock++; + + if (this.mInternalSaveClock != 20){ + this.mInternalSaveClock++; } else { - mInternalSaveClock = 0; - tryForceNBTUpdate(); + this.mInternalSaveClock = 0; + this.tryForceNBTUpdate(); } - } + } - public GregtechMetaTileEntity_MultiTank(String aName) { + public GregtechMetaTileEntity_MultiTank(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_MultiTank(this.mName); } @@ -201,11 +200,11 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Multitank", - "Size: 3xHx3 (Block behind controller must be air)", + "Size: 3xHx3 (Block behind controller must be air)", "Structure must be at least 4 blocks tall, maximum 20.", "Each casing within the structure adds 96000L storage.", "Controller (front centered)", - "1x Input hatch (anywhere)", + "1x Input hatch (anywhere)", "1x Output hatch (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", @@ -214,7 +213,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Screen_Logo : TexturesGtBlock.Overlay_Machine_Screen_Logo)}; } @@ -222,8 +221,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "VacuumFreezer.png"); } @Override @@ -232,18 +231,18 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -252,13 +251,13 @@ extends GregtechMeta_MultiBlockBase { } } } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); @@ -267,92 +266,93 @@ extends GregtechMeta_MultiBlockBase { } } } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1); + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1); if (tFluids.length >= 2){ Utils.LOG_WARNING("Bad"); return false; } - ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>>(); + final ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<>(); int slotInputCount = 0; - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { boolean containsFluid = false; if (isValidMetaTileEntity(tHatch)) { slotInputCount++; for (int i=0; i<tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { - if (tHatch.canTankBeEmptied()){containsFluid=true;} + if (tHatch.canTankBeEmptied()){containsFluid=true;} } - rList.add(new Pair<GT_MetaTileEntity_Hatch_Input, Boolean>(tHatch, containsFluid)); + rList.add(new Pair<>(tHatch, containsFluid)); } } - if (tFluids.length <= 0 || slotInputCount > 1){ + if ((tFluids.length <= 0) || (slotInputCount > 1)){ Utils.LOG_WARNING("Bad"); return false; } - Utils.LOG_WARNING("Okay - 2"); - if (internalStorageTank == null){ - Utils.LOG_WARNING("Okay - 3"); - if (rList.get(0).getKey().mFluid != null && rList.get(0).getKey().mFluid.amount > 0){ - Utils.LOG_WARNING("Okay - 4"); - Utils.LOG_WARNING("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount /*+" internalStorageTank:"+internalStorageTank.amount*/); - FluidStack tempFluidStack = rList.get(0).getKey().mFluid; - Fluid tempFluid = tempFluidStack.getFluid(); - internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount); + Utils.LOG_WARNING("Okay - 2"); + if (this.internalStorageTank == null){ + Utils.LOG_WARNING("Okay - 3"); + if ((rList.get(0).getKey().mFluid != null) && (rList.get(0).getKey().mFluid.amount > 0)){ + Utils.LOG_WARNING("Okay - 4"); + Utils.LOG_WARNING("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount /*+" internalStorageTank:"+internalStorageTank.amount*/); + final FluidStack tempFluidStack = rList.get(0).getKey().mFluid; + final Fluid tempFluid = tempFluidStack.getFluid(); + this.internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount); rList.get(0).getKey().mFluid.amount = 0; - Utils.LOG_WARNING("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+internalStorageTank.amount); + Utils.LOG_WARNING("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+this.internalStorageTank.amount); return true; } Utils.LOG_WARNING("No Fluid in hatch."); - return false; + return false; } - else if (internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){ + else if (this.internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){ Utils.LOG_WARNING("Storing "+rList.get(0).getKey().mFluid.amount+"L"); - Utils.LOG_WARNING("Contains "+internalStorageTank.amount+"L"); + Utils.LOG_WARNING("Contains "+this.internalStorageTank.amount+"L"); int tempAdd = 0; tempAdd = rList.get(0).getKey().getFluidAmount(); - rList.get(0).getKey().mFluid = null; + rList.get(0).getKey().mFluid = null; Utils.LOG_WARNING("adding "+tempAdd); - internalStorageTank.amount = internalStorageTank.amount + tempAdd; - Utils.LOG_WARNING("Tank now Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + this.internalStorageTank.amount = this.internalStorageTank.amount + tempAdd; + Utils.LOG_WARNING("Tank now Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+"."); //Utils.LOG_WARNING("Tank"); return true; } else { - FluidStack superTempFluidStack = rList.get(0).getKey().mFluid; - Utils.LOG_WARNING("is input fluid equal to stored fluid? "+(internalStorageTank.isFluidEqual(superTempFluidStack))); - if (superTempFluidStack != null) + final FluidStack superTempFluidStack = rList.get(0).getKey().mFluid; + Utils.LOG_WARNING("is input fluid equal to stored fluid? "+(this.internalStorageTank.isFluidEqual(superTempFluidStack))); + if (superTempFluidStack != null) { Utils.LOG_WARNING("Input hatch[0] Contains "+superTempFluidStack.amount+"L of "+superTempFluidStack.getFluid().getName()+"."); - Utils.LOG_WARNING("Large Multi-Tank Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + } + Utils.LOG_WARNING("Large Multi-Tank Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+"."); - if (internalStorageTank.amount <= 0){ + if (this.internalStorageTank.amount <= 0){ Utils.LOG_WARNING("Internal Tank is empty, sitting idle."); return false; } - if (mOutputHatches.get(0).mFluid == null || mOutputHatches.isEmpty() || (mOutputHatches.get(0).mFluid.isFluidEqual(internalStorageTank) && mOutputHatches.get(0).mFluid.amount < mOutputHatches.get(0).getCapacity())){ - Utils.LOG_WARNING("Okay - 3"); - int tempCurrentStored = internalStorageTank.amount; + if ((this.mOutputHatches.get(0).mFluid == null) || this.mOutputHatches.isEmpty() || (this.mOutputHatches.get(0).mFluid.isFluidEqual(this.internalStorageTank) && (this.mOutputHatches.get(0).mFluid.amount < this.mOutputHatches.get(0).getCapacity()))){ + Utils.LOG_WARNING("Okay - 3"); + final int tempCurrentStored = this.internalStorageTank.amount; int tempResult = 0; - int tempHatchSize = mOutputHatches.get(0).getCapacity(); - int tempHatchCurrentHolding = mOutputHatches.get(0).getFluidAmount(); - int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; - FluidStack tempOutputFluid = internalStorageTank; + final int tempHatchSize = this.mOutputHatches.get(0).getCapacity(); + final int tempHatchCurrentHolding = this.mOutputHatches.get(0).getFluidAmount(); + final int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; + final FluidStack tempOutputFluid = this.internalStorageTank; if (tempHatchRemainingSpace <= 0){ return false; } - Utils.LOG_WARNING("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + Utils.LOG_WARNING("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); if (tempHatchSize >= tempHatchRemainingSpace){ - Utils.LOG_WARNING("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + Utils.LOG_WARNING("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); int adder; - if (tempCurrentStored > 0 && tempCurrentStored <= tempHatchSize){ + if ((tempCurrentStored > 0) && (tempCurrentStored <= tempHatchSize)){ adder = tempCurrentStored; if (adder >= tempHatchRemainingSpace){ adder = tempHatchRemainingSpace; @@ -367,11 +367,11 @@ extends GregtechMeta_MultiBlockBase { tempResult = adder; tempOutputFluid.amount = tempResult; - Utils.LOG_WARNING("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored: "+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName()); - mOutputHatches.get(0).fill(tempOutputFluid, true); + Utils.LOG_WARNING("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored: "+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName()); + this.mOutputHatches.get(0).fill(tempOutputFluid, true); //mOutputHatches.get(0).mFluid.amount = tempResult; - internalStorageTank.amount = (tempCurrentStored-adder); - Utils.LOG_WARNING("Okay - 3.1.3"+" internalTankStorage: "+internalStorageTank.amount +"L | output hatch contains: "+mOutputHatches.get(0).mFluid.amount+"L of "+mOutputHatches.get(0).mFluid.getFluid().getName()); + this.internalStorageTank.amount = (tempCurrentStored-adder); + Utils.LOG_WARNING("Okay - 3.1.3"+" internalTankStorage: "+this.internalStorageTank.amount +"L | output hatch contains: "+this.mOutputHatches.get(0).mFluid.amount+"L of "+this.mOutputHatches.get(0).mFluid.getFluid().getName()); /*if (internalStorageTank.amount <= 0) internalStorageTank = null;*/ } @@ -379,15 +379,15 @@ extends GregtechMeta_MultiBlockBase { return true; } } - //this.getBaseMetaTileEntity().(tFluids[0].amount, true); + //this.getBaseMetaTileEntity().(tFluids[0].amount, true); Utils.LOG_WARNING("Tank"); return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { Utils.LOG_WARNING("Must be hollow."); return false; @@ -396,9 +396,9 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { for (int h = -1; h < 19; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 68)) && (!addInputToMachineList(tTileEntity, 68)) && (!addOutputToMachineList(tTileEntity, 68)) && (!addEnergyInputToMachineList(tTileEntity, 68))) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 68)) && (!this.addInputToMachineList(tTileEntity, 68)) && (!this.addOutputToMachineList(tTileEntity, 68)) && (!this.addEnergyInputToMachineList(tTileEntity, 68))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { if (h < 3){ Utils.LOG_WARNING("Casing Expected."); @@ -421,7 +421,7 @@ extends GregtechMeta_MultiBlockBase { tAmount++; } else if (h >= 3){ - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){ + if ((aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air) || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){ Utils.LOG_WARNING("Found air"); } else { @@ -434,21 +434,21 @@ extends GregtechMeta_MultiBlockBase { } } } - multiblockCasingCount = (short) tAmount; - maximumFluidStorage = getMaximumTankStorage(tAmount); + this.multiblockCasingCount = (short) tAmount; + this.maximumFluidStorage = getMaximumTankStorage(tAmount); Utils.LOG_INFO("Your Multitank can be 20 blocks tall."); - Utils.LOG_INFO("Casings Count: "+multiblockCasingCount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+maximumFluidStorage+"L"); - tryForceNBTUpdate(); + Utils.LOG_INFO("Casings Count: "+this.multiblockCasingCount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+this.maximumFluidStorage+"L"); + this.tryForceNBTUpdate(); return tAmount >= 16; } - + /*public int countCasings() { Utils.LOG_INFO("Counting Machine Casings"); try{ if (this.getBaseMetaTileEntity().getWorld() == null){ Utils.LOG_INFO("Tile Entity's world was null for casing count."); return 0; - } + } if (this.getBaseMetaTileEntity() == null){ Utils.LOG_INFO("Tile Entity was null for casing count."); return 0; @@ -515,12 +515,12 @@ extends GregtechMeta_MultiBlockBase { }*/ @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -530,29 +530,29 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - - private static short getStorageMultiplier(int casingCount){ - int tsm = 1*casingCount; - if (tsm <= 0){ - return 1; + + private static short getStorageMultiplier(final int casingCount){ + final int tsm = 1*casingCount; + if (tsm <= 0){ + return 1; } return (short) tsm; } - - private static int getMaximumTankStorage(int casingCount){ - int multiplier = getStorageMultiplier(casingCount); - int tempTankStorageMax = 96000*multiplier; + + private static int getMaximumTankStorage(final int casingCount){ + final int multiplier = getStorageMultiplier(casingCount); + final int tempTankStorageMax = 96000*multiplier; if (tempTankStorageMax <= 0){return 96000;} return tempTankStorageMax; } - + private boolean tryForceNBTUpdate(){ //Block is invalid. - if (this == null || this.getBaseMetaTileEntity() == null){ + if ((this == null) || (this.getBaseMetaTileEntity() == null)){ Utils.LOG_WARNING("Block was not valid for saving data."); return false; } @@ -564,17 +564,17 @@ extends GregtechMeta_MultiBlockBase { //Internal Tag was not valid. try{ - if (internalCraftingComponentsTag == null){ - Utils.LOG_WARNING("Internal NBT data tag was null."); - return false; - } - } catch (NullPointerException x){ + if (this.internalCraftingComponentsTag == null){ + Utils.LOG_WARNING("Internal NBT data tag was null."); + return false; + } + } catch (final NullPointerException x){ Utils.LOG_WARNING("Caught null NBT."); } //Internal tag was valid. - saveNBTData(internalCraftingComponentsTag); - + this.saveNBTData(this.internalCraftingComponentsTag); + //Mark block for update int x,y,z = 0; @@ -585,6 +585,6 @@ extends GregtechMeta_MultiBlockBase { //Mark block dirty, let chunk know it's data has changed and it must be saved to disk. (Albeit slowly) this.getBaseMetaTileEntity().markDirty(); - return true; + return true; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java index 45635ea74d..a924e1418d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java @@ -17,13 +17,13 @@ import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTileEntity_MultiBlockBase { - private int recipeCounter = 0; + private final int recipeCounter = 0; - public GregtechMetaTileEntity_PowerSubStationController(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_PowerSubStationController(String aName) { + public GregtechMetaTileEntity_PowerSubStationController(final String aName) { super(aName); } @@ -37,7 +37,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[67], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; @@ -46,31 +46,31 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad(final GT_Config aConfig) { super.onConfigLoad(aConfig); } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { for (int h = 0; h < 4; h++) { //Utils.LOG_INFO("Logging Variables - xDir:"+xDir+" zDir:"+zDir+" h:"+h+" i:"+i+" j:"+j); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); /*if (tTileEntity != Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass"))) { Utils.LOG_INFO("h:"+h+" i:"+i+" j:"+j); double tX = tTileEntity.getXCoord(); @@ -79,8 +79,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Found Glass at X:"+tX+" Y:"+tY+" Z:"+tZ); //return false; }*/ - if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// innerer 3x3 ohne h�he - if (h == 0 && i != 0 && j != 0) {// innen boden (kantal coils) + if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {// innerer 3x3 ohne h�he + if ((h == 0) && (i != 0) && (j != 0)) {// innen boden (kantal coils) if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3. - Wrong Block"); Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); @@ -92,24 +92,24 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3. - Wrong Meta"); return false; } - } - else if (h == 3 && i != 0 && j != 0) {// innen decke (ulv casings + input + muffler) - //if(j == 0 && i == 0) { - - if ((!addMufflerToMachineList(tTileEntity, 66))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); - Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 4) { - Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); - Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); - return false; - } - } + } + else if ((h == 3) && (i != 0) && (j != 0)) {// innen decke (ulv casings + input + muffler) + //if(j == 0 && i == 0) { + + if ((!this.addMufflerToMachineList(tTileEntity, 66))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 4) { + Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); + return false; + } + } //} - + } /*else {// top air if ((i != -2 && i != 2) && (j != -2 && j != 2) && h == 3) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { @@ -123,12 +123,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Matter Generation Coils missings from the top layer, inner 3x3. - Wrong Meta"); return false; } - } + } }*/ } else {// Outer 5x5 if (h == 0) {// au�en boden (controller, output, energy, maintainance, rest ulv casings) - if ((!addEnergyInputToMachineList(tTileEntity, 66) && (!addDynamoToMachineList(tTileEntity, 66)))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addEnergyInputToMachineList(tTileEntity, 66) && (!this.addDynamoToMachineList(tTileEntity, 66)))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges of the bottom layer. "+(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName())); @@ -141,7 +141,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } } } else { - + } } } @@ -152,22 +152,22 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -177,12 +177,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_PowerSubStationController(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java index 5ff1239ce3..2b58c09daa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2.GTID; + +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -12,9 +15,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -25,14 +25,15 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc private boolean completedCycle = false; - public GregtechMetaTileEntity_Refinery(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_Refinery(String aName) { + public GregtechMetaTileEntity_Refinery(final String aName) { super(aName); } + @Override public String[] getDescription() { return new String[]{ "Controller Block for the Fission Fuel Processing Unit", @@ -49,21 +50,23 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc "1x Energy Hatch (One of base platform)"}; } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+2], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; } return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+2]}; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LFTR.png"); + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "LFTR.png"); } @Override - public boolean checkRecipe(ItemStack aStack) { - if (mInventory[1] == null || (mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && mInventory[1].stackSize < mInventory[1].getMaxStackSize())) { - ArrayList<ItemStack> tItems = getStoredInputs(); + public boolean checkRecipe(final ItemStack aStack) { + if ((this.mInventory[1] == null) || (this.mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && (this.mInventory[1].stackSize < this.mInventory[1].getMaxStackSize()))) { + final ArrayList<ItemStack> tItems = this.getStoredInputs(); for (ItemStack tStack : tItems) { if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) { if (tStack.stackSize < 2) { @@ -73,10 +76,10 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc } } - if (mInventory[1] == null) { - mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); + if (this.mInventory[1] == null) { + this.mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); } else { - mInventory[1].stackSize++; + this.mInventory[1].stackSize++; } } } @@ -84,28 +87,29 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc if (tFluid == null) { return false; } - if (getYOfPumpHead() > 0 && getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) { - if (completedCycle) { - moveOneDown(); + if ((this.getYOfPumpHead() > 0) && (this.getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX, this.getYOfPumpHead() - 1 - this.getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock)) { + if (this.completedCycle) { + this.moveOneDown(); } tFluid = null; - if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4)) - completedCycle = true; + if ((this.mEnergyHatches.size() > 0) && (this.mEnergyHatches.get(0).getEUVar() > (512 + (this.getMaxInputVoltage() * 4)))) { + this.completedCycle = true; + } } else if (tFluid.amount < 5000) { - stopMachine(); + this.stopMachine(); return false; } else { tFluid.amount = tFluid.amount / 5000; } - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; - int tEU = 24; - int tDuration = 160; + final int tEU = 24; + final int tDuration = 160; if (tEU <= 16) { - this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tDuration / (1 << tTier - 1)); + this.mEUt = (tEU * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tDuration / (1 << (tTier - 1))); } else { this.mEUt = tEU; this.mMaxProgresstime = tDuration; @@ -127,89 +131,89 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc || (!GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L)))) { return false; } - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int yHead = getYOfPumpHead(); + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + final int yHead = this.getYOfPumpHead(); if (yHead < 1) { return false; } - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) { + if (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, this.getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) { return false; } - if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { + if (!(this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { return false; } - if (yHead != getBaseMetaTileEntity().getYCoord()) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); + if (yHead != this.getBaseMetaTileEntity().getYCoord()) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); } - getBaseMetaTileEntity().decrStackSize(1, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 1); return true; } private int getYOfPumpHead() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int y = getBaseMetaTileEntity().getYCoord() - 1; - while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + int y = this.getBaseMetaTileEntity().getYCoord() - 1; + while (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { y--; } - if (y == getBaseMetaTileEntity().getYCoord() - 1) { - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { + if (y == (this.getBaseMetaTileEntity().getYCoord() - 1)) { + if (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { return y + 1; } - } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility - .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[1] != null && this.mInventory[1].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir, + } else if ((this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility + .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) && (this.mInventory[1] != null) && (this.mInventory[1].stackSize > 0) && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))); - getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(0, 1); } return y; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - int Y = 0; - if ((xDir + i != 0) || (zDir + j != 0)) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); - if ((!addToMachineList(tTileEntity, GTID+2)) && (!addEnergyInputToMachineList(tTileEntity, GTID+1))) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + int Y = 0; + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); + if ((!this.addToMachineList(tTileEntity, GTID+2)) && (!this.addEnergyInputToMachineList(tTileEntity, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { - Utils.LOG_INFO("Wrong Block."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { - Utils.LOG_INFO("Wrong Meta 1."); - return false; - } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Wrong Block."); + return false; } - else { - Utils.LOG_INFO("Added Hatch. "+tTileEntity.getInventoryName()); + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { + Utils.LOG_INFO("Wrong Meta 1."); + return false; } } - Y = 1; - Utils.LOG_INFO("Checking at Y+1 as well."); - IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); - if ((!addToMachineList(tTileEntity2, GTID+2)) && (!addEnergyInputToMachineList(tTileEntity2, GTID+1))) { + else { + Utils.LOG_INFO("Added Hatch. "+tTileEntity.getInventoryName()); + } + } + Y = 1; + Utils.LOG_INFO("Checking at Y+1 as well."); + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); + if ((!this.addToMachineList(tTileEntity2, GTID+2)) && (!this.addEnergyInputToMachineList(tTileEntity2, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { - Utils.LOG_INFO("Wrong Block."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { - Utils.LOG_INFO("Wrong Meta 1."); - return false; - } - } - else { - Utils.LOG_INFO("Added Hatch. "+tTileEntity2.getInventoryName()); - } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Wrong Block."); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { + Utils.LOG_INFO("Wrong Meta 1."); + return false; + } + } + else { + Utils.LOG_INFO("Added Hatch. "+tTileEntity2.getInventoryName()); } } - + } + for (int y = 2; y < 6; y++) { if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir) != ModBlocks.blockCasings2Misc) { //Must Define meta for center blocks Utils.LOG_INFO("Wrong Block."); @@ -290,39 +294,39 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc return false; } } - - if (mInputHatches.size() != 4 || mOutputHatches.size() != 2 || - mOutputBusses.size() != 1 || mMufflerHatches.size() != 1 || - mMaintenanceHatches.size() != 2 || mEnergyHatches.size() < 1){ + + if ((this.mInputHatches.size() != 4) || (this.mOutputHatches.size() != 2) || + (this.mOutputBusses.size() != 1) || (this.mMufflerHatches.size() != 1) || + (this.mMaintenanceHatches.size() != 2) || (this.mEnergyHatches.size() < 1)){ Utils.LOG_INFO("Wrong Hatch count."); return false; } - if (mMufflerHatches.size() == 1){ - if (mMufflerHatches.get(0).mTier < 7){ + if (this.mMufflerHatches.size() == 1){ + if (this.mMufflerHatches.get(0).mTier < 7){ Utils.LOG_INFO("Your Muffler must be AT LEAST ZPM tier or higher."); } } - Utils.LOG_INFO("Multiblock Formed."); + Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -332,11 +336,12 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_Refinery(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 6cd65437cb..1e502be52c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -20,81 +20,81 @@ extends GT_MetaTileEntity_BasicTank { private String mFluidName; private int mFluidAmount; - private NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); + private final NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); - public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid"); + public GT_MetaTileEntity_TieredTank(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((aTier+1) * 32000) + "L of fluid"); } - public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); + public GT_MetaTileEntity_TieredTank(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 3, "Stores " + ((aTier+1) * 32000) + "L of fluid", aTextures); } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; } - @Override + /*@Override public String[] getDescription() { //setVars(); - if ((mFluidName.equals("Empty")||mFluidName.equals("")) || mFluidAmount <= 0){ - return new String[] {mDescription, CORE.GT_Tooltip}; + if ((this.mFluidName.equals("Empty")||this.mFluidName.equals("")) || (this.mFluidAmount <= 0)){ + return new String[] {"Stores " + (this.mTier * 32000) + "L of fluid", CORE.GT_Tooltip}; } - return new String[] {mDescription, "Stored Fluid: "+mFluidName, "Stored Amount: "+mFluidAmount+"l", CORE.GT_Tooltip}; - } + return new String[] {"Stores " + (this.mTier * 32000) + "L of fluid", "Stored Fluid: "+this.mFluidName, "Stored Amount: "+this.mFluidAmount+"l", CORE.GT_Tooltip}; + }*/ @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); if (gtCraftingComponentsTag != null){ - + Utils.LOG_WARNING("Got Crafting Tag"); - - if (mFluid != null){ - Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", mFluid.amount); - gtCraftingComponentsTag.setString("xFluid", mFluid.getFluid().getName()); - mFluidName = mFluid.getFluid().getName(); - - //Backup the current tag - //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); - //internalCraftingComponentsTag = gtCraftingComponentsTag; - - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } - else { - Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.removeTag("xFluid"); - gtCraftingComponentsTag.removeTag("xAmount"); - - //Backup the current tag - //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); - //internalCraftingComponentsTag = gtCraftingComponentsTag; - - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } + + if (this.mFluid != null){ + Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.setInteger("xAmount", this.mFluid.amount); + gtCraftingComponentsTag.setString("xFluid", this.mFluid.getFluid().getName()); + this.mFluidName = this.mFluid.getFluid().getName(); + + //Backup the current tag + //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); + //internalCraftingComponentsTag = gtCraftingComponentsTag; + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } + else { + Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.removeTag("xFluid"); + gtCraftingComponentsTag.removeTag("xAmount"); + + //Backup the current tag + //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); + //internalCraftingComponentsTag = gtCraftingComponentsTag; + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } } } @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); String xFluid = null; int xAmount = 0; if (gtCraftingComponentsTag.hasNoTags()){ - if (mFluid != null){ + if (this.mFluid != null){ Utils.LOG_WARNING("mFluid was not null, Creating TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", mFluid.amount); - gtCraftingComponentsTag.setString("xFluid", mFluid.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.mFluid.amount); + gtCraftingComponentsTag.setString("xFluid", this.mFluid.getFluid().getName()); aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); } } @@ -110,26 +110,26 @@ extends GT_MetaTileEntity_BasicTank { Utils.LOG_WARNING("xAmount was not null, Loading TileEntity NBT data."); xAmount = gtCraftingComponentsTag.getInteger("xAmount"); } - if (xFluid != null && xAmount != 0){ + if ((xFluid != null) && (xAmount != 0)){ Utils.LOG_WARNING("Setting Internal Tank, loading "+xAmount+"L of "+xFluid); - setInternalTank(xFluid, xAmount); + this.setInternalTank(xFluid, xAmount); } } } - private boolean setInternalTank(String fluidName, int amount){ - FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); + private boolean setInternalTank(final String fluidName, final int amount){ + final FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); if (temp != null){ - if (mFluid == null){ - mFluid = temp; + if (this.mFluid == null){ + this.mFluid = temp; Utils.LOG_WARNING(temp.getFluid().getName()+" Amount: "+temp.amount+"L"); } else{ Utils.LOG_WARNING("Retained Fluid."); - Utils.LOG_WARNING(mFluid.getFluid().getName()+" Amxount: "+mFluid.amount+"L"); + Utils.LOG_WARNING(this.mFluid.getFluid().getName()+" Amxount: "+this.mFluid.amount+"L"); } - markDirty(); + this.markDirty(); return true; } return false; @@ -138,19 +138,19 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final int maxDrain, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(maxDrain, doDrain); } @Override - public int fill(FluidStack aFluid, boolean doFill) { - tryForceNBTUpdate(); + public int fill(final FluidStack aFluid, final boolean doFill) { + this.tryForceNBTUpdate(); return super.fill(aFluid, doFill); } @Override - public void setItemNBT(NBTTagCompound aNBT) { + public void setItemNBT(final NBTTagCompound aNBT) { super.setItemNBT(aNBT); Utils.LOG_WARNING("setItemNBT"); //aNBT.setTag("GT.CraftingComponents", lRecipeStuff); @@ -159,32 +159,32 @@ extends GT_MetaTileEntity_BasicTank { @Override public void closeInventory() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.closeInventory(); } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - tryForceNBTUpdate(); + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, + final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + this.tryForceNBTUpdate(); return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ //setVars(); return true; } aBaseMetaTileEntity.openGUI(aPlayer); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); return true; } @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { super.onLeftclick(aBaseMetaTileEntity, aPlayer); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); } @Override @@ -193,12 +193,12 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return true; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @@ -240,20 +240,20 @@ extends GT_MetaTileEntity_BasicTank { @Override public String[] getInfoData() { - if (mFluid == null) { + if (this.mFluid == null) { return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank", "Stored Fluid:", "No Fluid", Integer.toString(0) + "L", - Integer.toString(getCapacity()) + "L"}; + Integer.toString(this.getCapacity()) + "L"}; } return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank", "Stored Fluid:", - mFluid.getLocalizedName(), - Integer.toString(mFluid.amount) + "L", - Integer.toString(getCapacity()) + "L"}; + this.mFluid.getLocalizedName(), + Integer.toString(this.mFluid.amount) + "L", + Integer.toString(this.getCapacity()) + "L"}; } @Override @@ -262,13 +262,13 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TieredTank(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override public int getCapacity() { - return (int) (Math.pow(2, mTier) * 32000); + return (int) (Math.pow(2, this.mTier) * 32000); } @Override @@ -284,52 +284,52 @@ extends GT_MetaTileEntity_BasicTank { @Override public void onRemoval() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.onRemoval(); } @Override public void onCloseGUI() { super.onCloseGUI(); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(aSide, aFluid, doDrain); } @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final ForgeDirection aSide, final int maxDrain, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(aSide, maxDrain, doDrain); } @Override - public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { - tryForceNBTUpdate(); + public int fill(final ForgeDirection arg0, final FluidStack arg1, final boolean arg2) { + this.tryForceNBTUpdate(); return super.fill(arg0, arg1, arg2); } @Override - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - tryForceNBTUpdate(); + public int fill_default(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + this.tryForceNBTUpdate(); return super.fill_default(aSide, aFluid, doFill); } private int mInternalSaveClock = 0; @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (mInternalSaveClock != 20){ - mInternalSaveClock++; + if (this.mInternalSaveClock != 20){ + this.mInternalSaveClock++; } else { - mInternalSaveClock = 0; - tryForceNBTUpdate(); + this.mInternalSaveClock = 0; + this.tryForceNBTUpdate(); } } @@ -337,7 +337,7 @@ extends GT_MetaTileEntity_BasicTank { private void tryForceNBTUpdate(){ //Block is invalid. - if (this == null || this.getBaseMetaTileEntity() == null){ + if ((this == null) || (this.getBaseMetaTileEntity() == null)){ Utils.LOG_WARNING("Block was not valid for saving data."); return; } @@ -348,7 +348,7 @@ extends GT_MetaTileEntity_BasicTank { } //Internal Tag was not valid. - if (internalCraftingComponentsTag == null){ + if (this.internalCraftingComponentsTag == null){ Utils.LOG_WARNING("Internal NBT data tag was null."); return; } @@ -360,12 +360,12 @@ extends GT_MetaTileEntity_BasicTank { //Internal tag was valid and contains tags. if (!this.internalCraftingComponentsTag.hasNoTags()){ Utils.LOG_WARNING("Found tags to save."); - saveNBTData(internalCraftingComponentsTag); + this.saveNBTData(this.internalCraftingComponentsTag); } //Internal tag has no tags. else { - Utils.LOG_WARNING("Found no tags to save."); - saveNBTData(internalCraftingComponentsTag); + Utils.LOG_WARNING("Found no tags to save."); + this.saveNBTData(this.internalCraftingComponentsTag); } //Mark block for update @@ -376,7 +376,7 @@ extends GT_MetaTileEntity_BasicTank { this.getBaseMetaTileEntity().getWorld().markBlockForUpdate(x, y, z); //Mark block dirty, let chunk know it's data has changed and it must be saved to disk. (Albeit slowly) - this.getBaseMetaTileEntity().markDirty(); + this.getBaseMetaTileEntity().markDirty(); } }
\ No newline at end of file |