diff options
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
44 files changed, 3238 insertions, 3580 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 0bc1201827..36d4aadcd5 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -48,14 +48,14 @@ import gregtech.common.covers.CoverInfo; * This is the main TileEntity for EVERYTHING. */ public class BaseMetaPipeEntity extends CommonMetaTileEntity - implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity { + implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity { public byte mConnections = IConnectable.NO_CONNECTION; protected MetaPipeEntity mMetaTileEntity; private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; private boolean mWorkUpdate = false, mWorks = true; private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, - mLagWarningCount = 0; + mLagWarningCount = 0; private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0; protected Node node; protected NodePath nodePath; @@ -196,9 +196,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~IConnectable.CONNECTED_ALL)); // If foam not hardened, tries roll chance to harden if ((mConnections & IConnectable.HAS_FOAM) == IConnectable.HAS_FRESHFOAM - && getRandomNumber(1000) == 0) { + && getRandomNumber(1000) == 0) { mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) - | IConnectable.HAS_HARDENEDFOAM); + | IConnectable.HAS_HARDENEDFOAM); } if (mTickTimer > 12 && oldConnections != mConnections) GregTech_API.causeCableUpdate(worldObj, xCoord, yCoord, zCoord); @@ -235,10 +235,10 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) - | ((mSidedRedstone[2] > 0) ? 4 : 0) - | ((mSidedRedstone[3] > 0) ? 8 : 0) - | ((mSidedRedstone[4] > 0) ? 16 : 0) - | ((mSidedRedstone[5] > 0) ? 32 : 0)); + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)); if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); } @@ -257,23 +257,23 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (isServerSide() && hasValidMetaTileEntity()) { tTime = System.nanoTime() - tTime; if (mTimeStatistics.length > 0) mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) - % mTimeStatistics.length] = (int) tTime; + % mTimeStatistics.length] = (int) tTime; if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L) - && mTickTimer > 1000 - && getMetaTileEntity().doTickProfilingMessageDuringThisTick() - && mLagWarningCount++ < 10) + && mTickTimer > 1000 + && getMetaTileEntity().doTickProfilingMessageDuringThisTick() + && mLagWarningCount++ < 10) GT_FML_LOGGER.warn( - "WARNING: Possible Lag Source at [" + xCoord - + "," - + yCoord - + "," - + zCoord - + "] in Dimension " - + worldObj.provider.dimensionId - + " with " - + tTime - + " ns caused by an instance of " - + getMetaTileEntity().getClass()); + "WARNING: Possible Lag Source at [" + xCoord + + "," + + yCoord + + "," + + zCoord + + "] in Dimension " + + worldObj.provider.dimensionId + + " with " + + tTime + + " ns caused by an instance of " + + getMetaTileEntity().getClass()); } mWorkUpdate = mInventoryChanged = false; @@ -282,36 +282,35 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity private void sendClientData() { if (mSendClientData) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_TileEntity( - xCoord, - (short) yCoord, - zCoord, - mID, - getCoverInfoAtSide((byte) 0).getCoverID(), - getCoverInfoAtSide((byte) 1).getCoverID(), - getCoverInfoAtSide((byte) 2).getCoverID(), - getCoverInfoAtSide((byte) 3).getCoverID(), - getCoverInfoAtSide((byte) 4).getCoverID(), - getCoverInfoAtSide((byte) 5).getCoverID(), - oTextureData = mConnections, - oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, - oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) - | ((mSidedRedstone[1] > 0) ? 2 : 0) - | ((mSidedRedstone[2] > 0) ? 4 : 0) - | ((mSidedRedstone[3] > 0) ? 8 : 0) - | ((mSidedRedstone[4] > 0) ? 16 : 0) - | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor), + worldObj, + new GT_Packet_TileEntity( xCoord, - zCoord); + (short) yCoord, + zCoord, + mID, + getCoverInfoAtSide((byte) 0).getCoverID(), + getCoverInfoAtSide((byte) 1).getCoverID(), + getCoverInfoAtSide((byte) 2).getCoverID(), + getCoverInfoAtSide((byte) 3).getCoverID(), + getCoverInfoAtSide((byte) 4).getCoverID(), + getCoverInfoAtSide((byte) 5).getCoverID(), + oTextureData = mConnections, + oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, + oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)), + oColor = mColor), + xCoord, + zCoord); mSendClientData = false; } sendCoverDataIfNeeded(); } public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, - int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { + int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { issueTextureUpdate(); if (aID > 0 && mID != aID) { mID = aID; @@ -384,14 +383,14 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 3) { tList.add( - "Meta-ID: " + EnumChatFormatting.BLUE - + mID - + EnumChatFormatting.RESET - + (hasValidMetaTileEntity() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) - + (mMetaTileEntity == null - ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET - : " ")); + "Meta-ID: " + EnumChatFormatting.BLUE + + mID + + EnumChatFormatting.RESET + + (hasValidMetaTileEntity() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + + (mMetaTileEntity == null + ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET + : " ")); } if (aLogLevel > 1) { if (mTimeStatistics.length > 0) { @@ -404,30 +403,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity } } tList.add( - "Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) - + "ns since " - + mTimeStatistics.length - + " ticks with worst time of " - + tWorstTime - + "ns."); + "Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + + "ns since " + + mTimeStatistics.length + + " ticks with worst time of " + + tWorstTime + + "ns."); } if (mLagWarningCount > 0) { tList.add( - "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) - + " Lag Spike Warnings (anything taking longer than " - + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING - + "ms) on the Server."); + "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + + " Lag Spike Warnings (anything taking longer than " + + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + + "ms) on the Server."); } if (mMetaTileEntity != null) { tList.add( - "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " - : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you"); + "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " + : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you"); } } if (joinedIc2Enet) tList.add("Joined IC2 ENet"); return mMetaTileEntity != null ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) - : new ArrayList<>(); + : new ArrayList<>(); } @Override @@ -467,9 +466,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity public void setInventorySlotContents(int aIndex, ItemStack aStack) { markDirty(); mInventoryChanged = true; - if (canAccessData()) mMetaTileEntity.setInventorySlotContents( - aIndex, - worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + if (canAccessData()) mMetaTileEntity + .setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } @Override @@ -498,9 +496,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { return hasValidMetaTileEntity() && mTickTimer > 40 - && getTileEntityOffset(0, 0, 0) == this - && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 - && mMetaTileEntity.isAccessAllowed(aPlayer); + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && mMetaTileEntity.isAccessAllowed(aPlayer); } @Override @@ -735,12 +733,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity else if (tConnections == IConnectable.CONNECTED_NORTH || tConnections == IConnectable.CONNECTED_SOUTH) tConnections = (byte) (IConnectable.CONNECTED_NORTH | IConnectable.CONNECTED_SOUTH); if (hasValidMetaTileEntity()) return mMetaTileEntity.getTexture( - this, - aSide, - tConnections, - (byte) (mColor - 1), - tConnections == 0 || (tConnections & (1 << aSide)) != 0, - getOutputRedstoneSignal(aSide) > 0); + this, + aSide, + tConnections, + (byte) (mColor - 1), + tConnections == 0 || (tConnections & (1 << aSide)) != 0, + getOutputRedstoneSignal(aSide) > 0); return Textures.BlockIcons.ERROR_RENDERING; } @@ -782,7 +780,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) - : aSide; + : aSide; return (getCoverInfoAtSide(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; @@ -792,7 +790,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { if (getColorization() >= 0 - && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { mMetaTileEntity.markDirty(); tCurrentItem.func_150996_a(Items.bucket); setColorization((byte) -1); @@ -804,13 +802,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -818,34 +816,34 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (getCoverIDAtSide(aSide) == 0 && getCoverIDAtSide(tSide) != 0) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { setCoverDataAtSide( - tSide, - getCoverInfoAtSide(tSide).onCoverScrewdriverClick(aPlayer, 0.5F, 0.5F, 0.5F)); + tSide, + getCoverInfoAtSide(tSide).onCoverScrewdriverClick(aPlayer, 0.5F, 0.5F, 0.5F)); mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ); mMetaTileEntity.markDirty(); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } } else { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { setCoverDataAtSide( - aSide, - getCoverInfoAtSide(aSide).onCoverScrewdriverClick(aPlayer, aX, aY, aZ)); + aSide, + getCoverInfoAtSide(aSide).onCoverScrewdriverClick(aPlayer, aX, aY, aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); mMetaTileEntity.markDirty(); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } } return true; @@ -865,18 +863,18 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity else enableWorking(); mMetaTileEntity.markDirty(); GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("090", "Machine Processing: ") - + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled"))); + aPlayer, + GT_Utility.trans("090", "Machine Processing: ") + + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") + : GT_Utility.trans("087", "Disabled"))); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -886,13 +884,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } doEnetUpdate(); return true; @@ -903,30 +901,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mMetaTileEntity.markDirty(); mStrongRedstone ^= (1 << tSide); GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("091", "Redstone Output at Side ") + tSide - + GT_Utility.trans("092", " set to: ") - + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") - : GT_Utility.trans("094", "Weak"))); + aPlayer, + GT_Utility.trans("091", "Redstone Output at Side ") + tSide + + GT_Utility.trans("092", " set to: ") + + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") + : GT_Utility.trans("094", "Weak"))); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 3.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 3.0F, + -1, + xCoord, + yCoord, + zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -941,19 +939,19 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (coverInfo.getCoverID() == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) - && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { + .isCoverPlaceable(coverSide, tCurrentItem, this) + && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); mMetaTileEntity.markDirty(); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -961,13 +959,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_BREAK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); mMetaTileEntity.markDirty(); } @@ -1055,7 +1053,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { return canAccessData() && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) - && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); + && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } /** @@ -1064,11 +1062,11 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { return canAccessData() && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut( - (byte) aSide, - getCoverIDAtSide((byte) aSide), - getComplexCoverDataAtSide((byte) aSide), - aIndex, - this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); } @Override @@ -1199,12 +1197,10 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) return false; if (isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)) - return true; + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)) return true; if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)) - return true; + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)) return true; return false; } @@ -1212,7 +1208,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) { if (mTickTimer > 5 && canAccessData() - && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) + && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) return mMetaTileEntity.fill(aSide, aFluidStack, doFill); return 0; } @@ -1220,12 +1216,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { if (mTickTimer > 5 && canAccessData() - && canMoveFluidOnSide( - aSide, - mMetaTileEntity.getFluid() == null ? null - : mMetaTileEntity.getFluid() - .getFluid(), - false)) + && canMoveFluidOnSide( + aSide, + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid(), + false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @@ -1233,7 +1229,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluidStack, boolean doDrain) { if (mTickTimer > 5 && canAccessData() - && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) + && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) return mMetaTileEntity.drain(aSide, aFluidStack, doDrain); return null; } @@ -1256,8 +1252,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { final CoverInfo coverInfo = getCoverInfoAtSide((byte) aSide.ordinal()); if (canAccessData() && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null)) - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null)) + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null)) + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null)) // Doesn't need to be connected to get Tank Info -- otherwise things can't connect )) return mMetaTileEntity.getTankInfo(aSide); return new FluidTankInfo[] {}; @@ -1273,8 +1269,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity return true; } aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize - <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { + if (GT_Utility.areStacksEqual(tStack, aStack) + && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { markDirty(); tStack.stackSize += aStack.stackSize; return true; @@ -1374,7 +1370,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index c6d74a1b35..6c18d00c8c 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -80,12 +80,10 @@ import ic2.api.Direction; * This is the main TileEntity for EVERYTHING. */ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, - IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider { + IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider { - private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper.findField( - EntityItem.class, - "health", - "field_70291_e"); + private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper + .findField(EntityItem.class, "health", "field_70291_e"); private final boolean[] mActiveEUInputs = new boolean[] { false, false, false, false, false, false }; private final boolean[] mActiveEUOutputs = new boolean[] { false, false, false, false, false, false }; private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; @@ -97,13 +95,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec protected boolean mReleaseEnergy = false; protected long[] mAverageEUInput = new long[] { 0, 0, 0, 0, 0 }, mAverageEUOutput = new long[] { 0, 0, 0, 0, 0 }; private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, - mOutputDisabled = false, mMuffler = false, mLockUpgrade = false; + mOutputDisabled = false, mMuffler = false, mLockUpgrade = false; private boolean mActive = false, mWorkUpdate = false, mSteamConverter = false, mWorks = true; private boolean oRedstone = false; private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, - oTexturePage = 0; + oTexturePage = 0; private byte oLightValueClient = 0, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, - mWorkData = 0; + mWorkData = 0; private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; private long oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; private long mLastCheckTick = 0; @@ -160,8 +158,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec else mID = mID > 0 ? mID : 0; if (mID != 0) createNewMetatileEntity(mID); mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior() - ? new byte[] { 0, 0, 0, 0, 0, 0 } - : new byte[] { 15, 15, 15, 15, 15, 15 }); + ? new byte[] { 0, 0, 0, 0, 0, 0 } + : new byte[] { 15, 15, 15, 15, 15, 15 }); } else { if (aID <= 0) mID = (short) aNBT.getInteger("mID"); else mID = aID; @@ -185,7 +183,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mInputDisabled = aNBT.getBoolean("mInputDisabled"); mOutputDisabled = aNBT.getBoolean("mOutputDisabled"); mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") - + aNBT.getByte("mLiBatteries")); + + aNBT.getByte("mLiBatteries")); mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); final int nbtVersion = aNBT.getInteger("nbtVersion"); @@ -214,13 +212,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec */ public void chargeItem(ItemStack aStack) { decreaseStoredEU( - GT_ModHandler.chargeElectricItem( - aStack, - (int) Math.min(Integer.MAX_VALUE, getStoredEU()), - (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), - false, - false), - true); + GT_ModHandler.chargeElectricItem( + aStack, + (int) Math.min(Integer.MAX_VALUE, getStoredEU()), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), + false, + false), + true); } /** @@ -228,14 +226,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec */ public void dischargeItem(ItemStack aStack) { increaseStoredEnergyUnits( - GT_ModHandler.dischargeElectricItem( - aStack, - (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), - (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), - false, - false, - false), - true); + GT_ModHandler.dischargeElectricItem( + aStack, + (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), + false, + false, + false), + true); } protected boolean isRainPossible() { @@ -255,14 +253,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec final int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord); final int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord); return (getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord - && precipitationHeightAtSide2 > -1) - || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord - && precipitationHeightAtSide3 > -1) - || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord - && precipitationHeightAtSide4 > -1) - || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord - && precipitationHeightAtSide5 > -1); + || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord + && precipitationHeightAtSide2 > -1) + || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord + && precipitationHeightAtSide3 > -1) + || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord + && precipitationHeightAtSide4 > -1) + || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord + && precipitationHeightAtSide5 > -1); } @Override @@ -385,15 +383,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - final long tOutputVoltage = Math.max( - oOutput, - oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); + final long tOutputVoltage = Math + .max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); final long tUsableAmperage = Math.min( - getOutputAmperage(), - (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); + getOutputAmperage(), + (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); if (tUsableAmperage > 0) { final long tEU = tOutputVoltage - * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); + * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); mAverageEUOutput[mAverageEUOutputIndex] += tEU; decreaseStoredEU(tEU, true); } @@ -417,30 +414,30 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (getRandomNumber(10) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj() - .getPlayerEntityByName(mOwnerName), - "badweather"); + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), + "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( - "Machine at: " + this.getXCoord() - + " | " - + this.getYCoord() - + " | " - + this.getZCoord() - + " DIMID: " - + this.worldObj.provider.dimensionId - + " explosion due to rain!"); + "Machine at: " + this.getXCoord() + + " | " + + this.getYCoord() + + " | " + + this.getZCoord() + + " DIMID: " + + this.worldObj.provider.dimensionId + + " explosion due to rain!"); doEnergyExplosion(); } else { GT_Log.exp.println( - "Machine at: " + this.getXCoord() - + " | " - + this.getYCoord() - + " | " - + this.getZCoord() - + " DIMID: " - + this.worldObj.provider.dimensionId - + " set to Fire due to rain!"); + "Machine at: " + this.getXCoord() + + " | " + + this.getYCoord() + + " | " + + this.getZCoord() + + " DIMID: " + + this.worldObj.provider.dimensionId + + " set to Fire due to rain!"); setOnFire(); } } @@ -449,22 +446,22 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return; } if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() - && getRandomNumber(3) == 0) { + && getRandomNumber(3) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj() - .getPlayerEntityByName(mOwnerName), - "badweather"); + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), + "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( - "Machine at: " + this.getXCoord() - + " | " - + this.getYCoord() - + " | " - + this.getZCoord() - + " DIMID: " - + this.worldObj.provider.dimensionId - + " explosion due to Thunderstorm!"); + "Machine at: " + this.getXCoord() + + " | " + + this.getYCoord() + + " | " + + this.getZCoord() + + " DIMID: " + + this.worldObj.provider.dimensionId + + " explosion due to Thunderstorm!"); doEnergyExplosion(); } } @@ -482,16 +479,17 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aSideServer) { if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), - k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { + k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { dischargeItem(mMetaTileEntity.mInventory[i]); if (ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]) > 0) { - if ((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue( - mMetaTileEntity.mInventory[i])) < getEUCapacity()) { + if ((getStoredEU() + + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])) + < getEUCapacity()) { increaseStoredEnergyUnits( - (long) ic2.api.info.Info.itemEnergy.getEnergyValue( - mMetaTileEntity.mInventory[i]), - false); + (long) ic2.api.info.Info.itemEnergy + .getEnergyValue(mMetaTileEntity.mInventory[i]), + false); mMetaTileEntity.mInventory[i].stackSize--; mInventoryChanged = true; } @@ -507,7 +505,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aSideServer) { if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { for (int i = mMetaTileEntity.rechargerSlotStartIndex(), - k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { + k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { chargeItem(mMetaTileEntity.mInventory[i]); if (mMetaTileEntity.mInventory[i].stackSize <= 0) { @@ -539,9 +537,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mTickTimer > 10) { byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) - | (mRedstone ? 16 : 0) - | (mLockUpgrade ? 32 : 0) - | (mWorks ? 64 : 0)); + | (mRedstone ? 16 : 0) + | (mLockUpgrade ? 32 : 0) + | (mWorks ? 64 : 0)); if (tData != oTextureData) sendBlockEvent(GregTechTileClientEvents.CHANGE_COMMON_DATA, oTextureData = tData); @@ -551,15 +549,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { tData = ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage(); if (tData != oTexturePage) sendBlockEvent( - GregTechTileClientEvents.CHANGE_CUSTOM_DATA, - (byte) ((oTexturePage = tData) | 0x80)); // set last bit as a flag for page + GregTechTileClientEvents.CHANGE_CUSTOM_DATA, + (byte) ((oTexturePage = tData) | 0x80)); // set last bit as a flag for page } if (mColor != oColor) sendBlockEvent(GregTechTileClientEvents.CHANGE_COLOR, oColor = mColor); tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) - | ((mSidedRedstone[2] > 0) ? 4 : 0) - | ((mSidedRedstone[3] > 0) ? 8 : 0) - | ((mSidedRedstone[4] > 0) ? 16 : 0) - | ((mSidedRedstone[5] > 0) ? 32 : 0)); + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)); if (tData != oRedstoneData) sendBlockEvent(GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT, oRedstoneData = tData); if (mLightValue != oLightValue) { @@ -591,23 +589,23 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aSideServer && hasValidMetaTileEntity()) { tTime = System.nanoTime() - tTime; if (mTimeStatistics.length > 0) mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) - % mTimeStatistics.length] = (int) tTime; + % mTimeStatistics.length] = (int) tTime; if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1_000_000L) - && mTickTimer > 1000 - && getMetaTileEntity().doTickProfilingMessageDuringThisTick() - && mLagWarningCount++ < 10) + && mTickTimer > 1000 + && getMetaTileEntity().doTickProfilingMessageDuringThisTick() + && mLagWarningCount++ < 10) GT_FML_LOGGER.warn( - "WARNING: Possible Lag Source at [" + xCoord - + ", " - + yCoord - + ", " - + zCoord - + "] in Dimension " - + worldObj.provider.dimensionId - + " with " - + tTime - + "ns caused by an instance of " - + getMetaTileEntity().getClass()); + "WARNING: Possible Lag Source at [" + xCoord + + ", " + + yCoord + + ", " + + zCoord + + "] in Dimension " + + worldObj.provider.dimensionId + + " with " + + tTime + + "ns caused by an instance of " + + getMetaTileEntity().getClass()); } mWorkUpdate = mInventoryChanged = mRunningThroughTick = false; @@ -615,7 +613,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { if (hasValidMetaTileEntity()) { getMetaTileEntity().getWailaBody(itemStack, currenttip, accessor, config); } @@ -624,7 +622,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); if (hasValidMetaTileEntity()) { getMetaTileEntity().getWailaNBTData(player, tile, tag, world, x, y, z); @@ -634,44 +632,42 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec private void sendClientData() { if (mSendClientData) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_TileEntity( - xCoord, - (short) yCoord, - zCoord, - mID, - getCoverInfoAtSide((byte) 0).getCoverID(), - getCoverInfoAtSide((byte) 1).getCoverID(), - getCoverInfoAtSide((byte) 2).getCoverID(), - getCoverInfoAtSide((byte) 3).getCoverID(), - getCoverInfoAtSide((byte) 4).getCoverID(), - getCoverInfoAtSide((byte) 5).getCoverID(), - oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) - | (mRedstone ? 16 : 0) - | (mLockUpgrade ? 32 : 0) - | (mWorks ? 64 : 0)), - oTexturePage = (hasValidMetaTileEntity() - && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() - : 0, - oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, - oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) - | ((mSidedRedstone[1] > 0) ? 2 : 0) - | ((mSidedRedstone[2] > 0) ? 4 : 0) - | ((mSidedRedstone[3] > 0) ? 8 : 0) - | ((mSidedRedstone[4] > 0) ? 16 : 0) - | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor), + worldObj, + new GT_Packet_TileEntity( xCoord, - zCoord); + (short) yCoord, + zCoord, + mID, + getCoverInfoAtSide((byte) 0).getCoverID(), + getCoverInfoAtSide((byte) 1).getCoverID(), + getCoverInfoAtSide((byte) 2).getCoverID(), + getCoverInfoAtSide((byte) 3).getCoverID(), + getCoverInfoAtSide((byte) 4).getCoverID(), + getCoverInfoAtSide((byte) 5).getCoverID(), + oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) + | (mRedstone ? 16 : 0) + | (mLockUpgrade ? 32 : 0) + | (mWorks ? 64 : 0)), + oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() + : 0, + oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, + oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)), + oColor = mColor), + xCoord, + zCoord); mSendClientData = false; } sendCoverDataIfNeeded(); } public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, - int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, - byte aColorData) { + int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, + byte aColorData) { issueTextureUpdate(); if (mID != aID && aID > 0) { mID = aID; @@ -694,20 +690,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Deprecated public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, - int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { + int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { receiveMetaTileEntityData( - aID, - aCover0, - aCover1, - aCover2, - aCover3, - aCover4, - aCover5, - aTextureData, - (byte) 0, - aUpdateData, - aRedstoneData, - aColorData); + aID, + aCover0, + aCover1, + aCover2, + aCover3, + aCover4, + aCover5, + aTextureData, + (byte) 0, + aUpdateData, + aRedstoneData, + aColorData); } @Override @@ -719,7 +715,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue); } catch (Throwable e) { GT_Log.err.println( - "Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + "Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); } } @@ -777,14 +773,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 2) { tList.add( - "Meta-ID: " + EnumChatFormatting.BLUE - + mID - + EnumChatFormatting.RESET - + (canAccessData() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) - + (mMetaTileEntity == null - ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET - : " ")); + "Meta-ID: " + EnumChatFormatting.BLUE + + mID + + EnumChatFormatting.RESET + + (canAccessData() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + + (mMetaTileEntity == null + ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET + : " ")); } if (aLogLevel > 1) { if (mTimeStatistics.length > 0) { @@ -799,41 +795,41 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec // tList.add("tTime " + tTime); } tList.add( - "Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) - + "ns over " - + GT_Utility.formatNumbers(mTimeStatistics.length) - + " ticks with worst time of " - + GT_Utility.formatNumbers(tWorstTime) - + "ns."); + "Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) + + "ns over " + + GT_Utility.formatNumbers(mTimeStatistics.length) + + " ticks with worst time of " + + GT_Utility.formatNumbers(tWorstTime) + + "ns."); tList.add( - "Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) - + " sound requests in " - + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) - + " ticks."); + "Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + + " sound requests in " + + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + + " ticks."); mLastCheckTick = mTickTimer; mMetaTileEntity.mSoundRequests = 0; } if (mLagWarningCount > 0) { tList.add( - "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) - + " Lag Spike Warnings (anything taking longer than " - + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING - + "ms) on the Server."); + "Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + + " Lag Spike Warnings (anything taking longer than " + + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + + "ms) on the Server."); } tList.add( - "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " - : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you"); + "Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " + : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you"); } if (aLogLevel > 0) { if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) tList.add( - GT_Utility.formatNumbers(getStoredSteam()) + " of " - + GT_Utility.formatNumbers(getSteamCapacity()) - + " Steam"); + GT_Utility.formatNumbers(getStoredSteam()) + " of " + + GT_Utility.formatNumbers(getSteamCapacity()) + + " Steam"); tList.add( - "Machine is " + (mActive ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET)); - if (!mHasEnoughEnergy) tList.add( - EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); + "Machine is " + (mActive ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET)); + if (!mHasEnoughEnergy) tList + .add(EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); } if (joinedIc2Enet) tList.add("Joined IC2 ENet"); return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); @@ -892,8 +888,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (canAccessData()) { markDirty(); mMetaTileEntity.setInventorySlotContents( - aIndex, - worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + aIndex, + worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } } @@ -923,10 +919,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { return canAccessData() && playerOwnsThis(aPlayer, false) - && mTickTimer > 40 - && getTileEntityOffset(0, 0, 0) == this - && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 - && mMetaTileEntity.isAccessAllowed(aPlayer); + && mTickTimer > 40 + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && mMetaTileEntity.isAccessAllowed(aPlayer); } @Override @@ -1063,7 +1059,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { if (!canAccessData()) return false; return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false) - || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); + || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); } @Override @@ -1115,7 +1111,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void generatePowerNodes() { if (isServerSide() && (isEnetInput() || isEnetOutput())) { final int time = MinecraftServer.getServer() - .getTickCounter(); + .getTickCounter(); for (byte i : ALL_VALID_SIDES) { if (outputsEnergyTo(i, false) || inputEnergyFrom(i, false)) { final IGregTechTileEntity TE = getIGregTechTileEntityAtSide(i); @@ -1206,14 +1202,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public ITexture[] getTexture(Block aBlock, byte aSide) { final ITexture coverTexture = getCoverTexture(aSide); final ITexture[] textureUncovered = hasValidMetaTileEntity() - ? mMetaTileEntity.getTexture( - this, - aSide, - mFacing, - (byte) (mColor - 1), - mActive, - getOutputRedstoneSignal(aSide) > 0) - : Textures.BlockIcons.ERROR_RENDERING; + ? mMetaTileEntity + .getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) + : Textures.BlockIcons.ERROR_RENDERING; final ITexture[] textureCovered; if (coverTexture != null) { textureCovered = Arrays.copyOf(textureUncovered, textureUncovered.length + 1); @@ -1303,9 +1294,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); } else return !privateAccess() || aPlayer.getDisplayName() - .equals("Player") - || mOwnerName.equals("Player") - || mOwnerName.equals(aPlayer.getDisplayName()); + .equals("Player") || mOwnerName.equals("Player") || mOwnerName.equals(aPlayer.getDisplayName()); return true; } @@ -1317,18 +1306,18 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void doEnergyExplosion() { if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) { GT_Log.exp.println( - "Energy Explosion, injected " + getUniversalEnergyStored() - + "EU >= " - + getUniversalEnergyCapacity() / 5D - + "Capacity of the Machine!"); + "Energy Explosion, injected " + getUniversalEnergyStored() + + "EU >= " + + getUniversalEnergyCapacity() / 5D + + "Capacity of the Machine!"); doExplosion( - oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 - : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); + oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 + : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); GT_Mod.achievements.issueAchievement( - this.getWorldObj() - .getPlayerEntityByName(mOwnerName), - "electricproblems"); + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), + "electricproblems"); } } @@ -1370,16 +1359,16 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void dropItems(ItemStack tItem) { if (tItem == null) return; final EntityItem tItemEntity = new EntityItem( - this.worldObj, - this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, - new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + this.worldObj, + this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); if (tItem.hasTagCompound()) { tItemEntity.getEntityItem() - .setTagCompound( - (NBTTagCompound) tItem.getTagCompound() - .copy()); + .setTagCompound( + (NBTTagCompound) tItem.getTagCompound() + .copy()); } tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D); tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D); @@ -1428,7 +1417,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) - : aSide; + : aSide; return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; @@ -1439,21 +1428,38 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (isServerSide()) { if (!privateAccess() || aPlayer.getDisplayName() - .equalsIgnoreCase(getOwnerName())) { + .equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { if (getColorization() >= 0 - && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { tCurrentItem.func_150996_a(Items.bucket); setColorization((byte) (getColorization() >= 16 ? -2 : -1)); return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { if (aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine - && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity).setMainFacing( - GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) { + && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity) + .setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers( + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); + cableUpdateDelay = 10; + } else if (mMetaTileEntity.onWrenchRightClick( + aSide, + GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), + aPlayer, + aX, + aY, + aZ)) { + GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); + GT_Utility.sendSoundToPlayers( worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, @@ -1461,50 +1467,33 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec xCoord, yCoord, zCoord); - cableUpdateDelay = 10; - } else if (mMetaTileEntity.onWrenchRightClick( - aSide, - GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), - aPlayer, - aX, - aY, - aZ)) { - GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); - cableUpdateDelay = 10; - } + cableUpdateDelay = 10; + } return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { setCoverDataAtSide( + aSide, + getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick( aSide, - getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this, - aPlayer, - aX, - aY, - aZ)); + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1514,21 +1503,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mInputDisabled = !mInputDisabled; if (mInputDisabled) mOutputDisabled = !mOutputDisabled; GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("086", "Auto-Input: ") - + (mInputDisabled ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled") - + GT_Utility.trans("089", " Auto-Output: ") - + (mOutputDisabled ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled")))); + aPlayer, + GT_Utility.trans("086", "Auto-Input: ") + (mInputDisabled + ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled") + GT_Utility.trans("089", " Auto-Output: ") + + (mOutputDisabled ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled")))); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_ANVIL_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_ANVIL_USE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1539,20 +1527,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec else enableWorking(); { String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); + + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") + : GT_Utility.trans("087", "Disabled")); if (getMetaTileEntity() != null && getMetaTileEntity().hasAlternativeModeText()) tChat = getMetaTileEntity().getAlternativeModeText(); GT_Utility.sendChatToPlayer(aPlayer, tChat); } GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1562,29 +1550,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= (1 << tSide); GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("091", "Redstone Output at Side ") + tSide - + GT_Utility.trans("092", " set to: ") - + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") - : GT_Utility.trans("094", "Weak"))); + aPlayer, + GT_Utility.trans("091", "Redstone Output at Side ") + tSide + + GT_Utility.trans("092", " set to: ") + + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") + : GT_Utility.trans("094", "Weak"))); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_BATTERY_USE, - 3.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 3.0F, + -1, + xCoord, + yCoord, + zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -1597,13 +1585,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } doEnetUpdate(); cableUpdateDelay = 10; @@ -1616,18 +1604,18 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) - && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { + .isCoverPlaceable(coverSide, tCurrentItem, this) + && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); sendClientData(); } return true; @@ -1636,13 +1624,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_BREAK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); } return true; @@ -1651,25 +1639,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec // End item != null } else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config if possible. aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) - : aSide; + : aSide; return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this, - aPlayer); - } - - if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick( aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, - aPlayer, - aX, - aY, - aZ)) - return true; + aPlayer); + } + + if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)) return true; if (!getCoverInfoAtSide(aSide).isGUIClickable()) return false; @@ -1677,13 +1664,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { if (addMufflerUpgrade()) { GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_CLICK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_CLICK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1694,13 +1681,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_CLICK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_CLICK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1714,7 +1701,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); } catch (Throwable e) { GT_Log.err.println( - "Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + "Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); e.printStackTrace(); } @@ -1728,7 +1715,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer); } catch (Throwable e) { GT_Log.err.println( - "Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + "Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); } } @@ -1782,8 +1769,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { return canAccessData() && (mRunningThroughTick || !mInputDisabled) - && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) - && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); + && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) + && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } /** @@ -1792,13 +1779,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { return canAccessData() && (mRunningThroughTick || !mOutputDisabled) - && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut( - (byte) aSide, - getCoverIDAtSide((byte) aSide), - getComplexCoverDataAtSide((byte) aSide), - aIndex, - this) - && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); + && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) + && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); } @Override @@ -1875,9 +1862,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mMetaTileEntity = (MetaTileEntity) aMetaTileEntity; else { GT_FML_LOGGER.error( - "Unknown meta tile entity set! Class {}, inventory name {}.", - aMetaTileEntity.getClass(), - aMetaTileEntity.getInventoryName()); + "Unknown meta tile entity set! Class {}, inventory name {}.", + aMetaTileEntity.getClass(), + aMetaTileEntity.getInventoryName()); } } @@ -1952,25 +1939,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (!canAccessData() || !mMetaTileEntity.isElectric() - || !inputEnergyFrom(aSide) - || aAmperage <= 0 - || aVoltage <= 0 - || getStoredEU() >= getEUCapacity() - || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) - return 0; + || !inputEnergyFrom(aSide) + || aAmperage <= 0 + || aVoltage <= 0 + || getStoredEU() >= getEUCapacity() + || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) return 0; if (aVoltage > getInputVoltage()) { - GT_Log.exp.println( - "Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!"); + GT_Log.exp + .println("Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!"); doExplosion(aVoltage); return 0; } if (increaseStoredEnergyUnits( - aVoltage * (aAmperage = Math.min( - aAmperage, - Math.min( - mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, - 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), - true)) { + aVoltage * (aAmperage = Math.min( + aAmperage, + Math.min( + mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, + 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), + true)) { mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage; mAcceptedAmperes += aAmperage; return aAmperage; @@ -1981,9 +1967,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (!canAccessData() || !mMetaTileEntity.isElectric() - || !outputsEnergyTo(aSide) - || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) - return false; + || !outputsEnergyTo(aSide) + || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) return false; if (decreaseStoredEU(aVoltage * aAmperage, false)) { mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage; return true; @@ -2006,10 +1991,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mInputDisabled) - && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn( - aFluid == null ? null : aFluid.getFluid())))) + && (mRunningThroughTick || !mInputDisabled) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.fill(aSide, aFluid, doFill); return 0; } @@ -2017,12 +2001,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( - mMetaTileEntity.getFluid() == null ? null - : mMetaTileEntity.getFluid() - .getFluid())))) + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid())))) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @@ -2030,10 +2014,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( - aFluid == null ? null : aFluid.getFluid())))) + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.drain(aSide, aFluid, doDrain); return null; } @@ -2041,9 +2024,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean canFill(ForgeDirection aSide, Fluid aFluid) { if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mInputDisabled) - && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)))) + && (mRunningThroughTick || !mInputDisabled) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)))) return mMetaTileEntity.canFill(aSide, aFluid); return false; } @@ -2051,9 +2034,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)))) + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)))) return mMetaTileEntity.canDrain(aSide, aFluid); return false; } @@ -2063,8 +2046,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec final byte tSide = (byte) aSide.ordinal(); if (canAccessData() && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput(tSide) && getCoverInfoAtSide(tSide).letsFluidIn(null)) - || (mMetaTileEntity.isLiquidOutput(tSide) && getCoverInfoAtSide(tSide).letsFluidOut(null)))) + || (mMetaTileEntity.isLiquidInput(tSide) && getCoverInfoAtSide(tSide).letsFluidIn(null)) + || (mMetaTileEntity.isLiquidOutput(tSide) && getCoverInfoAtSide(tSide).letsFluidOut(null)))) return mMetaTileEntity.getTankInfo(aSide); return new FluidTankInfo[] {}; } @@ -2096,8 +2079,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public double getOfferedEnergy() { return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) - ? Math.max(0, oOutput) - : 0; + ? Math.max(0, oOutput) + : 0; } public void drawEnergy(double amount) { @@ -2176,8 +2159,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return true; } aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize - <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { + if (GT_Utility.areStacksEqual(tStack, aStack) + && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { tStack.stackSize += aStack.stackSize; markDirty(); return true; @@ -2235,7 +2218,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); } @@ -2271,8 +2254,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (nbtVersion < 1000000) nbtVersion *= 1000; // 4 is old GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT if (nbtVersion < configCircuitAdditionVersion && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine - && slotIndex >= 4) - slotIndex += 1; + && slotIndex >= 4) slotIndex += 1; if (mID >= 211 && mID <= 218) { // Assembler if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 2; @@ -2417,8 +2399,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public IAlignment getAlignment() { return getMetaTileEntity() instanceof IAlignmentProvider - ? ((IAlignmentProvider) getMetaTileEntity()).getAlignment() - : getMetaTileEntity() instanceof IAlignment ? (IAlignment) getMetaTileEntity() : null; + ? ((IAlignmentProvider) getMetaTileEntity()).getAlignment() + : getMetaTileEntity() instanceof IAlignment ? (IAlignment) getMetaTileEntity() : null; } @Nullable diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 3ef732b1c8..a73481d89f 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -78,7 +78,7 @@ import ic2.api.energy.event.EnergyTileUnloadEvent; * Basically everything a TileEntity should have. */ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObjectAndCoords, IIC2Enet, IGTEnet, - ITileWithModularUI, IAddGregtechLogo, IGetGUITextureSet, IAddInventorySlots { + ITileWithModularUI, IAddGregtechLogo, IGetGUITextureSet, IAddInventorySlots { protected boolean mInventoryChanged = false; @@ -108,7 +108,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje if (aPlayer.rotationPitch >= 65 && aAllowedFacings[SIDE_UP]) return SIDE_UP; if (aPlayer.rotationPitch <= -65 && aAllowedFacings[SIDE_DOWN]) return SIDE_DOWN; final byte rFacing = COMPASS_DIRECTIONS[MathHelper.floor_double(0.5D + 4.0F * aPlayer.rotationYaw / 360.0F) - & 0x3]; + & 0x3]; if (aAllowedFacings[rFacing]) return rFacing; } for (final byte tSide : ALL_VALID_SIDES) if (aAllowedFacings[tSide]) return tSide; @@ -202,7 +202,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public int getRandomNumber(int aRange) { return ThreadLocalRandom.current() - .nextInt(aRange); + .nextInt(aRange); } @Override @@ -409,8 +409,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje public Block getBlock(ChunkCoordinates aCoords) { if (worldObj == null) return Blocks.air; if (ignoreUnloadedChunks && crossedChunkBorder(aCoords) - && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) - return Blocks.air; + && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) return Blocks.air; return worldObj.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ); } @@ -473,7 +472,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje return getTileEntityAtSide(aSide); } if (mBufferedTileEntities[aSide].xCoord == tX && mBufferedTileEntities[aSide].yCoord == tY - && mBufferedTileEntities[aSide].zCoord == tZ) { + && mBufferedTileEntities[aSide].zCoord == tZ) { return mBufferedTileEntities[aSide]; } return null; @@ -530,10 +529,10 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje // update if it was / is strong powered. if (((((mStrongRedstone | oStrongRedstone) >>> dir.ordinal()) & 1) != 0) - && getBlock(x1, y1, z1).isNormalCube()) { + && getBlock(x1, y1, z1).isNormalCube()) { final int skipUpdateSide = dir.getOpposite() - .ordinal(); // Don't update this block. Still updates - // diagonal blocks twice if conditions + .ordinal(); // Don't update this block. Still updates + // diagonal blocks twice if conditions // meet. for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) { @@ -549,10 +548,10 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public final void sendBlockEvent(byte aID, byte aValue) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), - xCoord, - zCoord); + worldObj, + new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), + xCoord, + zCoord); } protected boolean crossedChunkBorder(int aX, int aZ) { @@ -662,18 +661,17 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje // Tooltip localization keys public static final String BATTERY_SLOT_TOOLTIP = "GT5U.machines.battery_slot.tooltip", - BATTERY_SLOT_TOOLTIP_ALT = "GT5U.machines.battery_slot.tooltip.alternative", - UNUSED_SLOT_TOOLTIP = "GT5U.machines.unused_slot.tooltip", - SPECIAL_SLOT_TOOLTIP = "GT5U.machines.special_slot.tooltip", - FLUID_INPUT_TOOLTIP = "GT5U.machines.fluid_input_slot.tooltip", - FLUID_OUTPUT_TOOLTIP = "GT5U.machines.fluid_output_slot.tooltip", - STALLED_STUTTERING_TOOLTIP = "GT5U.machines.stalled_stuttering.tooltip", - STALLED_VENT_TOOLTIP = "GT5U.machines.stalled_vent.tooltip", - FLUID_TRANSFER_TOOLTIP = "GT5U.machines.fluid_transfer.tooltip", - ITEM_TRANSFER_TOOLTIP = "GT5U.machines.item_transfer.tooltip", - POWER_SOURCE_KEY = "GT5U.machines.powersource.", - NEI_TRANSFER_STEAM_TOOLTIP = "GT5U.machines.nei_transfer.steam.tooltip", - NEI_TRANSFER_VOLTAGE_TOOLTIP = "GT5U.machines.nei_transfer.voltage.tooltip"; + BATTERY_SLOT_TOOLTIP_ALT = "GT5U.machines.battery_slot.tooltip.alternative", + UNUSED_SLOT_TOOLTIP = "GT5U.machines.unused_slot.tooltip", + SPECIAL_SLOT_TOOLTIP = "GT5U.machines.special_slot.tooltip", + FLUID_INPUT_TOOLTIP = "GT5U.machines.fluid_input_slot.tooltip", + FLUID_OUTPUT_TOOLTIP = "GT5U.machines.fluid_output_slot.tooltip", + STALLED_STUTTERING_TOOLTIP = "GT5U.machines.stalled_stuttering.tooltip", + STALLED_VENT_TOOLTIP = "GT5U.machines.stalled_vent.tooltip", + FLUID_TRANSFER_TOOLTIP = "GT5U.machines.fluid_transfer.tooltip", + ITEM_TRANSFER_TOOLTIP = "GT5U.machines.item_transfer.tooltip", POWER_SOURCE_KEY = "GT5U.machines.powersource.", + NEI_TRANSFER_STEAM_TOOLTIP = "GT5U.machines.nei_transfer.steam.tooltip", + NEI_TRANSFER_VOLTAGE_TOOLTIP = "GT5U.machines.nei_transfer.voltage.tooltip"; public static final int TOOLTIP_DELAY = 5; @@ -709,46 +707,45 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje if (NetworkUtils.isClient()) { final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; // noinspection unchecked - final List<String> titleLines = fontRenderer.listFormattedStringToWidth( - title, - getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); + final List<String> titleLines = fontRenderer + .listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); titleWidth = titleLines.size() > 1 ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2 - : fontRenderer.getStringWidth(title); + : fontRenderer.getStringWidth(title); // noinspection PointlessArithmeticExpression titleHeight = titleLines.size() * fontRenderer.FONT_HEIGHT + (titleLines.size() - 1) * 1; } final DrawableWidget tab = new DrawableWidget(); final TextWidget text = new TextWidget(title).setDefaultColor(getTitleColor()) - .setTextAlignment(Alignment.CenterLeft) - .setMaxWidth(titleWidth); + .setTextAlignment(Alignment.CenterLeft) + .setMaxWidth(titleWidth); if (GT_Mod.gregtechproxy.mTitleTabStyle == 1) { tab.setDrawable(getGUITextureSet().getTitleTabAngular()) - .setPos(0, -(titleHeight + TAB_PADDING) + 1) - .setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2); + .setPos(0, -(titleHeight + TAB_PADDING) + 1) + .setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight + TAB_PADDING); } else { tab.setDrawable(getGUITextureSet().getTitleTabDark()) - .setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) - .setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1); + .setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) + .setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight); } builder.widget(tab) - .widget(text); + .widget(text); } protected void addTitleItemIconStyle(ModularWindow.Builder builder, String title) { builder.widget( - new MultiChildWidget().addChild( - new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()) - .setPos(0, 0) - .setSize(24, 24)) - .addChild( - new ItemDrawable(getStackForm(1)).asWidget() - .setPos(4, 4)) - .addTooltip(title) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(0, -24 + 3)); + new MultiChildWidget().addChild( + new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()) + .setPos(0, 0) + .setSize(24, 24)) + .addChild( + new ItemDrawable(getStackForm(1)).asWidget() + .setPos(4, 4)) + .addTooltip(title) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(0, -24 + 3)); } @Override @@ -763,9 +760,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } protected int getGUIWidth() { @@ -789,12 +786,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 1) - .startFromSlot(0) - .endAtSlot(0) - .background(background) - .build() - .setPos(79, 34)); + SlotGroup.ofItemHandler(inventoryHandler, 1) + .startFromSlot(0) + .endAtSlot(0) + .background(background) + .build() + .setPos(79, 34)); } @Override @@ -806,12 +803,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .background(background) - .build() - .setPos(70, 25)); + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .background(background) + .build() + .setPos(70, 25)); } @Override @@ -823,12 +820,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .background(background) - .build() - .setPos(61, 16)); + SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(0) + .endAtSlot(8) + .background(background) + .build() + .setPos(61, 16)); } @Override @@ -840,12 +837,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .background(background) - .build() - .setPos(52, 7)); + SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .background(background) + .build() + .setPos(52, 7)); } public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) { @@ -885,9 +882,8 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje final List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); if (index < 0) { - int curIndex = GT_Utility.findMatchingStackInList( - tCircuits, - inv.getStackInSlot(ccs.getCircuitSlot())) + 1; + int curIndex = GT_Utility + .findMatchingStackInList(tCircuits, inv.getStackInSlot(ccs.getCircuitSlot())) + 1; if (clickData.mouseButton == 0) { curIndex += 1; } else { @@ -911,25 +907,25 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public List<String> getExtraTooltip() { return Arrays.asList( - EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.1")), - EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.2")), - EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.3"))); + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.1")), + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.2")), + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.3"))); } }.setOverwriteItemStackTooltip(list -> { list.removeIf( - line -> line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0")) - || line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1"))); + line -> line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0")) + || line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1"))); return list; }) - .disableShiftInsert() - .setHandlePhantomActionClient(true) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) - .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); + .disableShiftInsert() + .setHandlePhantomActionClient(true) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) + .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); } protected void openSelectCircuitDialog(ModularUIContext uiContext, AtomicBoolean dialogOpened) { @@ -940,23 +936,16 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje final List<ItemStack> circuits = ccs.getConfigurationCircuits(); uiContext.openClientWindow( - player -> new SelectItemUIFactory( - StatCollector.translateToLocal("GT5U.machines.select_circuit"), - getStackForm(0), - this::onCircuitSelected, - circuits, - GT_Utility.findMatchingStackInList(circuits, inv.getStackInSlot(ccs.getCircuitSlot()))) - .setAnotherWindow( - true, - dialogOpened) - .setGuiTint( - getGUIColorization()) - .setCurrentGetter( - () -> inv.getStackInSlot( - ccs.getCircuitSlot())) - .createWindow( - new UIBuildContext( - player))); + player -> new SelectItemUIFactory( + StatCollector.translateToLocal("GT5U.machines.select_circuit"), + getStackForm(0), + this::onCircuitSelected, + circuits, + GT_Utility.findMatchingStackInList(circuits, inv.getStackInSlot(ccs.getCircuitSlot()))) + .setAnotherWindow(true, dialogOpened) + .setGuiTint(getGUIColorization()) + .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot())) + .createWindow(new UIBuildContext(player))); } protected void onCircuitSelected(ItemStack selected) { diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java index 9bbc853963..5fa9cbfaee 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -35,7 +35,7 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement } else { if (hasValidMetaTileEntity()) getMetaTileEntity().setBaseMetaTileEntity(null); GregTech_API.METATILEENTITIES[aID].newMetaEntity(this) - .setBaseMetaTileEntity(this); + .setBaseMetaTileEntity(this); mTickTimer = 0; mID = aID; return true; diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java index 4167bf1701..f2cd7e3019 100644 --- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java @@ -64,9 +64,9 @@ import gregtech.common.covers.GT_Cover_Fluidfilter; public abstract class CoverableTileEntity extends BaseTileEntity implements ICoverable, IGregtechWailaProvider { public static final String[] COVER_DATA_NBT_KEYS = Arrays.stream(ForgeDirection.VALID_DIRECTIONS) - .mapToInt(Enum::ordinal) - .mapToObj(i -> "mCoverData" + i) - .toArray(String[]::new); + .mapToInt(Enum::ordinal) + .mapToObj(i -> "mCoverData" + i) + .toArray(String[]::new); // New Cover Information protected final CoverInfo[] coverInfos = new CoverInfo[] { null, null, null, null, null, null }; @@ -78,8 +78,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov /* Deprecated Cover Variables */ @Deprecated protected final GT_CoverBehaviorBase<?>[] mCoverBehaviors = new GT_CoverBehaviorBase<?>[] { - GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, - GregTech_API.sNoBehavior, GregTech_API.sNoBehavior }; + GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, GregTech_API.sNoBehavior }; @Deprecated protected int[] mCoverSides = new int[] { 0, 0, 0, 0, 0, 0 }; @@ -105,9 +105,9 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov // Backwards compat, in case of a revert... for now tList.appendTag(coverInfo.writeToNBT(new NBTTagCompound())); aNBT.setTag( - COVER_DATA_NBT_KEYS[i], - coverInfo.getCoverData() - .saveDataToNBT()); + COVER_DATA_NBT_KEYS[i], + coverInfo.getCoverData() + .saveDataToNBT()); } if (tList.tagCount() > 0) { aNBT.setTag(GT_Values.NBT.COVERS, tList); @@ -126,7 +126,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov protected void readCoverNBT(NBTTagCompound aNBT) { mRedstone = aNBT.getBoolean("mRedstone"); mSidedRedstone = aNBT.hasKey("mRedstoneSided") ? aNBT.getByteArray("mRedstoneSided") - : new byte[] { 15, 15, 15, 15, 15, 15 }; + : new byte[] { 15, 15, 15, 15, 15, 15 }; mStrongRedstone = aNBT.getByte("mStrongRedstone"); if (aNBT.hasKey(GT_Values.NBT.COVERS)) { @@ -148,7 +148,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov public void readLegacyCoverInfoNBT(NBTTagCompound aNBT) { final int[] coverIDs = aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") - : new int[] { 0, 0, 0, 0, 0, 0 }; + : new int[] { 0, 0, 0, 0, 0, 0 }; final boolean hasOldCoverData = (aNBT.hasKey("mCoverData", 11) && aNBT.getIntArray("mCoverData").length == 6); final int[] tOldData = hasOldCoverData ? aNBT.getIntArray("mCoverData") : new int[] {}; @@ -165,10 +165,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final String filterKey = String.format("fluidFilter%d", i); if (aNBT.hasKey(filterKey)) { coverData = coverInfo.getCoverBehavior() - .createDataObject( - (tOldData[i] & 7) - | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) - << 3)); + .createDataObject( + (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); } } else { coverData = coverBehavior.createDataObject(tOldData[i]); @@ -245,10 +243,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov return Textures.BlockIcons.HIDDEN_TEXTURE[0]; // See through } final ITexture coverTexture = (!(this instanceof BaseMetaPipeEntity)) ? coverInfo.getSpecialCoverFGTexture() - : coverInfo.getSpecialCoverTexture(); + : coverInfo.getSpecialCoverTexture(); return coverTexture != null ? coverTexture - : GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); + : GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); } protected void requestCoverDataIfNeeded() { @@ -299,9 +297,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov public void setCoverDataAtSide(byte aSide, ISerializableObject aData) { final CoverInfo coverInfo = getCoverInfoAtSide(aSide); if (coverInfo.isValid() && coverInfo.getCoverBehavior() - .cast(aData) - != null) - coverInfo.setCoverData(aData); + .cast(aData) != null) coverInfo.setCoverData(aData); } @Override @@ -315,7 +311,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverItemAtSide(byte aSide, ItemStack aCover) { GregTech_API.getCoverBehaviorNew(aCover) - .placeCover(aSide, aCover, this); + .placeCover(aSide, aCover, this); } @Override @@ -386,11 +382,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (tStack != null) { coverInfo.onDropped(); final EntityItem tEntity = new EntityItem( - worldObj, - getOffsetX(aDroppedSide, 1) + 0.5, - getOffsetY(aDroppedSide, 1) + 0.5, - getOffsetZ(aDroppedSide, 1) + 0.5, - tStack); + worldObj, + getOffsetX(aDroppedSide, 1) + 0.5, + getOffsetY(aDroppedSide, 1) + 0.5, + getOffsetZ(aDroppedSide, 1) + 0.5, + tStack); tEntity.motionX = 0; tEntity.motionY = 0; tEntity.motionZ = 0; @@ -438,18 +434,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength) { - if (!getCoverBehaviorAtSideNew(aSide).manipulatesSidedRedstoneOutput( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this)) + if (!getCoverBehaviorAtSideNew(aSide) + .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) setOutputRedstoneSignal(aSide, aStrength); } @Override public boolean getRedstone() { return IntStream.range(1, 6) - .anyMatch(i -> getRedstone((byte) i)); + .anyMatch(i -> getRedstone((byte) i)); } @Override @@ -460,15 +453,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public byte getStrongestRedstone() { return (byte) IntStream.range(1, 6) - .map(i -> getInternalInputRedstoneSignal((byte) i)) - .max() - .orElse(0); + .map(i -> getInternalInputRedstoneSignal((byte) i)) + .max() + .orElse(0); } @Override public byte getStrongOutputRedstoneSignal(byte aSide) { return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) - : 0; + : 0; } @Override @@ -479,29 +472,25 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public byte getInternalInputRedstoneSignal(byte aSide) { return (byte) (getCoverBehaviorAtSideNew(aSide).getRedstoneInput( - aSide, - getInputRedstoneSignal(aSide), - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this) & 15); + aSide, + getInputRedstoneSignal(aSide), + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this) & 15); } @Override public byte getInputRedstoneSignal(byte aSide) { - return (byte) (worldObj.getIndirectPowerLevelTo( - getOffsetX(aSide, 1), - getOffsetY(aSide, 1), - getOffsetZ(aSide, 1), - aSide) & 15); + return (byte) (worldObj + .getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15); } @Override public byte getOutputRedstoneSignal(byte aSide) { - return getCoverBehaviorAtSideNew(aSide).manipulatesSidedRedstoneOutput( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this) ? mSidedRedstone[aSide] : getGeneralRS(aSide); + return getCoverBehaviorAtSideNew(aSide) + .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this) + ? mSidedRedstone[aSide] + : getGeneralRS(aSide); } protected void updateOutputRedstoneSignal(byte aSide) { @@ -520,7 +509,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData, - EntityPlayerMP aPlayer) { + EntityPlayerMP aPlayer) { if (aCoverSide < 0 || aCoverSide >= 6) return; final CoverInfo oldCoverInfo = getCoverInfoAtSide(aCoverSide); @@ -541,10 +530,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final CoverInfo coverInfo = getCoverInfoAtSide(i); if (coverInfo.needsUpdate()) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_SendCoverData(coverInfo, this), - xCoord, - zCoord); + worldObj, + new GT_Packet_SendCoverData(coverInfo, this), + xCoord, + zCoord); coverInfo.setNeedsUpdate(false); } } @@ -552,10 +541,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); final byte currentFacing = (byte) accessor.getSide() - .ordinal(); + .ordinal(); final NBTTagList tList = tag.getTagList(GT_Values.NBT.COVERS, 10); for (byte i = 0; i < tList.tagCount(); i++) { @@ -566,16 +555,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final ItemStack coverStack = coverInfo.getDisplayStack(); if (coverStack != null) { currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.cover", - currentFacing == coverInfo.getSide() - ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") - : StatCollector.translateToLocal( - "GT5U.interface.coverTabs." - + ForgeDirection.getOrientation(coverInfo.getSide()) - .toString() - .toLowerCase()), - coverStack.getDisplayName())); + StatCollector.translateToLocalFormatted( + "GT5U.waila.cover", + currentFacing == coverInfo.getSide() + ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") + : StatCollector.translateToLocal( + "GT5U.interface.coverTabs." + ForgeDirection.getOrientation(coverInfo.getSide()) + .toString() + .toLowerCase()), + coverStack.getDisplayName())); final String behaviorDesc = coverInfo.getBehaviorDescription(); if (!Objects.equals(behaviorDesc, E)) currenttip.add(behaviorDesc); } @@ -587,7 +575,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { // No super implementation // super.getWailaNBTData(player, tile, tag, world, x, y, z); @@ -612,10 +600,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final ItemStack coverStack = coverInfo.getDisplayStack(); if (coverStack != null) { aList.add( - String.format( - "Cover on %s side: %s", - getTranslation(FACES[coverInfo.getSide()]), - coverStack.getDisplayName())); + String.format( + "Cover on %s side: %s", + getTranslation(FACES[coverInfo.getSide()]), + coverStack.getDisplayName())); } } @@ -628,15 +616,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final GT_CoverBehaviorBase<?> behavior = GregTech_API.getCoverBehaviorNew(coverId); if (behavior == null || behavior == GregTech_API.sNoBehavior) continue; if (!aNBT.hasKey(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])) continue; - final ISerializableObject dataObject = behavior.createDataObject( - aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])); + final ISerializableObject dataObject = behavior + .createDataObject(aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])); final ItemStack coverStack = behavior.getDisplayStack(coverId, dataObject); if (coverStack != null) { aList.add( - String.format( - "Cover on %s side: %s", - getTranslation(FACES[tSide]), - coverStack.getDisplayName())); + String.format( + "Cover on %s side: %s", + getTranslation(FACES[tSide]), + coverStack.getDisplayName())); } } } @@ -652,7 +640,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) { final int COVER_TAB_LEFT = -16, COVER_TAB_TOP = 1, COVER_TAB_HEIGHT = 20, COVER_TAB_WIDTH = 18, - COVER_TAB_SPACING = 2, ICON_SIZE = 16; + COVER_TAB_SPACING = 2, ICON_SIZE = 16; final boolean flipHorizontally = GT_Mod.gregtechproxy.mCoverTabsFlipped; final Column columnWidget = new Column(); @@ -660,15 +648,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final int xPos = flipHorizontally ? (getGUIWidth() - COVER_TAB_LEFT - COVER_TAB_WIDTH) : COVER_TAB_LEFT; if (GT_Mod.gregtechproxy.mCoverTabsVisible) { columnWidget.setPos(xPos, COVER_TAB_TOP) - .setEnabled( - widget -> ((Column) widget).getChildren() - .stream() - .anyMatch(Widget::isEnabled)); + .setEnabled( + widget -> ((Column) widget).getChildren() + .stream() + .anyMatch(Widget::isEnabled)); } else { columnWidget.setEnabled(false); } columnWidget.setAlignment(MainAxisAlignment.SPACE_BETWEEN) - .setSpace(COVER_TAB_SPACING); + .setSpace(COVER_TAB_SPACING); for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { final byte side = (byte) direction.ordinal(); @@ -683,45 +671,37 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (getCoverBehaviorAtSideNew(side).hasCoverGUI()) { if (isHovering()) { backgrounds.add( - flipHorizontally ? tabIconSet.getCoverTabHighlightFlipped() - : tabIconSet.getCoverTabHighlight()); + flipHorizontally ? tabIconSet.getCoverTabHighlightFlipped() + : tabIconSet.getCoverTabHighlight()); } else { backgrounds.add( - flipHorizontally ? tabIconSet.getCoverTabNormalFlipped() - : tabIconSet.getCoverTabNormal()); + flipHorizontally ? tabIconSet.getCoverTabNormalFlipped() + : tabIconSet.getCoverTabNormal()); } } else { backgrounds.add( - flipHorizontally ? tabIconSet.getCoverTabDisabledFlipped() - : tabIconSet.getCoverTabDisabled()); + flipHorizontally ? tabIconSet.getCoverTabDisabledFlipped() + : tabIconSet.getCoverTabDisabled()); } return backgrounds.toArray(new IDrawable[] {}); } }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side)) - .dynamicTooltip(() -> getCoverTabTooltip(side)) - .setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) - .addChild( - new ItemDrawable( - () -> getCoverItemAtSide(side)).asWidget() - .setPos( - (COVER_TAB_WIDTH - - ICON_SIZE) - / 2 - + (flipHorizontally - ? -1 - : 1), - (COVER_TAB_HEIGHT - - ICON_SIZE) - / 2)) - .setEnabled(widget -> getCoverItemAtSide(side) != null)); + .dynamicTooltip(() -> getCoverTabTooltip(side)) + .setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) + .addChild( + new ItemDrawable(() -> getCoverItemAtSide(side)).asWidget() + .setPos( + (COVER_TAB_WIDTH - ICON_SIZE) / 2 + (flipHorizontally ? -1 : 1), + (COVER_TAB_HEIGHT - ICON_SIZE) / 2)) + .setEnabled(widget -> getCoverItemAtSide(side) != null)); } } @SideOnly(Side.CLIENT) protected List<String> getCoverTabTooltip(byte side) { final String[] SIDE_TOOLTIPS = new String[] { "GT5U.interface.coverTabs.down", "GT5U.interface.coverTabs.up", - "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west", - "GT5U.interface.coverTabs.east" }; + "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west", + "GT5U.interface.coverTabs.east" }; final CoverInfo coverInfo = getCoverInfoAtSide(side); final ItemStack coverItem = coverInfo.getDisplayStack(); if (coverItem == null) return Collections.emptyList(); @@ -732,11 +712,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov for (int i = 0; i < tooltip.size(); i++) { if (i == 0) { tooltip.set( - 0, - (coverHasGUI ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) - + StatCollector.translateToLocal(SIDE_TOOLTIPS[side]) - + (coverHasGUI ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) - + tooltip.get(0)); + 0, + (coverHasGUI ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) + + StatCollector.translateToLocal(SIDE_TOOLTIPS[side]) + + (coverHasGUI ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) + + tooltip.get(0)); } else { tooltip.set(i, EnumChatFormatting.GRAY + tooltip.get(i)); } @@ -749,19 +729,19 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final CoverInfo coverInfo = getCoverInfoAtSide(side); if (coverInfo.useModularUI()) { widget.getContext() - .openSyncedWindow(side + COVER_WINDOW_ID_START); + .openSyncedWindow(side + COVER_WINDOW_ID_START); } else { final GT_Packet_TileEntityCoverGUI packet = new GT_Packet_TileEntityCoverGUI( - coverInfo, - getWorld().provider.dimensionId, - widget.getContext() - .getPlayer() - .getEntityId(), - 0); + coverInfo, + getWorld().provider.dimensionId, + widget.getContext() + .getPlayer() + .getEntityId(), + 0); GT_Values.NW.sendToPlayer( - packet, - (EntityPlayerMP) widget.getContext() - .getPlayer()); + packet, + (EntityPlayerMP) widget.getContext() + .getPlayer()); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index a42525ae45..c8657fbcff 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -99,7 +99,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } mName = aBasicName.replaceAll(" ", "_") - .toLowerCase(Locale.ENGLISH); + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(new BaseMetaPipeEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -115,7 +115,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); tStack.getItem() - .addInformation(tStack, null, new ArrayList<>(), true); + .addInformation(tStack, null, new ArrayList<>(), true); } /** @@ -149,7 +149,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { mBaseMetaTileEntity.getMetaTileEntity() - .inValidate(); + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -241,19 +241,19 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { return false; } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { return false; } @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { return false; } @@ -318,7 +318,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { */ @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { + float aY, float aZ) { return false; } @@ -397,7 +397,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, - int aLogLevel, ArrayList<String> aList) { + int aLogLevel, ArrayList<String> aList) { return aList; } @@ -598,16 +598,16 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { return isValidSlot(aIndex) && aStack != null - && aIndex < mInventory.length - && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) - && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + && aIndex < mInventory.length + && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) + && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { return isValidSlot(aIndex) && aStack != null - && aIndex < mInventory.length - && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + && aIndex < mInventory.length + && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override @@ -756,15 +756,15 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public void doExplosion(long aExplosionPower) { float tStrength = GT_Values.getExplosionPowerForVoltage(aExplosionPower); int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), - tZ = getBaseMetaTileEntity().getZCoord(); + tZ = getBaseMetaTileEntity().getZCoord(); World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) { new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength) - .setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .setWorld(tWorld) - .run(); + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } @@ -775,7 +775,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); } @@ -850,10 +850,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { if ((alwaysLookConnected || letsIn || letsOut)) { // Are we trying to connect to a pipe? let's do it! final IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - : null; + ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() + : null; if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass() - .isInstance(this))) { + .isInstance(this))) { connectAtSide(aSide); if (!((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) { // Make sure pipes all get together -- connect back to us if we're connecting to a pipe @@ -869,10 +869,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return 1; } if (!baseMetaTile.getWorld() - .getChunkProvider() - .chunkExists( - baseMetaTile.getOffsetX(aSide, 1) >> 4, - baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { + .getChunkProvider() + .chunkExists(baseMetaTile.getOffsetX(aSide, 1) >> 4, baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { // Target chunk unloaded return -1; } @@ -903,11 +901,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); if ((this.getClass() - .isInstance(tPipe) - || (tPipe != null && tPipe.getClass() - .isInstance(this))) - && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) - ((MetaPipeEntity) tPipe).disconnect(tSide); + .isInstance(tPipe) + || (tPipe != null && tPipe.getClass() + .isInstance(this))) + && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide); } @Override @@ -916,7 +913,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return false; } @@ -925,7 +922,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return false; } @@ -934,12 +931,12 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return false; } public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return false; } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index c929bd5677..3acbb2ce2d 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -129,7 +129,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } mName = aBasicName.replace(" ", "_") - .toLowerCase(Locale.ENGLISH); + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -166,7 +166,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { mBaseMetaTileEntity.getMetaTileEntity() - .inValidate(); + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -228,7 +228,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); return true; @@ -238,42 +238,30 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (!aPlayer.isSneaking()) return false; byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); if ((tTileEntity instanceof IGregTechTileEntity) - && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { // The tile entity we're facing is a cable, let's try to connect to it return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - .onWireCutterRightClick( - aWrenchingSide, - tSide, - aPlayer, - aX, - aY, - aZ); + .onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); } return false; } @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (!aPlayer.isSneaking()) return false; byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); if ((tTileEntity instanceof IGregTechTileEntity) - && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { // The tile entity we're facing is a cable, let's try to connect to it return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - .onSolderingToolRightClick( - aWrenchingSide, - tSide, - aPlayer, - aX, - aY, - aZ); + .onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); } return false; } @@ -281,18 +269,18 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onExplosion() { GT_Log.exp.println( - "Machine at " + this.getBaseMetaTileEntity() - .getXCoord() - + " | " - + this.getBaseMetaTileEntity() - .getYCoord() - + " | " - + this.getBaseMetaTileEntity() - .getZCoord() - + " DIMID: " - + this.getBaseMetaTileEntity() - .getWorld().provider.dimensionId - + " exploded."); + "Machine at " + this.getBaseMetaTileEntity() + .getXCoord() + + " | " + + this.getBaseMetaTileEntity() + .getYCoord() + + " | " + + this.getBaseMetaTileEntity() + .getZCoord() + + " DIMID: " + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + + " exploded."); } @Override @@ -355,7 +343,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { + float aY, float aZ) { return onRightclick(aBaseMetaTileEntity, aPlayer); } @@ -647,7 +635,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, - int aLogLevel, ArrayList<String> aList) { + int aLogLevel, ArrayList<String> aList) { return aList; } @@ -770,7 +758,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac */ public boolean isTeleporterCompatible() { return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 - && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; + && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; } /** @@ -907,16 +895,16 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { return isValidSlot(aIndex) && aStack != null - && aIndex < mInventory.length - && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) - && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + && aIndex < mInventory.length + && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) + && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { return isValidSlot(aIndex) && aStack != null - && aIndex < mInventory.length - && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + && aIndex < mInventory.length + && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override @@ -944,10 +932,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) { int tSteam = (int) Math.min( - Integer.MAX_VALUE, - Math.min( - aFluid.amount / 2, - getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); + Integer.MAX_VALUE, + Math.min( + aFluid.amount / 2, + getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); if (tSteam > 0) { markDirty(); if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); @@ -1106,7 +1094,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); } @@ -1171,12 +1159,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { currenttip.add( - String.format( - "Facing: %s", - ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()) - .name())); + String.format( + "Facing: %s", + ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()) + .name())); if (this instanceof IPowerChannelState state) { // adapted from PowerStateWailaDataProvider @@ -1199,7 +1187,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { if (this instanceof IPowerChannelState state) { // adapted from PowerStateWailaDataProvider final boolean isActive = state.isActive(); @@ -1216,19 +1204,16 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac if (getProxy() == null) return "(proxy)"; if (getProxy().getNode() == null) return "(node)"; if (getProxy().getNode() - .getGrid() - == null) - return "(grid)"; + .getGrid() == null) return "(grid)"; if (!getProxy().getNode() - .meetsChannelRequirements()) - return "(channels)"; + .meetsChannelRequirements()) return "(channels)"; IPathingGrid pg = getProxy().getNode() - .getGrid() - .getCache(IPathingGrid.class); + .getGrid() + .getCache(IPathingGrid.class); if (!pg.isNetworkBooting()) return "(booting)"; IEnergyGrid eg = getProxy().getNode() - .getGrid() - .getCache(IEnergyGrid.class); + .getGrid() + .getCache(IEnergyGrid.class); if (!eg.isNetworkPowered()) return "(power)"; } catch (Throwable ex) { ex.printStackTrace(); diff --git a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java index 674ced4535..da86635fea 100644 --- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java +++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java @@ -82,9 +82,8 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { @Override public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { - final long amps = (long) Math.max( - amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), - 1.0); + final long amps = (long) Math + .max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0); final long euPerAmp = (long) (amount / (amps * 1.0)); final IMetaTileEntity metaTile = myMeta.getMetaTileEntity(); @@ -93,15 +92,13 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { final long usedAmps; if (cableMeta != null) { usedAmps = ((IMetaTileEntityCable) metaTile).transferElectricity( - (byte) directionFrom.ordinal(), - Math.min(euPerAmp, cableMeta.mVoltage), - amps, - Sets.newHashSet((TileEntity) myMeta)); - - } else usedAmps = myMeta.injectEnergyUnits( (byte) directionFrom.ordinal(), - Math.min(euPerAmp, myMeta.getInputVoltage()), - amps); + Math.min(euPerAmp, cableMeta.mVoltage), + amps, + Sets.newHashSet((TileEntity) myMeta)); + + } else usedAmps = myMeta + .injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); return amount - (usedAmps * euPerAmp); // transferElectricity for cables @@ -120,8 +117,7 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { final IMetaTileEntity metaTile = myMeta.getMetaTileEntity(); if (metaTile instanceof IMetaTileEntityCable && (direction == ForgeDirection.UNKNOWN - || ((IConnectable) metaTile).isConnectedAtSide(direction.ordinal()))) - return true; + || ((IConnectable) metaTile).isConnectedAtSide(direction.ordinal()))) return true; else return myMeta.inputEnergyFrom((byte) direction.ordinal(), false); } } diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java index e8e313141d..83cebbb08d 100644 --- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java +++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java @@ -20,73 +20,73 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine public GT_MetaTileEntity_E_Furnace(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 1, - "Not like using a Commodore 64", - 1, - 1, - "E_Furnace.png", - "smelting", - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) - .glow() - .build())); + aID, + aName, + aNameRegional, + aTier, + 1, + "Not like using a Commodore 64", + 1, + 1, + "E_Furnace.png", + "smelting", + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String aDescription, ITexture[][][] aTextures, - String aGUIName, String aNEIName) { + String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - String aGUIName, String aNEIName) { + String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @@ -108,9 +108,9 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine @Override protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, - ItemStack aStack) { + ItemStack aStack) { return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) - && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null; + && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index ee610d2631..132c48e77d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -57,9 +57,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public final long mCableLossPerMeter, mAmperage, mVoltage; public final boolean mInsulated, mCanShock; public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredAmperageLast20OK = 0, - mTransferredAmperageOK = 0; + mTransferredAmperageOK = 0; public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0, mTransferredVoltageLast20OK = 0, - mTransferredVoltageOK = 0; + mTransferredVoltageOK = 0; public long mRestRF; public int mOverheat; public static short mMaxOverheat = (short) (GT_Mod.gregtechproxy.mWireHeatingTicks * 100); @@ -68,7 +68,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile private long lastWorldTick; public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, - long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { super(aID, aName, aNameRegional, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -80,7 +80,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, - long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -99,77 +99,76 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaPipeEntity_Cable( - mName, - mThickNess, - mMaterial, - mCableLossPerMeter, - mAmperage, - mVoltage, - mInsulated, - mCanShock); + mName, + mThickNess, + mMaterial, + mCableLossPerMeter, + mAmperage, + mVoltage, + mInsulated, + mCanShock); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { + byte aColorIndex, boolean aConnected, boolean aRedstone) { if (!mInsulated) return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.374F) // 0.375 x1 return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.499F) // 0.500 x2 return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.624F) // 0.625 x4 return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.749F) // 0.750 x8 return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_MEDIUM_PLUS, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM_PLUS, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) // 0.825 x12 return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - return new ITexture[] { TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_HUGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } - return new ITexture[] { TextureFactory.of( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + return new ITexture[] { TextureFactory + .of(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 - && aEntity instanceof EntityLivingBase - && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) + && aEntity instanceof EntityLivingBase + && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) GT_Utility.applyElectricityDamage( - (EntityLivingBase) aEntity, - mTransferredVoltageLast20, - mTransferredAmperageLast20); + (EntityLivingBase) aEntity, + mTransferredVoltageLast20, + mTransferredAmperageLast20); } @Override @@ -206,8 +205,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (!isConnectedAtSide(aSide) && aSide != 6) return 0; if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .letsEnergyIn()) - return 0; + .letsEnergyIn()) return 0; final HashSet<TileEntity> nul = null; return transferElectricity(aSide, aVoltage, aAmperage, nul); } @@ -215,7 +213,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override @Deprecated public long transferElectricity(byte aSide, long aVoltage, long aAmperage, - ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + ArrayList<TileEntity> aAlreadyPassedTileEntityList) { return transferElectricity(aSide, aVoltage, aAmperage, new HashSet<>(aAlreadyPassedTileEntityList)); } @@ -247,10 +245,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (aBaseMetaTileEntity.isServerSide()) { lastAmperage = new int[16]; lastWorldTick = aBaseMetaTileEntity.getWorld() - .getTotalWorldTime() - - 1; // sets initial value -1 since it is - // in the same tick as first on post - // tick + .getTotalWorldTime() - 1; // sets initial value -1 since it is + // in the same tick as first on post + // tick } } @@ -258,16 +255,16 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aTick % 20 == 0 && aBaseMetaTileEntity.isServerSide() - && (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) { + && (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) { checkConnections(); } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (GT_Mod.gregtechproxy.gt6Cable - && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { + && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); @@ -282,9 +279,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (GT_Mod.gregtechproxy.gt6Cable - && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { + && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); @@ -299,25 +296,25 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } @@ -340,8 +337,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile // GT Machine handling if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) - || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) - return true; + || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) return true; // Solar Panel Compat if (coverBehavior instanceof GT_Cover_SolarPanel) return true; @@ -353,7 +349,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile // AE2-p2p Compat if (GT_Mod.gregtechproxy.mAE2Integration) { if (tTileEntity instanceof appeng.tile.powersink.IC2 - && ((appeng.tile.powersink.IC2) tTileEntity).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) + && ((appeng.tile.powersink.IC2) tTileEntity).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true; } @@ -364,17 +360,16 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (tTileEntity instanceof IReactorChamber) ic2Energy = (TileEntity) ((IReactorChamber) tTileEntity).getReactor(); else ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) - ? tTileEntity - : EnergyNet.instance.getTileEntity( - tTileEntity.getWorldObj(), - tTileEntity.xCoord, - tTileEntity.yCoord, - tTileEntity.zCoord); + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), + tTileEntity.xCoord, + tTileEntity.yCoord, + tTileEntity.zCoord); // IC2 Sink Compat if ((ic2Energy instanceof IEnergySink) - && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) - return true; + && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true; // IC2 Source Compat if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) { @@ -385,12 +380,11 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } // RF Output Compat if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver - && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) - return true; + && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) return true; // RF Input Compat return GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter - && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); + && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); } @Override @@ -412,24 +406,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public String[] getDescription() { return new String[] { - StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mVoltage) - + " (" - + GT_Utility.getColoredTierNameFromVoltage(mVoltage) - + EnumChatFormatting.GREEN - + ")" - + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mAmperage) - + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mCableLossPerMeter) - + EnumChatFormatting.GRAY - + "%%% " - + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") }; + StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mVoltage) + + " (" + + GT_Utility.getColoredTierNameFromVoltage(mVoltage) + + EnumChatFormatting.GREEN + + ")" + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mCableLossPerMeter) + + EnumChatFormatting.GRAY + + "%%% " + + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") }; } @Override @@ -466,38 +460,38 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile volts = path.getVoltage(this); } return new String[] { - // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, - "Heat: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mOverheat) - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxOverheat) - + EnumChatFormatting.RESET, - "Max Load (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) - + EnumChatFormatting.RESET - + " A / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mAmperage) - + EnumChatFormatting.RESET - + " A", - "Max EU/p (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mVoltage) - + EnumChatFormatting.RESET - + " EU", - "Max Load (20t): " + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) - + EnumChatFormatting.RESET - + " A", - "Max EU/p (20t): " + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) - + EnumChatFormatting.RESET - + " EU" }; + // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, + "Heat: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mOverheat) + + EnumChatFormatting.RESET + + " / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxOverheat) + + EnumChatFormatting.RESET, + "Max Load (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + + EnumChatFormatting.RESET + + " A / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.RESET + + " A", + "Max EU/p (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mVoltage) + + EnumChatFormatting.RESET + + " EU", + "Max Load (20t): " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) + + EnumChatFormatting.RESET + + " A", + "Max EU/p (20t): " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) + + EnumChatFormatting.RESET + + " EU" }; } @Override @@ -549,18 +543,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, - aY + tSide0, - aZ + tSide2, - aX + tSide5, - aY + tSide1, - aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); @@ -577,13 +566,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile for (byte aSide = 0; aSide < 6; aSide++) if (isConnectedAtSide(aSide)) { final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide); final TileEntity tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile - || EnergyNet.instance == null) - ? tTileEntity - : EnergyNet.instance.getTileEntity( - tTileEntity.getWorldObj(), - tTileEntity.xCoord, - tTileEntity.yCoord, - tTileEntity.zCoord); + || EnergyNet.instance == null) + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), + tTileEntity.xCoord, + tTileEntity.yCoord, + tTileEntity.zCoord); if (tEmitter instanceof IEnergyEmitter) return true; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index c8718d0e52..76c7f418e9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -55,12 +55,12 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public byte mDisableInput = 0; public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, - int aCapacity, int aHeatResistance, boolean aGasProof) { + int aCapacity, int aHeatResistance, boolean aGasProof) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, - int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { + int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aID, aName, aNameRegional, 0, false); mThickNess = aThickNess; mMaterial = aMaterial; @@ -74,12 +74,12 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Deprecated public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, - int aHeatResistance, boolean aGasProof) { + int aHeatResistance, boolean aGasProof) { this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, - int aHeatResistance, boolean aGasProof, int aFluidTypes) { + int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -98,64 +98,64 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaPipeEntity_Fluid( - mName, - mThickNess, - mMaterial, - mCapacity, - mHeatResistance, - mGasProof, - mPipeAmount); + mName, + mThickNess, + mMaterial, + mCapacity, + mHeatResistance, + mGasProof, + mPipeAmount); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { + byte aColorIndex, boolean aConnected, boolean aRedstone) { final float tThickNess = getThickNess(); if (mDisableInput == 0) return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; byte tMask = 0; final byte[][] sRestrictionArray = { { 2, 3, 5, 4 }, { 2, 3, 4, 5 }, { 1, 0, 4, 5 }, { 1, 0, 4, 5 }, - { 1, 0, 2, 3 }, { 1, 0, 2, 3 } }; + { 1, 0, 2, 3 }, { 1, 0, 2, 3 } }; if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate if (aSide == 5 || aSide == 2) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); } return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - getRestrictorTexture(tMask) }; + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + getRestrictorTexture(tMask) }; } protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { if (aPipeAmount >= 9) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aPipeAmount >= 4) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.124F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.374F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.499F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.749F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.874F) return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); } protected static ITexture getRestrictorTexture(byte aMask) { @@ -244,22 +244,20 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 - && aEntity instanceof EntityLivingBase) { + && aEntity instanceof EntityLivingBase) { for (FluidStack tFluid : mFluids) { if (tFluid != null) { final int tTemperature = tFluid.getFluid() - .getTemperature(tFluid); - if (tTemperature > 320 && !isCoverOnSide( - (BaseMetaPipeEntity) getBaseMetaTileEntity(), - (EntityLivingBase) aEntity)) { + .getTemperature(tFluid); + if (tTemperature > 320 + && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); break; - } else if (tTemperature < 260 && !isCoverOnSide( - (BaseMetaPipeEntity) getBaseMetaTileEntity(), - (EntityLivingBase) aEntity)) { - GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); - break; - } + } else if (tTemperature < 260 + && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { + GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); + break; + } } } } @@ -300,55 +298,48 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tFluid != null && tFluid.amount > 0) { final int tTemperature = tFluid.getFluid() - .getTemperature(tFluid); + .getTemperature(tFluid); if (tTemperature > mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { // Poof GT_Log.exp.println( - "Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() - + " | " - + aBaseMetaTileEntity.getYCoord() - + " | " - + aBaseMetaTileEntity.getZCoord() - + " DIMID: " - + aBaseMetaTileEntity.getWorld().provider.dimensionId); + "Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + + " | " + + aBaseMetaTileEntity.getYCoord() + + " | " + + aBaseMetaTileEntity.getZCoord() + + " DIMID: " + + aBaseMetaTileEntity.getWorld().provider.dimensionId); aBaseMetaTileEntity.setToFire(); return true; } // Mmhmm, Fire aBaseMetaTileEntity.setOnFire(); GT_Log.exp.println( - "Set Blocks around Pipe to Fire due to to low heat resistance at " - + aBaseMetaTileEntity.getXCoord() - + " | " - + aBaseMetaTileEntity.getYCoord() - + " | " - + aBaseMetaTileEntity.getZCoord() - + " DIMID: " - + aBaseMetaTileEntity.getWorld().provider.dimensionId); + "Set Blocks around Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + + " | " + + aBaseMetaTileEntity.getYCoord() + + " | " + + aBaseMetaTileEntity.getZCoord() + + " DIMID: " + + aBaseMetaTileEntity.getWorld().provider.dimensionId); } if (!mGasProof && tFluid.getFluid() - .isGaseous(tFluid)) { + .isGaseous(tFluid)) { tFluid.amount -= 5; sendSound((byte) 9); if (tTemperature > 320) { try { for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getXCoord() - - 2, - getBaseMetaTileEntity().getYCoord() - - 2, - getBaseMetaTileEntity().getZCoord() - - 2, - getBaseMetaTileEntity().getXCoord() - + 3, - getBaseMetaTileEntity().getYCoord() - + 3, - getBaseMetaTileEntity().getZCoord() - + 3))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getXCoord() - 2, + getBaseMetaTileEntity().getYCoord() - 2, + getBaseMetaTileEntity().getZCoord() - 2, + getBaseMetaTileEntity().getXCoord() + 3, + getBaseMetaTileEntity().getYCoord() + 3, + getBaseMetaTileEntity().getZCoord() + 3))) { GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F); } } catch (Throwable e) { @@ -357,21 +348,15 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } else if (tTemperature < 260) { try { for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getXCoord() - - 2, - getBaseMetaTileEntity().getYCoord() - - 2, - getBaseMetaTileEntity().getZCoord() - - 2, - getBaseMetaTileEntity().getXCoord() - + 3, - getBaseMetaTileEntity().getYCoord() - + 3, - getBaseMetaTileEntity().getZCoord() - + 3))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getXCoord() - 2, + getBaseMetaTileEntity().getYCoord() - 2, + getBaseMetaTileEntity().getZCoord() - 2, + getBaseMetaTileEntity().getXCoord() + 3, + getBaseMetaTileEntity().getYCoord() + 3, + getBaseMetaTileEntity().getZCoord() + 3))) { GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F); } } catch (Throwable e) { @@ -400,11 +385,11 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final IGregTechTileEntity gTank = tTank instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTank : null; if (isConnectedAtSide(aSide) && tTank != null - && (mLastReceivedFrom & (1 << aSide)) == 0 - && getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .letsFluidOut(tFluid.getFluid()) - && (gTank == null || gTank.getCoverInfoAtSide(tSide) - .letsFluidIn(tFluid.getFluid()))) { + && (mLastReceivedFrom & (1 << aSide)) == 0 + && getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsFluidOut(tFluid.getFluid()) + && (gTank == null || gTank.getCoverInfoAtSide(tSide) + .letsFluidIn(tFluid.getFluid()))) { if (tTank.fill(ForgeDirection.getOrientation(tSide), tFluid, false) > 0) { tTanks.add(new MutableTriple<>(tTank, ForgeDirection.getOrientation(tSide), 0)); } @@ -436,10 +421,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tEntry.right <= 0) continue; - final int tFilledAmount = tEntry.left.fill( - tEntry.middle, - drainFromIndex(tEntry.right, false, index), - false); + final int tFilledAmount = tEntry.left + .fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); if (tFilledAmount > 0) tEntry.left.fill(tEntry.middle, drainFromIndex(tFilledAmount, true, index), true); @@ -449,7 +432,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (GT_Mod.gregtechproxy.gt6Pipe) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); final byte tMask = (byte) (1 << tSide); @@ -477,25 +460,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @@ -514,15 +497,15 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tTileEntity == null) return false; final byte tSide = (byte) ForgeDirection.getOrientation(aSide) - .getOpposite() - .ordinal(); + .getOpposite() + .ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; final GT_CoverBehaviorBase<?> coverBehavior = baseMetaTile.getCoverBehaviorAtSideNew(aSide); final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) - ? (IGregTechTileEntity) tTileEntity - : null; + ? (IGregTechTileEntity) tTileEntity + : null; if (coverBehavior instanceof GT_Cover_Drain || (GregTech_API.mTConstruct && isTConstructFaucet(tTileEntity))) return true; @@ -533,8 +516,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { return tInfo.length > 0 || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) - || gTileEntity != null - && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; + || gTileEntity != null + && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; } } return false; @@ -565,18 +548,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD) - .setWorld(getBaseMetaTileEntity().getWorld()) - .<ParticleEventBuilder>times( - 6, - (x, i) -> x.setMotion( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0) - .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()) - .run()); + .setWorld(getBaseMetaTileEntity().getWorld()) + .<ParticleEventBuilder>times( + 6, + (x, i) -> x + .setMotion( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0) + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -631,9 +615,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { if (aFluid == null || aFluid.getFluid() - .getID() - <= 0) - return 0; + .getID() <= 0) return 0; int index = -1; for (int i = 0; i < mPipeAmount; i++) { @@ -641,10 +623,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { index = i; break; } else if ((mFluids[i] == null || mFluids[i].getFluid() - .getID() - <= 0) && index < 0) { - index = i; - } + .getID() <= 0) && index < 0) { + index = i; + } } return fill_default_intoIndex(aSide, aFluid, doFill, index); @@ -653,13 +634,10 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { private int fill_default_intoIndex(ForgeDirection aSide, FluidStack aFluid, boolean doFill, int index) { if (index < 0 || index >= mPipeAmount) return 0; if (aFluid == null || aFluid.getFluid() - .getID() - <= 0) - return 0; + .getID() <= 0) return 0; if (mFluids[index] == null || mFluids[index].getFluid() - .getID() - <= 0) { + .getID() <= 0) { if (aFluid.amount * mPipeAmount <= getCapacity()) { if (doFill) { mFluids[index] = aFluid.copy(); @@ -735,25 +713,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public String[] getDescription() { if (mPipeAmount == 1) { return new String[] { - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" - + GT_Utility.formatNumbers(mCapacity * 20L) - + "%%% L/sec" - + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" - + GT_Utility.formatNumbers(mHeatResistance) - + "%%% K" - + EnumChatFormatting.GRAY }; + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + + GT_Utility.formatNumbers(mHeatResistance) + + "%%% K" + + EnumChatFormatting.GRAY }; } else { return new String[] { - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" - + GT_Utility.formatNumbers(mCapacity * 20L) - + "%%% L/sec" - + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" - + GT_Utility.formatNumbers(mHeatResistance) - + "%%% K" - + EnumChatFormatting.GRAY, - EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY }; + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + + GT_Utility.formatNumbers(mHeatResistance) + + "%%% K" + + EnumChatFormatting.GRAY, + EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY }; } } @@ -826,18 +804,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, - aY + tSide0, - aZ + tSide2, - aX + tSide5, - aY + tSide1, - aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index 302155a186..9ccb43e733 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -19,9 +19,8 @@ import gregtech.api.util.GT_OreDictUnificator; public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { - private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( - "gt.blockmachines.gt_frame.desc.format", - "Just something you can put covers on."); + private static final String localizedDescFormat = GT_LanguageManager + .addStringLocalization("gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); public final Materials mMaterial; public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) { @@ -31,19 +30,19 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { GT_OreDictUnificator.registerOre(OrePrefixes.frameGt, aMaterial, getStackForm(1)); if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) { GT_ModHandler.addCraftingRecipe( - getStackForm(2), - RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { "SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial) }); + getStackForm(2), + RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial) }); } if (!aMaterial.contains(SubTag.NO_RECIPES)) { // Auto generate frame box recipe in an assembler. RA.addAssemblerRecipe( - GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 4), - ItemList.Circuit_Integrated.getWithDamage(0, 4), - getStackForm(1), - 64, - calculateRecipeEU(aMaterial, 7)); + GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 4), + ItemList.Circuit_Integrated.getWithDamage(0, 4), + getStackForm(1), + 64, + calculateRecipeEU(aMaterial, 7)); } } @@ -64,10 +63,10 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { + byte aColorIndex, boolean aConnected, boolean aRedstone) { return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; } @Override @@ -112,13 +111,13 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, - ItemStack aStack) { + ItemStack aStack) { return false; } @Override public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, - ItemStack aStack) { + ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index 9e55aa94c7..f69170b83e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -52,7 +52,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE private int[] cacheSides; public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, - int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { + int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { super(aID, aName, aNameRegional, aInvSlotCount, false); mIsRestrictive = aIsRestrictive; mThickNess = aThickNess; @@ -63,12 +63,12 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE } public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, - int aInvSlotCount, int aStepSize, boolean aIsRestrictive) { + int aInvSlotCount, int aStepSize, boolean aIsRestrictive) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aInvSlotCount, aStepSize, aIsRestrictive, 20); } public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, - boolean aIsRestrictive, int aTickTime) { + boolean aIsRestrictive, int aTickTime) { super(aName, aInvSlotCount); mIsRestrictive = aIsRestrictive; mThickNess = aThickNess; @@ -85,87 +85,76 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaPipeEntity_Item( - mName, - mThickNess, - mMaterial, - mInventory.length, - mStepSize, - mIsRestrictive, - mTickTime); + mName, + mThickNess, + mMaterial, + mInventory.length, + mStepSize, + mIsRestrictive, + mTickTime); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { + byte aColorIndex, boolean aConnected, boolean aRedstone) { if (mIsRestrictive) { if (aConnected) { float tThickNess = getThickNess(); - if (tThickNess < 0.124F) - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - TextureFactory.of(PIPE_RESTRICTOR) }; + if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; if (tThickNess < 0.374F) // 0.375 - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - TextureFactory.of(PIPE_RESTRICTOR) }; + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; if (tThickNess < 0.499F) // 0.500 - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - TextureFactory.of(PIPE_RESTRICTOR) }; + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; if (tThickNess < 0.749F) // 0.750 - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - TextureFactory.of(PIPE_RESTRICTOR) }; + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; if (tThickNess < 0.874F) // 0.825 - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - TextureFactory.of(PIPE_RESTRICTOR) }; - return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; } return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR) }; } if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (tThickNess < 0.374F) // 0.375 return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (tThickNess < 0.499F) // 0.500 return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (tThickNess < 0.749F) // 0.750 return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (tThickNess < 0.874F) // 0.825 return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; - return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; } return new ITexture[] { TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; } @Override @@ -228,9 +217,10 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck();) { temp = false; tPipeList.clear(); - for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending( + for (IMetaTileEntityItemPipe tTileEntity : GT_Utility + .sortMapByValuesAcending( IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) - .keySet()) { + .keySet()) { if (temp) break; tPipeList.add(tTileEntity); while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity)) @@ -247,7 +237,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (GT_Mod.gregtechproxy.gt6Pipe) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (isConnectedAtSide(tSide)) { @@ -263,25 +253,25 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, - ICoverable aTileEntity) { + ICoverable aTileEntity) { return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, - ISerializableObject aCoverVariable, ICoverable aTileEntity) { + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @@ -303,13 +293,12 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE boolean connectable = GT_Utility.isConnectableNonInventoryPipe(tTileEntity, tSide); final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) - ? (IGregTechTileEntity) tTileEntity - : null; + ? (IGregTechTileEntity) tTileEntity + : null; if (gTileEntity != null) { if (gTileEntity.getMetaTileEntity() == null) return false; if (gTileEntity.getMetaTileEntity() - .connectsToItemPipe(tSide)) - return true; + .connectsToItemPipe(tSide)) return true; connectable = true; } @@ -346,7 +335,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE for (byte i : ALL_VALID_SIDES) { tSide = (byte) ((i + tOffset) % 6); if (isConnectedAtSide(tSide) - && (isInventoryEmpty() || (tSide != mLastReceivedFrom || aSender != getBaseMetaTileEntity()))) { + && (isInventoryEmpty() || (tSide != mLastReceivedFrom || aSender != getBaseMetaTileEntity()))) { if (insertItemStackIntoTileEntity(aSender, tSide)) return true; } } @@ -357,23 +346,23 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide) { if (getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .letsItemsOut(-1)) { + .letsItemsOut(-1)) { final TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) - || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { + || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { return GT_Utility.moveMultipleItemStacks( - aSender, - tInventory, - (byte) 6, - GT_Utility.getOppositeSide(aSide), - null, - false, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1, - 1) > 0; + aSender, + tInventory, + (byte) 6, + GT_Utility.getOppositeSide(aSide), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + 1) > 0; } } } @@ -443,13 +432,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public String[] getDescription() { if (mTickTime == 20) return new String[] { "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec", - "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; else if (mTickTime % 20 == 0) return new String[] { - "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec", - "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; + "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec", + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; else return new String[] { - "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", - "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; + "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; } private boolean isInventoryEmpty() { @@ -512,18 +501,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, - aY + tSide0, - aZ + tSide2, - aX + tSide5, - aY + tSide1, - aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, - List<AxisAlignedBB> outputAABB, Entity collider) { + List<AxisAlignedBB> outputAABB, Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java index bae070f6dd..ad6a730863 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java @@ -39,7 +39,7 @@ import ic2.api.item.IElectricItem; * Machine */ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_TieredMachineBlock - implements IAddUIWidgets { + implements IAddUIWidgets { public boolean mCharge = false, mDecharge = false; public int mBatteryCount = 0, mChargeableCount = 0; @@ -48,17 +48,17 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier private long mMax = 0; public GT_MetaTileEntity_BasicBatteryBuffer(int aID, String aName, String aNameRegional, int aTier, - String aDescription, int aSlotCount) { + String aDescription, int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); } public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, - int aSlotCount) { + int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures, int aSlotCount) { + ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } @@ -76,16 +76,16 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier for (byte i = -1; i < 16; i++) { rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] }; rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] - : mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] - : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] + : mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] + : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; } return rTextures; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { return mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } @@ -238,13 +238,13 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (GT_ModHandler.isElectricItem(aStack) && aStack.getUnlocalizedName() - .startsWith("gt.metaitem.01.")) { + .startsWith("gt.metaitem.01.")) { String name = aStack.getUnlocalizedName(); if (name.equals("gt.metaitem.01.32510") || name.equals("gt.metaitem.01.32511") - || name.equals("gt.metaitem.01.32520") - || name.equals("gt.metaitem.01.32521") - || name.equals("gt.metaitem.01.32530") - || name.equals("gt.metaitem.01.32531")) { + || name.equals("gt.metaitem.01.32520") + || name.equals("gt.metaitem.01.32521") + || name.equals("gt.metaitem.01.32530") + || name.equals("gt.metaitem.01.32531")) { if (ic2.api.item.ElectricItem.manager.getCharge(aStack) == 0) { return true; } @@ -313,16 +313,15 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier updateStorageInfo(); return new String[] { EnumChatFormatting.BLUE + getLocalName() + EnumChatFormatting.RESET, "Stored Items:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mStored) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMax) - + EnumChatFormatting.RESET - + " EU", - "Average input:", GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput()) + " EU/t", - "Average output:", - GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput()) + " EU/t" }; + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mStored) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMax) + + EnumChatFormatting.RESET + + " EU", + "Average input:", GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput()) + " EU/t", + "Average output:", GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput()) + " EU/t" }; } private void updateStorageInfo() { @@ -336,31 +335,31 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { NBTTagCompound tag = accessor.getNBTData(); currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.stored", - GT_Utility.formatNumbers(tag.getLong("mStored")), - GT_Utility.formatNumbers(tag.getLong("mMax")))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.stored", + GT_Utility.formatNumbers(tag.getLong("mStored")), + GT_Utility.formatNumbers(tag.getLong("mMax")))); long avgIn = tag.getLong("AvgIn"); long avgOut = tag.getLong("AvgOut"); currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.avg_in", - GT_Utility.formatNumbers(avgIn), - GT_Utility.getColoredTierNameFromVoltage(avgIn))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.avg_in", + GT_Utility.formatNumbers(avgIn), + GT_Utility.getColoredTierNameFromVoltage(avgIn))); currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.avg_out", - GT_Utility.formatNumbers(avgOut), - GT_Utility.getColoredTierNameFromVoltage(avgOut))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.avg_out", + GT_Utility.formatNumbers(avgOut), + GT_Utility.getColoredTierNameFromVoltage(avgOut))); super.getWailaBody(itemStack, currenttip, accessor, config); } @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { updateStorageInfo(); super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setLong("mStored", mStored); @@ -383,61 +382,61 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mInventory.length) { case 4 -> builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(70, 25)); + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(70, 25)); case 9 -> builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(61, 16)); + SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(0) + .endAtSlot(8) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(61, 16)); case 16 -> builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(52, 7)); + SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(52, 7)); default -> builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 1) - .startFromSlot(0) - .endAtSlot(0) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(79, 34)); + SlotGroup.ofItemHandler(inventoryHandler, 1) + .startFromSlot(0) + .endAtSlot(0) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(79, 34)); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 182b25fb92..ef7242b420 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -25,12 +25,12 @@ import gregtech.common.GT_Pollution; public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank { public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, - ITexture... aTextures) { + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription, ITexture... aTextures) { + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } @@ -62,10 +62,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 - : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex - + 1]; + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; } @Override @@ -214,21 +213,21 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (mInventory[getStackDisplaySlot()] == null) mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); mInventory[getStackDisplaySlot()].setStackDisplayName( - "Draining internal buffer: " - + GT_Utility.formatNumbers( - aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) - + " EU"); + "Draining internal buffer: " + + GT_Utility.formatNumbers( + aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + + " EU"); } } else { long tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount >= tConsumed) { long tFluidAmountToUse = Math.min( - mFluid.amount / tConsumed, - (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); + mFluid.amount / tConsumed, + (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); // long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + // getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK if (tFluidAmountToUse > 0 - && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { + && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { // divided by two because this is called every 10 ticks, not 20 GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution() / 2); mFluid.amount -= tFluidAmountToUse * tConsumed; @@ -237,9 +236,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } if (mInventory[getInputSlot()] != null - && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) - && ((GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) != null) - || solidFuelOverride(mInventory[getInputSlot()]))) { + && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) + && ((GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) != null) + || solidFuelOverride(mInventory[getInputSlot()]))) { long tFuelValue = getFuelValue(mInventory[getInputSlot()]); if (tFuelValue <= 0) tFuelValue = getFuelValue(mInventory[getInputSlot()], true); // System.out.println(" tFuelValue : " + tFuelValue ); @@ -256,8 +255,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } if (aBaseMetaTileEntity.isServerSide()) aBaseMetaTileEntity.setActive( - aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.isAllowedToWork() + && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); } /** @@ -270,18 +269,18 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity // if it is a gregtech Item, make sure its not a VOLUMETRIC_FLASK or any type of cell, else do vanilla checks if (association != null) { return !OrePrefixes.CELL_TYPES.contains(association.mPrefix) - && !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true); + && !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true); } else { return stack != null && // when the stack is null its not a solid - stack.getItem() != null && // when the item in the stack is null its not a solid - !(stack.getItem() instanceof IFluidContainerItem) && // when the item is a fluid container its not a - // solid... - !(stack.getItem() instanceof IFluidHandler) && // when the item is a fluid handler its not a - // solid... - !stack.getItem() - .getUnlocalizedName() - .contains("bucket"); // since we cant really check for - // buckets... + stack.getItem() != null && // when the item in the stack is null its not a solid + !(stack.getItem() instanceof IFluidContainerItem) && // when the item is a fluid container its not a + // solid... + !(stack.getItem() instanceof IFluidHandler) && // when the item is a fluid handler its not a + // solid... + !stack.getItem() + .getUnlocalizedName() + .contains("bucket"); // since we cant really check for + // buckets... } } @@ -333,7 +332,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack, true) > 0 - || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0); + || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java index cb9c670f05..ff1365a735 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java @@ -13,22 +13,22 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, String aDescription, - ITexture... aTextures) { + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 1, aDescription, aTextures); } public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription, ITexture... aTextures) { + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -114,7 +114,7 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aConnected, boolean aRedstone) { + boolean aConnected, boolean aRedstone) { return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0)][aColorIndex + 1]; } @@ -126,11 +126,11 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] }; rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1] }; rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; } return rTextures; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java index 1296d846af..c9b66e6baf 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java @@ -6,23 +6,23 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public abstract class GT_MetaTileEntity_BasicHull_NonElectric extends GT_MetaTileEntity_BasicHull { public GT_MetaTileEntity_BasicHull_NonElectric(int aID, String aName, String aNameRegional, int aTier, - String aDescription) { + String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); } public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { + byte aColorIndex, boolean aConnected, boolean aRedstone) { return mTextures[Math.min(2, aSide)][aColorIndex + 1]; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 49b76b1579..4868200bf1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -87,19 +87,19 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; * Machine */ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank - implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets { + implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets { /** * return values for checkRecipe() */ protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, - FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; + FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; public static final int OTHER_SLOT_COUNT = 5; public final ItemStack[] mOutputItems; public final int mInputSlotCount, mAmperage; public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, - mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; + mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; public boolean mDisableFilter = true; public boolean mDisableMultiStack = true; public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; @@ -124,16 +124,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * SideFacingPipeInactive */ public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, - String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, - ITexture... aOverlays) { + String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, + ITexture... aOverlays) { super( - aID, - aName, - aNameRegional, - aTier, - OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, - aDescription, - aOverlays); + aID, + aName, + aNameRegional, + aTier, + OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, + aDescription, + aOverlays); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; mAmperage = aAmperage; @@ -143,16 +143,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, - String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, - ITexture... aOverlays) { + String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, + ITexture... aOverlays) { super( - aID, - aName, - aNameRegional, - aTier, - OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, - aDescription, - aOverlays); + aID, + aName, + aNameRegional, + aTier, + OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, + aDescription, + aOverlays); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; mAmperage = aAmperage; @@ -162,7 +162,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String aDescription, - ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -173,7 +173,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription, - ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -236,7 +236,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { final int textureIndex; if (mMainFacing < 2) { if (aSide == aFacing) { @@ -293,8 +293,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean isValidSlot(int aIndex) { return aIndex > 0 && super.isValidSlot(aIndex) - && aIndex != getCircuitSlot() - && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; + && aIndex != getCircuitSlot() + && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @Override @@ -514,20 +514,20 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - mGUIName, - GT_Utility.isStringValid(mNEIName) ? mNEIName - : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + mGUIName, + GT_Utility.isStringValid(mNEIName) ? mNEIName + : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); } @Override public void initDefaultModes(NBTTagCompound aNBT) { mMainFacing = -1; if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( - getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy + .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) { mDisableFilter = !tPreference.isSingleBlockInitialFilterEnabled(); mDisableMultiStack = !tPreference.isSingleBlockInitialMultiStackEnabled(); @@ -592,9 +592,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { if (++mProgresstime >= mMaxProgresstime) { for (int i = 0; i < mOutputItems.length; i++) - for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity.addStackToSlot( - getOutputSlot() + ((j + i) % mOutputItems.length), - mOutputItems[i])) + for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity + .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break; if (mOutputFluid != null) if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); @@ -629,47 +628,45 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B boolean tRemovedOutputFluid = false; if (doesAutoOutputFluids() && getDrainableStack() != null - && aBaseMetaTileEntity.getFrontFacing() != mMainFacing - && (tSucceeded || aTick % 20 == 0)) { + && aBaseMetaTileEntity.getFrontFacing() != mMainFacing + && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTank != null) { FluidStack tDrained = drain(1000, false); if (tDrained != null) { - int tFilledAmount = tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - tDrained, - false); + int tFilledAmount = tTank + .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); if (tFilledAmount > 0) tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - drain(tFilledAmount, true), - true); + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + drain(tFilledAmount, true), + true); } } if (getDrainableStack() == null) tRemovedOutputFluid = true; } if (doesAutoOutput() && !isOutputEmpty() - && aBaseMetaTileEntity.getFrontFacing() != mMainFacing - && (tSucceeded || mOutputBlocked % 300 == 1 - || aBaseMetaTileEntity.hasInventoryBeenModified() - || aTick % 600 == 0)) { + && aBaseMetaTileEntity.getFrontFacing() != mMainFacing + && (tSucceeded || mOutputBlocked % 300 == 1 + || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600 == 0)) { TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); int tMaxStacks = (int) (tStoredEnergy / 64L); if (tMaxStacks > mOutputItems.length) tMaxStacks = mOutputItems.length; moveMultipleItemStacks( - aBaseMetaTileEntity, - tTileEntity2, - aBaseMetaTileEntity.getFrontFacing(), - aBaseMetaTileEntity.getBackFacing(), - null, - false, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1, - tMaxStacks); + aBaseMetaTileEntity, + tTileEntity2, + aBaseMetaTileEntity.getFrontFacing(), + aBaseMetaTileEntity.getBackFacing(), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + tMaxStacks); // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && // aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { // tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, @@ -684,11 +681,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (allowToCheckRecipe()) { if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() - && (tRemovedOutputFluid || tSucceeded - || aBaseMetaTileEntity.hasInventoryBeenModified() - || aTick % 600 == 0 - || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) - && hasEnoughEnergyToCheckRecipe()) { + && (tRemovedOutputFluid || tSucceeded + || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600 == 0 + || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) + && hasEnoughEnergyToCheckRecipe()) { if (checkRecipe() == FOUND_AND_SUCCESSFULLY_USED_RECIPE) { if (getSpecialSlot() != null && getSpecialSlot().stackSize <= 0) mInventory[getSpecialSlotIndex()] = null; @@ -755,10 +752,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) mInventory[tDisplayStackSlot] = null; } else { - mInventory[tDisplayStackSlot] = GT_Utility.getFluidDisplayStack( - getFillableStack(), - true, - !displaysStackSize()); + mInventory[tDisplayStackSlot] = GT_Utility + .getFluidDisplayStack(getFillableStack(), true, !displaysStackSize()); } } } @@ -803,7 +798,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected boolean canOutput(GT_Recipe aRecipe) { return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null - : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); + : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); } protected boolean canOutput(ItemStack... aOutputs) { @@ -811,11 +806,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B ItemStack[] tOutputSlots = getAllOutputs(); for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++) if (tOutputSlots[i] != null && aOutputs[i] != null - && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) - || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { - mOutputBlocked++; - return false; - } + && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) + || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { + mOutputBlocked++; + return false; + } return true; } @@ -929,29 +924,29 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public String[] getInfoData() { return new String[] { EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET, "Progress:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime / 20)) - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime / 20) - + EnumChatFormatting.RESET - + " s", - "Stored Energy:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU()) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity()) - + EnumChatFormatting.RESET - + " EU", - "Probably uses: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mEUt) - + EnumChatFormatting.RESET - + " EU/t at " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage) - + EnumChatFormatting.RESET - + " A" }; + EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime / 20)) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + "Stored Energy:", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU()) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity()) + + EnumChatFormatting.RESET + + " EU", + "Probably uses: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mEUt) + + EnumChatFormatting.RESET + + " EU/t at " + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage) + + EnumChatFormatting.RESET + + " A" }; } @Override @@ -965,29 +960,29 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (aPlayer.isSneaking()) { mDisableFilter = !mDisableFilter; GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); } else { mAllowInputFromOutputSide = !mAllowInputFromOutputSide; GT_Utility.sendChatToPlayer( - aPlayer, - mAllowInputFromOutputSide ? GT_Utility.trans("095", "Input from Output Side allowed") - : GT_Utility.trans("096", "Input from Output Side forbidden")); + aPlayer, + mAllowInputFromOutputSide ? GT_Utility.trans("095", "Input from Output Side allowed") + : GT_Utility.trans("096", "Input from Output Side forbidden")); } } } @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (!aPlayer.isSneaking()) return false; boolean click = super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); if (click) return true; if (aWrenchingSide != mMainFacing) return false; mDisableMultiStack = !mDisableMultiStack; GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack)); return true; } @@ -996,10 +991,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (aSide != mMainFacing) return true; GT_CoverBehaviorBase<?> tBehavior = GregTech_API.getCoverBehaviorNew(aCoverID.toStack()); return tBehavior.isGUIClickable( - aSide, - GT_Utility.stackToInt(aCoverID.toStack()), - tBehavior.createDataObject(), - getBaseMetaTileEntity()); + aSide, + GT_Utility.stackToInt(aCoverID.toStack()), + tBehavior.createDataObject(), + getBaseMetaTileEntity()); } @Override @@ -1010,9 +1005,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (aSide == mMainFacing || aIndex < getInputSlot() - || aIndex >= getInputSlot() + mInputSlotCount - || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) - return false; + || aIndex >= getInputSlot() + mInputSlotCount + || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) return false; for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i]) && mDisableMultiStack) return i == aIndex; @@ -1025,7 +1019,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * check for it anyway. */ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, - ItemStack aStack) { + ItemStack aStack) { return !mDisableMultiStack || mInventory[aIndex] == null; } @@ -1085,25 +1079,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId) { return // TODO check or get a better solution DimensionManager.getProvider(dimId) - .getClass() - .getName() - .contains("Orbit") - || DimensionManager.getProvider(dimId) - .getClass() - .getName() - .endsWith("Space") - || DimensionManager.getProvider(dimId) - .getClass() - .getName() - .endsWith("Asteroids") - || DimensionManager.getProvider(dimId) - .getClass() - .getName() - .endsWith("SS") - || DimensionManager.getProvider(dimId) - .getClass() - .getName() - .contains("SpaceStation"); + .getClass() + .getName() + .contains("Orbit") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("Space") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("Asteroids") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("SS") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .contains("SpaceStation"); } /** @@ -1116,17 +1110,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B GT_Recipe_Map tMap = getRecipeList(); if (tMap == null) return DID_NOT_FIND_RECIPE; GT_Recipe tRecipe = tMap.findRecipe( - getBaseMetaTileEntity(), - mLastRecipe, - false, - V[mTier], - new FluidStack[] { getFillableStack() }, - getSpecialSlot(), - getAllInputs()); + getBaseMetaTileEntity(), + mLastRecipe, + false, + V[mTier], + new FluidStack[] { getFillableStack() }, + getSpecialSlot(), + getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (GT_Mod.gregtechproxy.mLowGravProcessing && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300) - && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) + && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { @@ -1134,8 +1128,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } if (tRecipe.mSpecialValue == -200 - && (getCallbackBase() == null || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom) - || ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency == 0)) + && (getCallbackBase() == null || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom) + || ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency == 0)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs())) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; @@ -1145,14 +1139,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (tRecipe.mSpecialValue == -200 || tRecipe.mSpecialValue == -300) for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) - > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) { - if (debugCleanroom) { - GT_Log.out.println( - "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " - + ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency); - } - mOutputItems[i] = null; + > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) { + if (debugCleanroom) { + GT_Log.out.println( + "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + + ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency); } + mOutputItems[i] = null; + } mOutputFluid = tRecipe.getFluidOutput(0); if (!skipOC) { calculateOverclockedNess(tRecipe); @@ -1221,7 +1215,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); if (tag.getBoolean("stutteringSingleBlock")) { @@ -1232,41 +1226,41 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B int mEUt = tag.getInteger("eut"); if (mEUt > 0) { currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.use", - GT_Utility.formatNumbers(mEUt), - GT_Utility.getColoredTierNameFromVoltage(mEUt))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.use", + GT_Utility.formatNumbers(mEUt), + GT_Utility.getColoredTierNameFromVoltage(mEUt))); } else if (mEUt < 0) { currenttip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.produce", - GT_Utility.formatNumbers(-mEUt), - GT_Utility.getColoredTierNameFromVoltage(-mEUt))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.produce", + GT_Utility.formatNumbers(-mEUt), + GT_Utility.getColoredTierNameFromVoltage(-mEUt))); } } currenttip.add( - GT_Waila.getMachineProgressString( - isActive, - tag.getInteger("maxProgressSingleBlock"), - tag.getInteger("progressSingleBlock"))); + GT_Waila.getMachineProgressString( + isActive, + tag.getInteger("maxProgressSingleBlock"), + tag.getInteger("progressSingleBlock"))); } currenttip.add( - String.format( - "Machine Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")) - .name())); + String.format( + "Machine Facing: %s", + ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")) + .name())); currenttip.add( - String.format( - "Output Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")) - .name())); + String.format( + "Output Facing: %s", + ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")) + .name())); } @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setInteger("progressSingleBlock", mProgresstime); @@ -1310,9 +1304,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B getRecipeList().addGregTechLogoUI(builder, new Pos2d(0, 0)); } else { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } } @@ -1328,22 +1322,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B builder.widget(createChargerSlot(79, 62)); if (getRecipeList() != null) { builder.widget( - setNEITransferRect( - createProgressBar( - isSteampowered() ? getRecipeList().getProgressBarTextureSteam(getSteamVariant()) - : getRecipeList().getProgressBarTexture(), - getRecipeList().getProgressBarImageSize(), - getRecipeList().progressBarDirection, - getRecipeList().progressBarPos, - getRecipeList().progressBarSize), - getRecipeList().mNEIName)); + setNEITransferRect( + createProgressBar( + isSteampowered() ? getRecipeList().getProgressBarTextureSteam(getSteamVariant()) + : getRecipeList().getProgressBarTexture(), + getRecipeList().getProgressBarImageSize(), + getRecipeList().progressBarDirection, + getRecipeList().progressBarPos, + getRecipeList().progressBarSize), + getRecipeList().mNEIName)); addProgressBarSpecialTextures(builder); } builder.widget( - createErrorStatusArea( - builder, - isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM - : GT_UITextures.PICTURE_STALLED_ELECTRICITY)); + createErrorStatusArea( + builder, + isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM : GT_UITextures.PICTURE_STALLED_ELECTRICITY)); } /** @@ -1351,23 +1344,23 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected void addIOSlots(ModularWindow.Builder builder) { final boolean hasFluidInput = getRecipeList() != null ? (getRecipeList().hasFluidInputs()) - : (getCapacity() != 0); + : (getCapacity() != 0); final boolean hasFluidOutput = getRecipeList() != null && getRecipeList().hasFluidOutputs(); UIHelper.forEachSlots( - (i, backgrounds, pos) -> builder.widget(createItemInputSlot(i, backgrounds, pos)), - (i, backgrounds, pos) -> builder.widget(createItemOutputSlot(i, backgrounds, pos)), - (i, backgrounds, pos) -> builder.widget(createSpecialSlot(backgrounds, pos)), - (i, backgrounds, pos) -> builder.widget(createFluidInputSlot(backgrounds, pos)), - (i, backgrounds, pos) -> builder.widget(createFluidOutputSlot(backgrounds, pos)), - getGUITextureSet().getItemSlot(), - getGUITextureSet().getFluidSlot(), - getRecipeList(), - mInputSlotCount, - mOutputItems.length, - hasFluidInput ? 1 : 0, - hasFluidOutput ? 1 : 0, - getSteamVariant(), - Pos2d.ZERO); + (i, backgrounds, pos) -> builder.widget(createItemInputSlot(i, backgrounds, pos)), + (i, backgrounds, pos) -> builder.widget(createItemOutputSlot(i, backgrounds, pos)), + (i, backgrounds, pos) -> builder.widget(createSpecialSlot(backgrounds, pos)), + (i, backgrounds, pos) -> builder.widget(createFluidInputSlot(backgrounds, pos)), + (i, backgrounds, pos) -> builder.widget(createFluidOutputSlot(backgrounds, pos)), + getGUITextureSet().getItemSlot(), + getGUITextureSet().getFluidSlot(), + getRecipeList(), + mInputSlotCount, + mOutputItems.length, + hasFluidInput ? 1 : 0, + hasFluidOutput ? 1 : 0, + getSteamVariant(), + Pos2d.ZERO); } /** @@ -1375,8 +1368,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createItemInputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index).setAccess(true, true) - .setBackground(backgrounds) - .setPos(pos); + .setBackground(backgrounds) + .setPos(pos); } /** @@ -1384,8 +1377,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createItemOutputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index).setAccess(true, false) - .setBackground(backgrounds) - .setPos(pos); + .setBackground(backgrounds) + .setPos(pos); } /** @@ -1393,71 +1386,57 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()).setAccess(true, true) - .disableShiftInsert() - .setGTTooltip( - () -> mTooltipCache.getData( - getRecipeList() - != null - && getRecipeList().usesSpecialSlot() - ? SPECIAL_SLOT_TOOLTIP - : UNUSED_SLOT_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + .disableShiftInsert() + .setGTTooltip( + () -> mTooltipCache.getData( + getRecipeList() != null && getRecipeList().usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP + : UNUSED_SLOT_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } protected FluidDisplaySlotWidget createFluidInputSlot(IDrawable[] backgrounds, Pos2d pos) { return (FluidDisplaySlotWidget) new FluidDisplaySlotWidget( - inventoryHandler, - OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length) - .setFluidAccessConstructor( - () -> constructFluidAccess(true)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(true) - .setActionRealClick( - FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to - // actual fluid stored in this tank - setFillableStack( - GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot() - .getStack())); - } - return true; - }) - .setUpdateFluidDisplayItem( - this::updateFluidInputDisplayItem) - .setGTTooltip( - () -> mTooltipCache.getData( - FLUID_INPUT_TOOLTIP, - GT_Utility.formatNumbers( - getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + inventoryHandler, + OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length) + .setFluidAccessConstructor(() -> constructFluidAccess(true)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(true) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to + // actual fluid stored in this tank + setFillableStack( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack())); + } + return true; + }) + .setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem) + .setGTTooltip(() -> mTooltipCache.getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } protected FluidDisplaySlotWidget createFluidOutputSlot(IDrawable[] backgrounds, Pos2d pos) { - return (FluidDisplaySlotWidget) createDrainableFluidSlot().setUpdateFluidDisplayItem( - this::updateFluidOutputDisplayItem) - .setGTTooltip( - () -> mTooltipCache.getData( - FLUID_OUTPUT_TOOLTIP, - GT_Utility.formatNumbers( - getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + return (FluidDisplaySlotWidget) createDrainableFluidSlot() + .setUpdateFluidDisplayItem(this::updateFluidOutputDisplayItem) + .setGTTooltip(() -> mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } @Override protected SlotWidget createChargerSlot(int x, int y) { if (isSteampowered()) { - return (SlotWidget) createChargerSlot(x, y, UNUSED_SLOT_TOOLTIP, new String[0]).setBackground( - getGUITextureSet().getItemSlot()); + return (SlotWidget) createChargerSlot(x, y, UNUSED_SLOT_TOOLTIP, new String[0]) + .setBackground(getGUITextureSet().getItemSlot()); } else { return super.createChargerSlot(x, y); } @@ -1465,36 +1444,32 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected CycleButtonWidget createItemAutoOutputButton() { return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mItemTransfer, val -> mItemTransfer = val) - .setStaticTexture( - GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM) - .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip( - () -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(25, 62) - .setSize(18, 18); + .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(25, 62) + .setSize(18, 18); } protected CycleButtonWidget createFluidAutoOutputButton() { return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val) - .setStaticTexture( - GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID) - .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip( - () -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(7, 62) - .setSize(18, 18); + .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(7, 62) + .setSize(18, 18); } protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, - Pos2d pos, Size size) { + Pos2d pos, Size size) { final ProgressBar ret = new ProgressBar(); ret.setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0) - .setTexture(texture, imageSize) - .setDirection(direction) - .setPos(pos) - .setSize(size); + .setTexture(texture, imageSize) + .setDirection(direction) + .setPos(pos) + .setSize(size); return ret; } @@ -1507,13 +1482,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B final Power powerInfo = getPower(); final String transferRectTooltip; if (isSteampowered()) { - transferRectTooltip = StatCollector.translateToLocalFormatted( - NEI_TRANSFER_STEAM_TOOLTIP, - powerInfo.getTierString()); + transferRectTooltip = StatCollector + .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString()); } else { - transferRectTooltip = StatCollector.translateToLocalFormatted( - NEI_TRANSFER_VOLTAGE_TOOLTIP, - powerInfo.getTierString()); + transferRectTooltip = StatCollector + .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString()); } widget.setNEITransferRect(transferRectID, new Object[] { powerInfo }, transferRectTooltip); } @@ -1524,53 +1497,50 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (isSteampowered()) { for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTexturesSteam) { builder.widget( - new DrawableWidget().setDrawable( - specialTexture.getLeft() - .get(getSteamVariant())) - .setSize( - specialTexture.getRight() - .getLeft()) - .setPos( - specialTexture.getRight() - .getRight())); + new DrawableWidget().setDrawable( + specialTexture.getLeft() + .get(getSteamVariant())) + .setSize( + specialTexture.getRight() + .getLeft()) + .setPos( + specialTexture.getRight() + .getRight())); } } else { for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTextures) { builder.widget( - new DrawableWidget().setDrawable(specialTexture.getLeft()) - .setSize( - specialTexture.getRight() - .getLeft()) - .setPos( - specialTexture.getRight() - .getRight())); + new DrawableWidget().setDrawable(specialTexture.getLeft()) + .setSize( + specialTexture.getRight() + .getLeft()) + .setPos( + specialTexture.getRight() + .getRight())); } } } protected DrawableWidget createErrorStatusArea(ModularWindow.Builder builder, IDrawable picture) { return (DrawableWidget) new DrawableWidget().setDrawable(picture) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setEnabled( - widget -> !widget.getTooltip() - .isEmpty()) - .dynamicTooltip(this::getErrorDescriptions) - .dynamicTooltipShift(this::getErrorDescriptionsShift) - .setPos(79, 44) - .setSize(18, 18) - .attachSyncer( - new FakeSyncWidget.BooleanSyncer( - () -> mStuttering, - val -> mStuttering = val), - builder, - (widget, val) -> widget.notifyTooltipChange()) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID( - val)), - builder, - (widget, val) -> widget.notifyTooltipChange()); + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setEnabled( + widget -> !widget.getTooltip() + .isEmpty()) + .dynamicTooltip(this::getErrorDescriptions) + .dynamicTooltipShift(this::getErrorDescriptionsShift) + .setPos(79, 44) + .setSize(18, 18) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer(() -> mStuttering, val -> mStuttering = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val)), + builder, + (widget, val) -> widget.notifyTooltipChange()); } protected List<String> getErrorDescriptions() { @@ -1591,8 +1561,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } if (mStuttering) { return mTooltipCache.getData( - STALLED_STUTTERING_TOOLTIP, - StatCollector.translateToLocal(POWER_SOURCE_KEY + (isSteampowered() ? "steam" : "power"))); + STALLED_STUTTERING_TOOLTIP, + StatCollector.translateToLocal(POWER_SOURCE_KEY + (isSteampowered() ? "steam" : "power"))); } return null; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index d2433e04e6..38fce53658 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -44,27 +44,27 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE public boolean mNeedsSteamVenting = false; public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super( - aID, - aName, - aNameRegional, - aHighPressure ? 2 : 1, - 0, - aDescription, - aInputSlotCount, - aOutputSlotCount, - "", - ""); + aID, + aName, + aNameRegional, + aHighPressure ? 2 : 1, + 0, + aDescription, + aInputSlotCount, + aOutputSlotCount, + "", + ""); } public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String aDescription, ITexture[][][] aTextures, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); } public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String[] aDescription, ITexture[][][] aTextures, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); } @@ -162,37 +162,25 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public boolean allowToCheckRecipe() { if (mNeedsSteamVenting - && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) == 0 - && !GT_Utility.hasBlockHitBox( - getBaseMetaTileEntity().getWorld(), - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) { + && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) == 0 + && !GT_Utility.hasBlockHitBox( + getBaseMetaTileEntity().getWorld(), + getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) { sendSound((byte) 9); mNeedsSteamVenting = false; try { for (EntityLivingBase tLiving : getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getOffsetX( - getBaseMetaTileEntity().getFrontFacing(), - 1), - getBaseMetaTileEntity().getOffsetY( - getBaseMetaTileEntity().getFrontFacing(), - 1), - getBaseMetaTileEntity().getOffsetZ( - getBaseMetaTileEntity().getFrontFacing(), - 1), - getBaseMetaTileEntity().getOffsetX( - getBaseMetaTileEntity().getFrontFacing(), - 1) + 1, - getBaseMetaTileEntity().getOffsetY( - getBaseMetaTileEntity().getFrontFacing(), - 1) + 1, - getBaseMetaTileEntity().getOffsetZ( - getBaseMetaTileEntity().getFrontFacing(), - 1) + 1))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) + 1, + getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 1, + getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 1))) { GT_Utility.applyHeatDamage(tLiving, getSteamDamage()); } } catch (Throwable e) { @@ -204,14 +192,10 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public int checkRecipe() { - GT_Recipe tRecipe = getRecipeList().findRecipe( - getBaseMetaTileEntity(), - false, - gregtech.api.enums.GT_Values.V[mTier], - null, - getAllInputs()); + GT_Recipe tRecipe = getRecipeList() + .findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[mTier], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) - && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { + && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { this.mOutputItems[0] = tRecipe.getOutput(0); calculateOverclockedNess(tRecipe); return 2; @@ -238,21 +222,19 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD) - .setWorld(getBaseMetaTileEntity().getWorld()) - .setMotion( - ForgeDirection.getOrientation( - getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, - ForgeDirection.getOrientation( - getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, - ForgeDirection.getOrientation( - getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0) - .<ParticleEventBuilder>times( - 8, - x -> x.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()) - .run()); + .setWorld(getBaseMetaTileEntity().getWorld()) + .setMotion( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0) + .<ParticleEventBuilder>times( + 8, + x -> x + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -264,8 +246,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { return GregTech_API.getCoverBehaviorNew(aCoverID.toStack()) - .isSimpleCover() - && super.allowCoverOnSide(aSide, aCoverID); + .isSimpleCover() && super.allowCoverOnSide(aSide, aCoverID); } public float getSteamDamage() { @@ -275,99 +256,99 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public ITexture[] getSideFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getTopFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override @@ -383,9 +364,9 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 70afd35f57..0dc019ae5c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -61,112 +61,93 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private FallbackableUITexture progressBarTexture; public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, - String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, - int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { + String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { super( - aID, - aName, - aNameRegional, - aTier, - aRecipes.mAmperage, - aDescription, - aInputSlots, - aOutputSlots, - aGUIName, - aRecipes.mNEIName, + aID, + aName, + aNameRegional, + aTier, + aRecipes.mAmperage, + aDescription, + aInputSlots, + aOutputSlots, + aGUIName, + aRecipes.mNEIName, + TextureFactory.of( TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_ACTIVE")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_ACTIVE_GLOW"))) - .glow() - .build()), + new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE_GLOW"))) + .glow() + .build()), + TextureFactory.of( + TextureFactory + .of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_GLOW"))) + .glow() + .build()), + TextureFactory.of( TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_GLOW"))) - .glow() - .build()), + new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE_GLOW"))) + .glow() + .build()), + TextureFactory.of( + TextureFactory + .of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_GLOW"))) + .glow() + .build()), + TextureFactory.of( TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_ACTIVE")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_ACTIVE_GLOW"))) - .glow() - .build()), + new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE_GLOW"))) + .glow() + .build()), + TextureFactory.of( + TextureFactory + .of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_GLOW"))) + .glow() + .build()), + TextureFactory.of( TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_GLOW"))) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_ACTIVE")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_ACTIVE_GLOW"))) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_GLOW"))) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_ACTIVE")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) - .glow() - .build()), - TextureFactory.of( - TextureFactory.of( - new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), - TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_GLOW"))) - .glow() - .build())); + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) + .glow() + .build()), + TextureFactory.of( + TextureFactory + .of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), + TextureFactory.builder() + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_GLOW"))) + .glow() + .build())); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; @@ -518,39 +499,39 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } if (!GT_ModHandler.addCraftingRecipe( - getStackForm(1), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED - | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE, - aRecipe)) { + getStackForm(1), + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED + | GT_ModHandler.RecipeBits.NOT_REMOVABLE + | GT_ModHandler.RecipeBits.REVERSIBLE, + aRecipe)) { throw new IllegalArgumentException("INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName()); } } } public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, - String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, - int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { + String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe) { this( - aID, - aName, - aNameRegional, - aTier, - aDescription, - aRecipes, - aInputSlots, - aOutputSlots, - aTankCapacity, - aGUIParameterA, - aGUIParameterB, - aGUIName, - aSound.resourceLocation, - aSharedTank, - aRequiresFluidForFiltering, - aSpecialEffect, - aOverlays, - aRecipe); + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + aSound.resourceLocation, + aSharedTank, + aRequiresFluidForFiltering, + aSpecialEffect, + aOverlays, + aRecipe); } /** @@ -561,34 +542,34 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ */ @Deprecated public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, - String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, - int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { + String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { this( - aID, - aName, - aNameRegional, - aTier, - aDescription, - aRecipes, - aInputSlots, - aOutputSlots, - aTankCapacity, - aGUIParameterA, - aGUIParameterB, - aGUIName, - new ResourceLocation(aSound), - aSharedTank, - aRequiresFluidForFiltering, - SpecialEffects.fromId(aSpecialEffect), - aOverlays, - aRecipe); + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + new ResourceLocation(aSound), + aSharedTank, + aRequiresFluidForFiltering, + SpecialEffects.fromId(aSpecialEffect), + aOverlays, + aRecipe); } public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String aDescription, - GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, - String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { + GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -601,9 +582,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription, - GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, - String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { + GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -618,23 +599,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_BasicMachine_GT_Recipe( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mRecipes, - this.mInputSlotCount, - this.mOutputItems == null ? 0 : this.mOutputItems.length, - this.mTankCapacity, - this.mAmperage, - this.mGUIParameterA, - this.mGUIParameterB, - this.mTextures, - this.mGUIName, - this.mNEIName, - this.mSoundResourceLocation.toString(), - this.mSharedTank, - this.mRequiresFluidForFiltering, - this.mSpecialEffect.ordinal()).setProgressBarTexture(this.progressBarTexture); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mRecipes, + this.mInputSlotCount, + this.mOutputItems == null ? 0 : this.mOutputItems.length, + this.mTankCapacity, + this.mAmperage, + this.mGUIParameterA, + this.mGUIParameterB, + this.mTextures, + this.mGUIName, + this.mNEIName, + this.mSoundResourceLocation.toString(), + this.mSharedTank, + this.mRequiresFluidForFiltering, + this.mSpecialEffect.ordinal()).setProgressBarTexture(this.progressBarTexture); } public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTexture(FallbackableUITexture progressBarTexture) { @@ -644,7 +625,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name, UITexture fallback) { return setProgressBarTexture( - new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback)); + new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback)); } public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name) { @@ -659,19 +640,19 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine( - aPlayerInventory, - aBaseMetaTileEntity, - this.getLocalName(), - this.mGUIName, - GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName - : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", - this.mGUIParameterA, - this.mGUIParameterB); + aPlayerInventory, + aBaseMetaTileEntity, + this.getLocalName(), + this.mGUIName, + GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName + : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", + this.mGUIParameterA, + this.mGUIParameterB); } @Override protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, - ItemStack aStack) { + ItemStack aStack) { if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false; switch (this.mInputSlotCount) { case 0 -> { @@ -679,10 +660,28 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } case 1 -> { if (this.getFillableStack() == null) return !this.mRequiresFluidForFiltering && this.getRecipeList() - .containsInput( - aStack); + .containsInput(aStack); else return this.getRecipeList() - .findRecipe( + .findRecipe( + this.getBaseMetaTileEntity(), + this.mLastRecipe, + true, + true, + V[this.mTier], + new FluidStack[] { this.getFillableStack() }, + this.getSpecialSlot(), + appendSelectedCircuit(aStack)) + != null; + } + case 2 -> { + return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) + && (((this.getInputAt(0) != null && this.getInputAt(1) != null) + || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList() + .containsInput(aStack) + : (this.getRecipeList() + .containsInput(aStack) + && this.getRecipeList() + .findRecipe( this.getBaseMetaTileEntity(), this.mLastRecipe, true, @@ -690,33 +689,14 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ V[this.mTier], new FluidStack[] { this.getFillableStack() }, this.getSpecialSlot(), - appendSelectedCircuit(aStack)) - != null; - } - case 2 -> { - return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0) - != null && this.getInputAt(1) != null) - || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList() - .containsInput(aStack) - : (this.getRecipeList() - .containsInput(aStack) - && this.getRecipeList() - .findRecipe( - this.getBaseMetaTileEntity(), - this.mLastRecipe, - true, - true, - V[this.mTier], - new FluidStack[] { this.getFillableStack() }, - this.getSpecialSlot(), - aIndex == this.getInputSlot() - ? appendSelectedCircuit(aStack, this.getInputAt(1)) - : appendSelectedCircuit(this.getInputAt(0), aStack)) - != null)))); + aIndex == this.getInputSlot() + ? appendSelectedCircuit(aStack, this.getInputAt(1)) + : appendSelectedCircuit(this.getInputAt(0), aStack)) + != null)))); } default -> { int tID = this.getBaseMetaTileEntity() - .getMetaTileID(); + .getMetaTileID(); if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { // assembler // lv-iv; // circuit @@ -727,12 +707,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ // luv-uev if (GT_Utility.isStackValid(aStack)) for (int oreID : OreDictionary.getOreIDs(aStack)) { if (OreDictionary.getOreName(oreID) - .startsWith("circuit")) - return true; + .startsWith("circuit")) return true; } } return this.getRecipeList() - .containsInput(aStack); + .containsInput(aStack); } } } @@ -751,20 +730,17 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case TOP_SMOKE -> { final byte topFacing = (byte) ForgeDirection.UP.ordinal(); if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { new ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D) - .setIdentifier(ParticleFX.SMOKE) - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - - XSTR_INSTANCE.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F - + XSTR_INSTANCE.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - - XSTR_INSTANCE.nextFloat() * 0.6F) - .setWorld(aBaseMetaTileEntity.getWorld()) - .run(); + .setIdentifier(ParticleFX.SMOKE) + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F) + .setWorld(aBaseMetaTileEntity.getWorld()) + .run(); } } default -> {} @@ -790,7 +766,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ final byte mainFacing = (byte) this.mMainFacing; if (mainFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { + && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); final double oY = aBaseMetaTileEntity.getYCoord(); @@ -826,11 +802,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()).setMotion(mX, 0, mZ) - .setPosition(x, y, z) - .setWorld( - getBaseMetaTileEntity().getWorld()); + .setPosition(x, y, z) + .setWorld(getBaseMetaTileEntity().getWorld()); particleEventBuilder.setIdentifier(ParticleFX.LAVA) - .run(); + .run(); } } } @@ -852,8 +827,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1 && this.mSoundResourceLocation != null - && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain()) - && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath())) + && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain()) + && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath())) GT_Utility.doSoundAtClient(this.mSoundResourceLocation, 100, 1.0F, aX, aY, aZ); } @@ -863,8 +838,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ // Added to throttle sounds. To reduce lag, this is on the server side so BlockUpdate packets aren't sent. if (myMetaTileEntity.mTickTimer > (myMetaTileEntity.mLastSoundTick + ticksBetweenSounds)) { if (this.mSoundResourceLocation != null - && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain()) - && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath())) + && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain()) + && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath())) this.sendLoopStart((byte) 1); // Does not have overflow protection, but they are longs. myMetaTileEntity.mLastSoundTick = myMetaTileEntity.mTickTimer; @@ -888,10 +863,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, - Pos2d pos, Size size) { - return super.createProgressBar(texture, imageSize, direction, pos, size).setTexture( - progressBarTexture.get(), - mRecipes.getProgressBarImageSize()); + Pos2d pos, Size size) { + return super.createProgressBar(texture, imageSize, direction, pos, size) + .setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize()); } public enum X { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java index 3488ab25c1..8a8f63cdb9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java @@ -23,20 +23,20 @@ import gregtech.common.power.SteamPower; * Machine */ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEntity_BasicMachine_Bronze - implements IGetTitleColor { + implements IGetTitleColor { public GT_MetaTileEntity_BasicMachine_Steel(int aID, String aName, String aNameRegional, String aDescription, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super(aID, aName, aNameRegional, aDescription, aInputSlotCount, aOutputSlotCount, aHighPressure); } public GT_MetaTileEntity_BasicMachine_Steel(String aName, String aDescription, ITexture[][][] aTextures, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } public GT_MetaTileEntity_BasicMachine_Steel(String aName, String[] aDescription, ITexture[][][] aTextures, - int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } @@ -48,99 +48,99 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn @Override public ITexture[] getSideFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getTopFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) }; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { return new ITexture[] { TextureFactory.of( - isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, - Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java index 193d654af6..7d4723d4f6 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java @@ -32,7 +32,7 @@ import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually */ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_TieredMachineBlock - implements IHasFluidDisplayItem, IAddUIWidgets { + implements IHasFluidDisplayItem, IAddUIWidgets { public FluidStack mFluid; protected int mOpenerCount; @@ -41,22 +41,22 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier * @param aInvSlotCount should be 3 */ public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription, ITexture... aTextures) { + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription, ITexture... aTextures) { + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -184,9 +184,9 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier if (getFillableStack() == null) { if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { if (aBaseMetaTileEntity.addStackToSlot( - getOutputSlot(), - GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), - 1)) { + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { setFillableStack(tFluid.copy()); this.onEmptyingContainerWhenEmpty(); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); @@ -194,11 +194,11 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } } else { if (tFluid.isFluidEqual(getFillableStack()) - && ((long) tFluid.amount + getFillableStack().amount) <= (long) getCapacity()) { + && ((long) tFluid.amount + getFillableStack().amount) <= (long) getCapacity()) { if (aBaseMetaTileEntity.addStackToSlot( - getOutputSlot(), - GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), - 1)) { + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { getFillableStack().amount += tFluid.amount; aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); } @@ -208,11 +208,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } if (doesFillContainers()) { - ItemStack tOutput = GT_Utility.fillFluidContainer( - getDrainableStack(), - mInventory[getInputSlot()], - false, - true); + ItemStack tOutput = GT_Utility + .fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); @@ -230,10 +227,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) mInventory[getStackDisplaySlot()] = null; } else { - mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack( - getDisplayedFluid(), - true, - !displaysStackSize()); + mInventory[getStackDisplaySlot()] = GT_Utility + .getFluidDisplayStack(getDisplayedFluid(), true, !displaysStackSize()); } } } @@ -251,13 +246,10 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public int fill(FluidStack aFluid, boolean doFill) { if (aFluid == null || aFluid.getFluid() - .getID() - <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) - return 0; + .getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; if (getFillableStack() == null || getFillableStack().getFluid() - .getID() - <= 0) { + .getID() <= 0) { if (aFluid.amount <= getCapacity()) { if (doFill) { setFillableStack(aFluid.copy()); @@ -320,7 +312,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {}; if (isDrainableStackSeparate()) { return new FluidTankInfo[] { new FluidTankInfo(getFillableStack(), getCapacity()), - new FluidTankInfo(getDrainableStack(), getCapacity()) }; + new FluidTankInfo(getDrainableStack(), getCapacity()) }; } else { return new FluidTankInfo[] { new FluidTankInfo(this) }; } @@ -343,56 +335,50 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 16) - .setSize(71, 45)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE) - .setPos(79, 34) - .setSize(18, 18)) - .widget( - new SlotWidget(inventoryHandler, getInputSlot()) - .setBackground( - getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_IN) - .setPos(79, 16)) - .widget( - new SlotWidget(inventoryHandler, getOutputSlot()) - .setBackground( - getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(79, 52)) - .widget( - createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT) - .setPos(58, 41)) - .widget( - new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 20)) - .widget( - TextWidget.dynamicString( - () -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 30)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 16) + .setSize(71, 45)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE) + .setPos(79, 34) + .setSize(18, 18)) + .widget( + new SlotWidget(inventoryHandler, getInputSlot()) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget( + new SlotWidget(inventoryHandler, getOutputSlot()) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(79, 52)) + .widget( + createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT) + .setPos(58, 41)) + .widget( + new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget( + TextWidget.dynamicString(() -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)); } protected FluidDisplaySlotWidget createDrainableFluidSlot() { - return new FluidDisplaySlotWidget( - inventoryHandler, - getStackDisplaySlot()).setFluidAccessConstructor(() -> constructFluidAccess(false)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(!isDrainableStackSeparate()) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setDrainableStack( - GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot() - .getStack())); - } - return true; - }); + return new FluidDisplaySlotWidget(inventoryHandler, getStackDisplaySlot()) + .setFluidAccessConstructor(() -> constructFluidAccess(false)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(!isDrainableStackSeparate()) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to actual fluid stored in this tank + setDrainableStack( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack())); + } + return true; + }); } protected IFluidAccess constructFluidAccess(boolean aIsFillableStack) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 1b451f3108..f7f69ae924 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -33,26 +33,26 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM public int mMaxStackSize = 64; public static int MAX = 8; public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false, - bSortStacks = false; + bSortStacks = false; public int mSuccess = 0, mTargetStackSize = 0; public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription) { + String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription) { + String[] aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -62,29 +62,29 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM ITexture tIcon = getOverlayIcon(); ITexture tOut = TextureFactory.of(OVERLAY_PIPE_OUT); ITexture tUp = TextureFactory.of( - TextureFactory.of(ARROW_UP), - TextureFactory.builder() - .addIcon(ARROW_UP_GLOW) - .glow() - .build()); + TextureFactory.of(ARROW_UP), + TextureFactory.builder() + .addIcon(ARROW_UP_GLOW) + .glow() + .build()); ITexture tDown = TextureFactory.of( - TextureFactory.of(ARROW_DOWN), - TextureFactory.builder() - .addIcon(ARROW_DOWN_GLOW) - .glow() - .build()); + TextureFactory.of(ARROW_DOWN), + TextureFactory.builder() + .addIcon(ARROW_DOWN_GLOW) + .glow() + .build()); ITexture tLeft = TextureFactory.of( - TextureFactory.of(ARROW_LEFT), - TextureFactory.builder() - .addIcon(ARROW_LEFT_GLOW) - .glow() - .build()); + TextureFactory.of(ARROW_LEFT), + TextureFactory.builder() + .addIcon(ARROW_LEFT_GLOW) + .glow() + .build()); ITexture tRight = TextureFactory.of( - TextureFactory.of(ARROW_RIGHT), - TextureFactory.builder() - .addIcon(ARROW_RIGHT_GLOW) - .glow() - .build()); + TextureFactory.of(ARROW_RIGHT), + TextureFactory.builder() + .addIcon(ARROW_RIGHT_GLOW) + .glow() + .build()); for (int i = 0; i < rTextures[0].length; i++) { rTextures[OUTPUT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tOut }; rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tRight, tIcon }; @@ -98,7 +98,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { int colorIndex = aColorIndex + 1; ForgeDirection side = ForgeDirection.VALID_DIRECTIONS[aSide]; ForgeDirection facing = ForgeDirection.VALID_DIRECTIONS[aFacing]; @@ -292,15 +292,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("098", "Do not regulate Item Stack Size")); } else { GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("099", "Regulate Item Stack Size to: ") + mTargetStackSize); + aPlayer, + GT_Utility.trans("099", "Regulate Item Stack Size to: ") + mTargetStackSize); } } } @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { aWrenchingSide = GT_Utility.getOppositeSide(aWrenchingSide); if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); @@ -329,9 +329,9 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() - && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() - || aTimer % 200 == 0 - || mSuccess > 0)) { + && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTimer % 200 == 0 + || mSuccess > 0)) { mSuccess--; updateSlots(); moveItems(aBaseMetaTileEntity, aTimer); @@ -351,29 +351,29 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer, int stacks) { int tCost; if (bStockingMode) tCost = GT_Utility.moveMultipleItemStacks( - aBaseMetaTileEntity, - aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), - aBaseMetaTileEntity.getBackFacing(), - aBaseMetaTileEntity.getFrontFacing(), - null, - false, - mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, - mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, - (byte) 64, - (byte) 1, - stacks); + aBaseMetaTileEntity, + aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.getBackFacing(), + aBaseMetaTileEntity.getFrontFacing(), + null, + false, + mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, + mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, + (byte) 64, + (byte) 1, + stacks); else tCost = GT_Utility.moveMultipleItemStacks( - aBaseMetaTileEntity, - aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), - aBaseMetaTileEntity.getBackFacing(), - aBaseMetaTileEntity.getFrontFacing(), - null, - false, - (byte) 64, - (byte) 1, - mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, - mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, - stacks); + aBaseMetaTileEntity, + aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.getBackFacing(), + aBaseMetaTileEntity.getFrontFacing(), + null, + false, + (byte) 64, + (byte) 1, + mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, + mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, + stacks); if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { mSuccess = 50; @@ -424,7 +424,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM int slot = validSlots.get(slotindex); slotindex++; mInventory[slot] = stacks.get(sID) - .copy(); + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -433,14 +433,14 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (aPlayer.isSneaking()) { // I was so proud of all this but I literally just copied code from OutputBus bSortStacks = !bSortStacks; GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("200", "Sort mode: ") - + (bSortStacks ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled"))); + aPlayer, + GT_Utility.trans("200", "Sort mode: ") + + (bSortStacks ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled"))); return true; } return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); @@ -456,21 +456,19 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bOutput = !bOutput; if (bOutput) { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("116", "Emit Energy to Outputside")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("116", "Emit Energy to Outputside")); } else { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("117", "Don't emit Energy")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("117", "Don't emit Energy")); } }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY) - .setPos(7, 62) - .setSize(18, 18)); + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY) + .setPos(7, 62) + .setSize(18, 18)); } protected void addEmitRedstoneButton(ModularWindow.Builder builder) { @@ -478,21 +476,19 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bRedstoneIfFull = !bRedstoneIfFull; if (bRedstoneIfFull) { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("118", "Emit Redstone if no Slot is free")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("118", "Emit Redstone if no Slot is free")); } else { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("119", "Don't emit Redstone")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("119", "Don't emit Redstone")); } }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE) - .setPos(25, 62) - .setSize(18, 18)); + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE) + .setPos(25, 62) + .setSize(18, 18)); } protected void addInvertRedstoneButton(ModularWindow.Builder builder) { @@ -500,21 +496,19 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bInvert = !bInvert; if (bInvert) { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("120", "Invert Redstone")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("120", "Invert Redstone")); } else { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("121", "Don't invert Redstone")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("121", "Don't invert Redstone")); } }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE) - .setPos(43, 62) - .setSize(18, 18)); + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE) + .setPos(43, 62) + .setSize(18, 18)); } protected void addStockingModeButton(ModularWindow.Builder builder) { @@ -522,32 +516,30 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bStockingMode = !bStockingMode; if (bStockingMode) { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans( - "217", - "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); + widget.getContext() + .getPlayer(), + GT_Utility.trans( + "217", + "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); } else { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans( - "218", - "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); + widget.getContext() + .getPlayer(), + GT_Utility.trans( + "218", + "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); } }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE) - .setPos(61, 62) - .setSize(18, 18)); + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE) + .setPos(61, 62) + .setSize(18, 18)); } protected void addInventorySlots(ModularWindow.Builder builder) { builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 9) - .endAtSlot(26) - .build() - .setPos(7, 4)); + SlotGroup.ofItemHandler(inventoryHandler, 9) + .endAtSlot(26) + .build() + .setPos(7, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java index 700732f033..a4456e056c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java @@ -36,7 +36,7 @@ import gregtech.api.util.GT_StructureUtility; * @param <T> */ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTileEntity_CubicMultiBlockBase<T>> - extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements ISurvivalConstructable { + extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements ISurvivalConstructable { protected static final String STRUCTURE_PIECE_MAIN = "main"; protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>> STRUCTURE_DEFINITION = new ClassValue<>() { @@ -44,27 +44,23 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil @Override protected IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>> computeValue(Class<?> type) { return StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "hhh", "hhh", "hhh" }, { "h~h", "h-h", "hhh" }, - { "hhh", "hhh", "hhh" }, })) - .addElement( - 'h', - ofChain( - lazy( - t -> GT_StructureUtility.<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder() - .atLeastList( - t.getAllowedHatches()) - .casingIndex( - t.getHatchTextureIndex()) - .dot(1) - .build()), - onElementPass( - GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded, - lazy( - GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)))) - .build(); + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "hhh", "hhh", "hhh" }, { "h~h", "h-h", "hhh" }, { "hhh", "hhh", "hhh" }, })) + .addElement( + 'h', + ofChain( + lazy( + t -> GT_StructureUtility.<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder() + .atLeastList(t.getAllowedHatches()) + .casingIndex(t.getHatchTextureIndex()) + .dot(1) + .build()), + onElementPass( + GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded, + lazy(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)))) + .build(); } }; private int mCasingAmount = 0; @@ -104,7 +100,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasingAmount = 0; return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) && mCasingAmount >= getRequiredCasingCount() - && checkHatches(aBaseMetaTileEntity, aStack); + && checkHatches(aBaseMetaTileEntity, aStack); } /** diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java index bd6facceee..6fdfa53a14 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java @@ -32,7 +32,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; * @param <T> type of this */ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> - extends GT_MetaTileEntity_TooltipMultiBlockBase implements IAlignment, IConstructable { + extends GT_MetaTileEntity_TooltipMultiBlockBase implements IAlignment, IConstructable { private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT; private IAlignmentLimits mLimits = getInitialAlignmentLimits(); @@ -60,15 +60,15 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta mUpdated = false; mUpdate = 100; if (getBaseMetaTileEntity().isServerSide() - && !GregTech_API.isDummyWorld(getBaseMetaTileEntity().getWorld())) { + && !GregTech_API.isDummyWorld(getBaseMetaTileEntity().getWorld())) { StructureLibAPI.sendAlignment( - (IAlignmentProvider) base, - new NetworkRegistry.TargetPoint( - base.getWorld().provider.dimensionId, - base.getXCoord(), - base.getYCoord(), - base.getZCoord(), - 512)); + (IAlignmentProvider) base, + new NetworkRegistry.TargetPoint( + base.getWorld().provider.dimensionId, + base.getXCoord(), + base.getYCoord(), + base.getZCoord(), + 512)); } else { base.issueTextureUpdate(); } @@ -82,7 +82,7 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing()) return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) { @@ -132,22 +132,22 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setByte( - "eRotation", - (byte) mExtendedFacing.getRotation() - .getIndex()); + "eRotation", + (byte) mExtendedFacing.getRotation() + .getIndex()); aNBT.setByte( - "eFlip", - (byte) mExtendedFacing.getFlip() - .getIndex()); + "eFlip", + (byte) mExtendedFacing.getFlip() + .getIndex()); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); mExtendedFacing = ExtendedFacing.of( - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), - Rotation.byIndex(aNBT.getByte("eRotation")), - Flip.byIndex(aNBT.getByte("eFlip"))); + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), + Rotation.byIndex(aNBT.getByte("eRotation")), + Flip.byIndex(aNBT.getByte("eFlip"))); } @SuppressWarnings("unchecked") @@ -170,108 +170,108 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); return getCastedStructureDefinition().check( - this, - piece, - tTile.getWorld(), - getExtendedFacing(), - tTile.getXCoord(), - tTile.getYCoord(), - tTile.getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - !mMachine); + this, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + !mMachine); } protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset, - int verticalOffset, int depthOffset) { + int verticalOffset, int depthOffset) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); return getCastedStructureDefinition().buildOrHints( - this, - trigger, - piece, - tTile.getWorld(), - getExtendedFacing(), - tTile.getXCoord(), - tTile.getYCoord(), - tTile.getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - hintOnly); + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + hintOnly); } @Deprecated protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, - int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check) { + int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); return getCastedStructureDefinition().survivalBuild( - this, - trigger, - piece, - tTile.getWorld(), - getExtendedFacing(), - tTile.getXCoord(), - tTile.getYCoord(), - tTile.getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - elementsBudget, - source, - actor, - check); + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + source, + actor, + check); } protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, - int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check) { + int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); return getCastedStructureDefinition().survivalBuild( - this, - trigger, - piece, - tTile.getWorld(), - getExtendedFacing(), - tTile.getXCoord(), - tTile.getYCoord(), - tTile.getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - elementsBudget, - env, - check); + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + env, + check); } @Deprecated protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, - int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check, - boolean checkIfPlaced) { + int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check, + boolean checkIfPlaced) { int built = survivialBuildPiece( - piece, - trigger, - horizontalOffset, - verticalOffset, - depthOffset, - elementsBudget, - source, - actor, - check); + piece, + trigger, + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + source, + actor, + check); if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity()); return built; } protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, - int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check, boolean checkIfPlaced) { + int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check, boolean checkIfPlaced) { int built = survivialBuildPiece( - piece, - trigger, - horizontalOffset, - verticalOffset, - depthOffset, - elementsBudget, - env, - check); + piece, + trigger, + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + env, + check); if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity()); return built; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java index 99b5c6c550..b5eb13b385 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java @@ -21,7 +21,7 @@ import gregtech.api.util.GT_Utility; * Multiblock base class that allows machine to use power over int. */ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> - extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { + extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { public long lEUt; @@ -48,7 +48,7 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT @Override protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage, - boolean perfectOC) { + boolean perfectOC) { // 5% space for cable loss long zMaxInputVoltage = maxInputVoltage / 100L * 95L; long zTime = aDuration; @@ -114,7 +114,7 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); final IGregTechTileEntity tileEntity = getBaseMetaTileEntity(); @@ -140,66 +140,66 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT for (GT_MetaTileEntity_Hatch tHatch : getExoticAndNormalEnergyHatchList()) { if (isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); + .getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); + .getEUCapacity(); } } long voltage = getAverageInputVoltage(); long amps = getMaxInputAmps(); return new String[] { - /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mProgresstime / 20) - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime / 20) - + EnumChatFormatting.RESET - + " s", - /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(getActualEnergyUsage()) - + EnumChatFormatting.RESET - + " EU/t", - /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(voltage) - + EnumChatFormatting.RESET - + " EU/t(*" - + amps - + " A)" - + StatCollector.translateToLocal("GT5U.machines.tier") - + ": " - + EnumChatFormatting.YELLOW - + VN[GT_Utility.getTier(voltage)] - + EnumChatFormatting.RESET, - /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + StatCollector.translateToLocal("GT5U.multiblock.efficiency") - + ": " - + EnumChatFormatting.YELLOW - + mEfficiency / 100.0F - + EnumChatFormatting.RESET - + " %", - /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " - + EnumChatFormatting.GREEN - + mPollutionReduction - + EnumChatFormatting.RESET - + " %" }; + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(voltage) + + EnumChatFormatting.RESET + + " EU/t(*" + + amps + + " A)" + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(voltage)] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + + EnumChatFormatting.RESET + + " %", + /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + + EnumChatFormatting.GREEN + + mPollutionReduction + + EnumChatFormatting.RESET + + " %" }; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java index a8e505b806..f0ce474fd1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java @@ -28,22 +28,22 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan private byte actualTexture = 0; public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription, ITexture... aTextures) { + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription, ITexture... aTextures) { + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -62,7 +62,7 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { int texturePointer = (byte) (actualTexture & 0x7F); // just to be sure, from my testing the 8th bit cannot be // set clientside int textureIndex = texturePointer | (mTexturePage << 7); // Shift seven since one page is 128 textures! @@ -76,7 +76,7 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan if (aActive) return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); else return getTexturesInactive( - Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); + Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); } else { if (aActive) return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); else return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java index 9adc250f73..7617725d92 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java @@ -24,13 +24,13 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch public GT_MetaTileEntity_Hatch_DataAccess(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 16, - new String[] { "Data Access for Multiblocks", - "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks" }); + aID, + aName, + aNameRegional, + aTier, + 16, + new String[] { "Data Access for Multiblocks", + "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks" }); } public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -38,7 +38,7 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch } public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aTier == 4 ? 4 : 16, aDescription, aTextures); } @@ -144,15 +144,11 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { if (mTier == 4) { - getBaseMetaTileEntity().add2by2Slots( - builder, - getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity() + .add2by2Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); } else { - getBaseMetaTileEntity().add4by4Slots( - builder, - getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity() + .add4by4Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java index 84c1327a91..cc1d0ac404 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java @@ -14,16 +14,16 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 0, - new String[] { "Generating electric Energy from Multiblocks", "Puts out up to 1 Amp" }); + aID, + aName, + aNameRegional, + aTier, + 0, + new String[] { "Generating electric Energy from Multiblocks", "Puts out up to 1 Amp" }); } public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription) { + String[] aDescription) { super(aID, aName, aNameRegional, aTier, 0, aDescription); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java index dda6fb5716..2ad670fae1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java @@ -13,22 +13,22 @@ import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription) { + String[] aDescription) { super(aID, aName, aNameRegional, aTier, 0, aDescription); } public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 0, - new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" }); + aID, + aName, + aNameRegional, + aTier, + 0, + new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" }); } public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription, ITexture... aTextures) { + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } @@ -41,7 +41,7 @@ public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch { } public GT_MetaTileEntity_Hatch_Energy(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java index 4b53946e7a..408e1eca14 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java @@ -23,25 +23,25 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Input(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 3, - new String[] { "Fluid Input for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L" }); + aID, + aName, + aNameRegional, + aTier, + 3, + new String[] { "Fluid Input for Multiblocks", + "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L" }); } public GT_MetaTileEntity_Hatch_Input(int aID, int aSlot, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - aSlot, - new String[] { "Fluid Input for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L", - "Can hold " + aSlot + " types of fluid." }); + aID, + aName, + aNameRegional, + aTier, + aSlot, + new String[] { "Fluid Input for Multiblocks", + "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L", + "Can hold " + aSlot + " types of fluid." }); } public GT_MetaTileEntity_Hatch_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -53,22 +53,22 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { } public GT_MetaTileEntity_Hatch_Input(String aName, int aSlots, int aTier, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aSlots, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override @@ -158,8 +158,8 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0 - && (mRecipeMap == null || mRecipeMap.containsInput(aStack) - || mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true))); + && (mRecipeMap == null || mRecipeMap.containsInput(aStack) + || mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true))); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index a9235ba430..4bbb98c1da 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -29,7 +29,7 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch - implements IConfigurationCircuitSupport, IAddUIWidgets { + implements IConfigurationCircuitSupport, IAddUIWidgets { public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; @@ -41,21 +41,21 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch } protected GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots, - String[] description) { + String[] description) { super(id, name, nameRegional, tier, slots, description); } public GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots) { super( - id, - name, - nameRegional, - tier, - slots, - ArrayExt.of( - "Item Input for Multiblocks", - "Shift + right click with screwdriver to turn Sort mode on/off", - "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); + id, + name, + nameRegional, + tier, + slots, + ArrayExt.of( + "Item Input for Multiblocks", + "Shift + right click with screwdriver to turn Sort mode on/off", + "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); } @Deprecated @@ -70,22 +70,22 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch } public GT_MetaTileEntity_Hatch_InputBus(String aName, int aTier, int aSlots, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aSlots, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override @@ -132,8 +132,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public void initDefaultModes(NBTTagCompound aNBT) { if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( - getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy + .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) disableFilter = !tPreference.isInputBusInitialFilterEnabled(); } } @@ -175,7 +175,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch int slot = validSlots.get(slotindex); slotindex++; mInventory[slot] = stacks.get(sID) - .copy(); + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -203,8 +203,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .isGUIClickable()) - return; + .isGUIClickable()) return; if (aPlayer.isSneaking()) { if (disableSort) { disableSort = false; @@ -217,14 +216,13 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch } } GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.hatch.disableSort." + disableSort) + " " - + StatCollector.translateToLocal("GT5U.hatch.disableLimited." + disableLimited)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableSort." + disableSort) + " " + + StatCollector.translateToLocal("GT5U.hatch.disableLimited." + disableLimited)); } else { disableFilter = !disableFilter; - GT_Utility.sendChatToPlayer( - aPlayer, - StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); + GT_Utility + .sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); } } @@ -237,8 +235,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == getBaseMetaTileEntity().getFrontFacing() && aIndex != getCircuitSlot() - && (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack)) - && (disableLimited || limitedAllowPutStack(aIndex, aStack)); + && (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack)) + && (disableLimited || limitedAllowPutStack(aIndex, aStack)); } protected boolean limitedAllowPutStack(int aIndex, ItemStack aStack) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index a2d30a9d72..12a55d097c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -44,7 +44,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch private static ItemStack[] sAutoMaintenanceInputs; public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, - mSolderingTool = false, mCrowbar = false, mAuto; + mSolderingTool = false, mCrowbar = false, mAuto; public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks"); @@ -57,22 +57,22 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String aDescription, ITexture[][][] aTextures, - boolean aAuto) { + boolean aAuto) { super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures); mAuto = aAuto; } public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - boolean aAuto) { + boolean aAuto) { super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures); mAuto = aAuto; } private static ItemStack[] getAutoMaintenanceInputs() { if (sAutoMaintenanceInputs == null) sAutoMaintenanceInputs = new ItemStack[] { ItemList.Duct_Tape.get(4), - GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) }; + GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) }; return sAutoMaintenanceInputs; } @@ -96,22 +96,22 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE), - TextureFactory.builder() - .addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW) - .glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW) + .glow() + .build() }; return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE), - TextureFactory.builder() - .addIcon(OVERLAY_AUTOMAINTENANCE_GLOW) - .glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_AUTOMAINTENANCE_GLOW) + .glow() + .build() }; return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE), - TextureFactory.of(OVERLAY_DUCTTAPE) }; + TextureFactory.of(OVERLAY_DUCTTAPE) }; } @Override @@ -148,14 +148,13 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { + float aY, float aZ) { if (aBaseMetaTileEntity.isClientSide()) return true; if (aSide == aBaseMetaTileEntity.getFrontFacing()) { // only allow OC robot fake player if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile() - .getName() - .endsWith(".robot")) - return false; + .getName() + .endsWith(".robot")) return false; ItemStack tStack = aPlayer.getCurrentEquippedItem(); if (tStack != null) { if (tStack.getItem() instanceof ItemToolbox) { @@ -202,10 +201,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch amt = tStack.stackSize; boolean temp = true; for (ItemStack aStack : mInventory) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual( - GT_OreDictUnificator.get(false, aStack), - tStack, - true))) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) + || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { amt -= aStack.stackSize; if (amt < 1) { temp = false; @@ -222,10 +219,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch if (tStack != null) { amt = tStack.stackSize; for (ItemStack aStack : mInventory) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual( - GT_OreDictUnificator.get(false, aStack), - tStack, - true))) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility + .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { if (aStack.stackSize < amt) { amt -= aStack.stackSize; aStack.stackSize = 0; @@ -259,20 +254,15 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && !mWrench - && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mWrench = true; + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mWrench = true; if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) && !mScrewdriver - && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mScrewdriver = true; + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mScrewdriver = true; if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) && !mSoftHammer - && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mSoftHammer = true; + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mSoftHammer = true; if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) && !mHardHammer - && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mHardHammer = true; + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mHardHammer = true; if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) && !mCrowbar - && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mCrowbar = true; + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mCrowbar = true; if (!mSolderingTool && GT_ModHandler.useSolderingIron(aStack, aPlayer, aToolboxInventory)) mSolderingTool = true; if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) { @@ -312,12 +302,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (mAuto && GT_Mod.gregtechproxy.mAMHInteraction) { for (int i = 0; i < getSizeInventory(); i++) if (GT_Utility.areStacksEqual( - GT_OreDictUnificator.get(false, aStack), - GT_OreDictUnificator.get(false, getStackInSlot(i)))) - return i == aIndex; + GT_OreDictUnificator.get(false, aStack), + GT_OreDictUnificator.get(false, getStackInSlot(i)))) return i == aIndex; for (ItemStack tInput : getAutoMaintenanceInputs()) if (GT_Utility.areUnificationsEqual(tInput, aStack, true) - || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tInput, true)) + || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tInput, true)) return true; } return false; @@ -334,33 +323,33 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch getBaseMetaTileEntity().add2by2Slots(builder); } else { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE) - .setPos(78, 33) - .setSize(20, 20)) - .widget(new SlotWidget(BaseSlot.empty()) { - - @Override - public boolean handleDragAndDrop(ItemStack draggedStack, int button) { - return false; - } - - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - if (cursorStack == null) return; - onToolClick(cursorStack, getContext().getPlayer()); - if (cursorStack.stackSize < 1) { - getContext().getPlayer().inventory.setItemStack(null); - } - if (getContext().getPlayer() instanceof EntityPlayerMP) { - ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); - } - } - }.disableShiftInsert() + new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE) + .setPos(78, 33) + .setSize(20, 20)) + .widget(new SlotWidget(BaseSlot.empty()) { + + @Override + public boolean handleDragAndDrop(ItemStack draggedStack, int button) { + return false; + } + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + if (cursorStack == null) return; + onToolClick(cursorStack, getContext().getPlayer()); + if (cursorStack.stackSize < 1) { + getContext().getPlayer().inventory.setItemStack(null); + } + if (getContext().getPlayer() instanceof EntityPlayerMP) { + ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); + } + } + }.disableShiftInsert() .setBackground(GT_UITextures.TRANSPARENT) .setPos(79, 34)) - .widget( - new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(8, 12)); + .widget( + new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(8, 12)); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index f0f1705b1f..1fdafd7f35 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -27,14 +27,14 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( - "gt.blockmachines.hatch.muffler.desc.format", - "Outputs the Pollution (Might cause ... things)%n" + "DO NOT OBSTRUCT THE OUTPUT!%n" - + "Reduces Pollution to %d%%%n" - + "Recovers %d%% of CO2/CO/SO2"); + "gt.blockmachines.hatch.muffler.desc.format", + "Outputs the Pollution (Might cause ... things)%n" + "DO NOT OBSTRUCT THE OUTPUT!%n" + + "Reduces Pollution to %d%%%n" + + "Recovers %d%% of CO2/CO/SO2"); private final int pollutionReduction = calculatePollutionReduction(100); private final int pollutionRecover = 100 - pollutionReduction; private final String[] description = String.format(localizedDescFormat, pollutionReduction, pollutionRecover) - .split("\\R"); + .split("\\R"); private final boolean[] facings = new boolean[ForgeDirection.VALID_DIRECTIONS.length]; public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { @@ -42,7 +42,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String[] aDescription, ITexture... aTextures) { + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } @@ -55,7 +55,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); setInValidFacings(ForgeDirection.DOWN); } @@ -104,11 +104,11 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity() - .isActive()) { + .isActive()) { pollutionParticles( - this.getBaseMetaTileEntity() - .getWorld(), - ParticleFX.LARGE_SMOKE.toString()); + this.getBaseMetaTileEntity() + .getWorld(), + ParticleFX.LARGE_SMOKE.toString()); } } @@ -163,35 +163,34 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder().setIdentifier( - name) - .setWorld( - aWorld) - .setMotion( - xSpd, - ySpd, - zSpd); + WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setIdentifier(name) + .setWorld(aWorld) + .setMotion(xSpd, ySpd, zSpd); if (chk1) { - events.setPosition( + events + .setPosition( xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .run(); + .run(); } if (chk2) { - events.setPosition( + events + .setPosition( xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .run(); + .run(); } if (chk3) { - events.setPosition( + events + .setPosition( xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .run(); + .run(); } } @@ -231,6 +230,6 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public void setInValidFacings(ForgeDirection... aFacings) { Arrays.fill(facings, true); Arrays.stream(aFacings) - .forEach(face -> facings[face.ordinal()] = false); + .forEach(face -> facings[face.ordinal()] = false); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java index 1b7fedce22..48d6569f42 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java @@ -36,7 +36,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ } public GT_MetaTileEntity_Hatch_MultiInput(String aName, int aSlot, int aTier, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aSlot, aTier, aDescription, aTextures); this.mStoredFluid = new FluidStack[aSlot]; mCapacityPer = 8000 * (1 << aTier) / aSlot; @@ -172,9 +172,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public int fill(FluidStack aFluid, boolean doFill) { if (aFluid == null || aFluid.getFluid() - .getID() - <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) - return 0; + .getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; if (!hasFluid(aFluid) && getFirstEmptySlot() != -1) { int tFilled = Math.min(aFluid.amount, mCapacityPer); if (doFill) { @@ -297,42 +295,35 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { final int SLOT_NUMBER = 4; final Pos2d[] positions = new Pos2d[] { new Pos2d(70, 25), new Pos2d(88, 25), new Pos2d(70, 43), - new Pos2d(88, 43), }; + new Pos2d(88, 43), }; for (int i = 0; i < SLOT_NUMBER; i++) { final int slotId = i; builder.widget( - new FluidDisplaySlotWidget(inventoryHandler, slotId) - .setFluidAccessConstructor( - () -> constructFluidAccess(slotId)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(!isDrainableStackSeparate()) - .setActionRealClick( - FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to - // actual fluid stored in this tank - setFluid( - GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot() - .getStack()), - slotId); - } - ItemStack tStackHeld = widget.getContext() - .getPlayer().inventory.getItemStack(); - FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem( - tStackHeld, - true); - return constructFluidAccess(slotId).isMatch( - tFluidHeld, - slotId); - }) - .setUpdateFluidDisplayItem( - () -> updateFluidDisplayItem(slotId)) - .setBackground(ModularUITextures.FLUID_SLOT) - .setPos(positions[slotId])); + new FluidDisplaySlotWidget(inventoryHandler, slotId) + .setFluidAccessConstructor(() -> constructFluidAccess(slotId)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(!isDrainableStackSeparate()) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to + // actual fluid stored in this tank + setFluid( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack()), + slotId); + } + ItemStack tStackHeld = widget.getContext() + .getPlayer().inventory.getItemStack(); + FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); + return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId); + }) + .setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId)) + .setBackground(ModularUITextures.FLUID_SLOT) + .setPos(positions[slotId])); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java index b55350a97e..c3cc1edc9b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java @@ -42,16 +42,16 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier) { super( - aID, - aName, - aNameRegional, - aTier, - 4, - new String[] { "Fluid Output for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L", - "Right click with screwdriver to restrict output", - "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid", - "Restricted Output Hatches are given priority for Multiblock Fluid output" }); + aID, + aName, + aNameRegional, + aTier, + 4, + new String[] { "Fluid Output for Multiblocks", + "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L", + "Right click with screwdriver to restrict output", + "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid", + "Restricted Output Hatches are given priority for Multiblock Fluid output" }); } public GT_MetaTileEntity_Hatch_Output(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -63,29 +63,27 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl } public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, - int inventorySize) { + int inventorySize) { super(aID, aName, aNameRegional, aTier, inventorySize, aDescription); } public GT_MetaTileEntity_Hatch_Output(String name, int tier, int slots, String[] description, - ITexture[][][] textures) { + ITexture[][][] textures) { super(name, tier, slots, description, textures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), - TextureFactory.of(FLUID_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), - TextureFactory.of(FLUID_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override @@ -123,26 +121,24 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && mFluid != null) { - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide( - aBaseMetaTileEntity.getFrontFacing()); + IFluidHandler tTileEntity = aBaseMetaTileEntity + .getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { FluidStack tDrained = aBaseMetaTileEntity.drain( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), - Math.max(1, mFluid.amount), - false); + ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), + Math.max(1, mFluid.amount), + false); if (tDrained != null) { - int tFilledAmount = tTileEntity.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - tDrained, - false); + int tFilledAmount = tTileEntity + .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); if (tFilledAmount > 0) { tTileEntity.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - aBaseMetaTileEntity.drain( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), - tFilledAmount, - true), - true); + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.drain( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), + tFilledAmount, + true), + true); } } } @@ -166,7 +162,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName; if (GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) != null) { lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) - .getName(); + .getName(); } } @@ -243,8 +239,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .isGUIClickable()) - return; + .isGUIClickable()) return; if (aPlayer.isSneaking()) { mMode = (byte) ((mMode + 9) % 10); } else { @@ -289,49 +284,48 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl if (mFluid == null) { this.setLockedFluidName(null); inBrackets = GT_Utility.trans( - "115.3", - "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); + "115.3", + "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { this.setLockedFluidName( - this.getDrainableStack() - .getFluid() - .getName()); + this.getDrainableStack() + .getFluid() + .getName()); inBrackets = this.getDrainableStack() - .getLocalizedName(); + .getLocalizedName(); } GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - "%s (%s)", - GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), - inBrackets)); + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), + inBrackets)); } case 9 -> { playerThatLockedfluid = new WeakReference<>(aPlayer); if (mFluid == null) { this.setLockedFluidName(null); inBrackets = GT_Utility.trans( - "115.3", - "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); + "115.3", + "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { this.setLockedFluidName( - this.getDrainableStack() - .getFluid() - .getName()); + this.getDrainableStack() + .getFluid() + .getName()); inBrackets = this.getDrainableStack() - .getLocalizedName(); + .getLocalizedName(); } GT_Utility.sendChatToPlayer( - aPlayer, - String.format("%s (%s)", GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), inBrackets)); + aPlayer, + String.format("%s (%s)", GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), inBrackets)); } } } private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) { if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) - .isGUIClickable()) - return false; + .isGUIClickable()) return false; if (!isFluidLocked()) return false; final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem == null) return false; @@ -340,32 +334,32 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem); if (tFluid != null) { if (getLockedFluidName() != null && !getLockedFluidName().equals( - tFluid.getFluid() - .getName())) { + tFluid.getFluid() + .getName())) { GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - "%s %s", - GT_Utility.trans( - "151.3", - "Hatch is locked to a different fluid. To change the locking, empty it and made it locked to the next fluid with a screwdriver. Currently locked to"), - StatCollector.translateToLocal(getLockedFluidName()))); + aPlayer, + String.format( + "%s %s", + GT_Utility.trans( + "151.3", + "Hatch is locked to a different fluid. To change the locking, empty it and made it locked to the next fluid with a screwdriver. Currently locked to"), + StatCollector.translateToLocal(getLockedFluidName()))); } else { setLockedFluidName( - tFluid.getFluid() - .getName()); + tFluid.getFluid() + .getName()); if (mMode == 8) GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - "%s (%s)", - GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), - tFluid.getLocalizedName())); + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), + tFluid.getLocalizedName())); else GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - "%s (%s)", - GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), - tFluid.getLocalizedName())); + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), + tFluid.getLocalizedName())); } return true; } @@ -378,7 +372,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { + float aY, float aZ) { if (tryToLockHatch(aPlayer, aSide)) return true; return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); } @@ -447,15 +441,13 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl protected void onEmptyingContainerWhenEmpty() { if (this.lockedFluidName == null && this.mFluid != null && isFluidLocked()) { this.setLockedFluidName( - this.mFluid.getFluid() - .getName()); + this.mFluid.getFluid() + .getName()); final EntityPlayer player; if (playerThatLockedfluid == null || (player = playerThatLockedfluid.get()) == null) return; GT_Utility.sendChatToPlayer( - player, - String.format( - GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), - mFluid.getLocalizedName())); + player, + String.format(GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), mFluid.getLocalizedName())); playerThatLockedfluid = null; } } @@ -468,20 +460,20 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override public String[] getInfoData() { return new String[] { EnumChatFormatting.BLUE + "Output Hatch" + EnumChatFormatting.RESET, "Stored Fluid:", - EnumChatFormatting.GOLD + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName()) - + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount) - + " L" - + EnumChatFormatting.RESET - + " " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(getCapacity()) - + " L" - + EnumChatFormatting.RESET, - (!isFluidLocked() || lockedFluidName == null) ? "Not Locked" - : ("Locked to " + StatCollector.translateToLocal( - FluidRegistry.getFluidStack(lockedFluidName, 1) - .getUnlocalizedName())) }; + EnumChatFormatting.GOLD + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName()) + + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount) + + " L" + + EnumChatFormatting.RESET + + " " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getCapacity()) + + " L" + + EnumChatFormatting.RESET, + (!isFluidLocked() || lockedFluidName == null) ? "Not Locked" + : ("Locked to " + StatCollector.translateToLocal( + FluidRegistry.getFluidStack(lockedFluidName, 1) + .getUnlocalizedName())) }; } @Override @@ -493,51 +485,44 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(98, 16) - .setSize(71, 45)) - .widget( - new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this) - .setActionRealClick( - FluidDisplaySlotWidget.Action.LOCK) - .setActionDragAndDrop( - FluidDisplaySlotWidget.Action.LOCK) - .setBeforeClick( - (clickData, - widget) -> { - if (NetworkUtils.isClient()) { - // propagate - // display - // item - // content to - // actual - // fluid - // stored in - // this tank - setDrainableStack( - GT_Utility.getFluidFromDisplayStack( - mInventory[getStackDisplaySlot()])); - } - return true; - }) - .setBackground( - GT_UITextures.TRANSPARENT) - .setPos(149, 41)) - .widget( - new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(101, 20)) - .widget(TextWidget.dynamicString(() -> { - final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; - return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); - }) - .setSynced(false) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setTextAlignment(Alignment.CenterLeft) - .setMaxWidth(65) - .setPos(101, 30)) - // #updateFluidDisplayItem invalidates locked fluid slot - // if lockedFluidName == null or mMode is incorrect - .widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val)) - .widget(new FakeSyncWidget.ByteSyncer(() -> mMode, val -> mMode = val)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(98, 16) + .setSize(71, 45)) + .widget( + new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this) + .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK) + .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK) + .setBeforeClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate + // display + // item + // content to + // actual + // fluid + // stored in + // this tank + setDrainableStack(GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()])); + } + return true; + }) + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(149, 41)) + .widget( + new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(101, 20)) + .widget(TextWidget.dynamicString(() -> { + final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; + return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setTextAlignment(Alignment.CenterLeft) + .setMaxWidth(65) + .setPos(101, 30)) + // #updateFluidDisplayItem invalidates locked fluid slot + // if lockedFluidName == null or mMode is incorrect + .widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val)) + .widget(new FakeSyncWidget.ByteSyncer(() -> mMode, val -> mMode = val)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java index 633d82566c..f04840d7d3 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java @@ -29,23 +29,23 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i public GT_MetaTileEntity_Hatch_OutputBus(int id, String name, String nameRegional, int tier, int slots) { super( - id, - name, - nameRegional, - tier, - slots, - ArrayExt.of( - "Item Output for Multiblocks", - "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); + id, + name, + nameRegional, + tier, + slots, + ArrayExt.of( + "Item Output for Multiblocks", + "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); } public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription) { + String[] aDescription) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), aDescription); } public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription, int inventorySize) { + String[] aDescription, int inventorySize) { super(aID, aName, aNameRegional, aTier, inventorySize, aDescription); } @@ -61,22 +61,22 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i } public GT_MetaTileEntity_Hatch_OutputBus(String name, int tier, int slots, String[] description, - ITexture[][][] textures) { + ITexture[][][] textures) { super(name, tier, slots, description, textures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch - ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } - : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override @@ -131,7 +131,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i } else { int tRealStackLimit = Math.min(getInventoryStackLimit(), tSlot.getMaxStackSize()); if (tSlot.stackSize < tRealStackLimit && tSlot.isItemEqual(aStack) - && ItemStack.areItemStackTagsEqual(tSlot, aStack)) { + && ItemStack.areItemStackTagsEqual(tSlot, aStack)) { if (aStack.stackSize + tSlot.stackSize <= tRealStackLimit) { mInventory[i].stackSize += aStack.stackSize; return true; @@ -160,21 +160,21 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick & 0x7) == 0) { - final IInventory tTileEntity = aBaseMetaTileEntity.getIInventoryAtSide( - aBaseMetaTileEntity.getFrontFacing()); + final IInventory tTileEntity = aBaseMetaTileEntity + .getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { moveMultipleItemStacks( - aBaseMetaTileEntity, - tTileEntity, - aBaseMetaTileEntity.getFrontFacing(), - aBaseMetaTileEntity.getBackFacing(), - null, - false, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1, - mInventory.length); + aBaseMetaTileEntity, + tTileEntity, + aBaseMetaTileEntity.getFrontFacing(), + aBaseMetaTileEntity.getBackFacing(), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + mInventory.length); for (int i = 0; i < mInventory.length; i++) if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; // GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index e26029b629..0f5f5dcc85 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -62,14 +62,14 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity - implements IAddGregtechLogo, IAddUIWidgets, IBindPlayerInventoryUI { + implements IAddGregtechLogo, IAddUIWidgets, IBindPlayerInventoryUI { public static boolean disableMaintenance; public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, - mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; + mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; public boolean mStructureChanged = false; public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, - mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; + mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; public volatile boolean mUpdated = false; public int mUpdate = 0; public ItemStack[] mOutputItems = null; @@ -104,43 +104,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 2); - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.disableMaintenance", - false); - this.damageFactorLow = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.damageFactorLow", - 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.damageFactorHigh", - 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + this.damageFactorLow = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); + this.damageFactorHigh = (float) GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); this.mNEI = ""; } public GT_MetaTileEntity_MultiBlockBase(String aName) { super(aName, 2); - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.disableMaintenance", - false); - this.damageFactorLow = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.damageFactorLow", - 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MultiBlockMachines.damageFactorHigh", - 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + this.damageFactorLow = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); + this.damageFactorHigh = (float) GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); } public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) { return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity() - .getMetaTileEntity() - == aMetaTileEntity - && !aMetaTileEntity.getBaseMetaTileEntity() - .isDead(); + .getMetaTileEntity() == aMetaTileEntity + && !aMetaTileEntity.getBaseMetaTileEntity() + .isDead(); } @Override @@ -164,8 +151,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mLockedToSingleRecipe = !mLockedToSingleRecipe; if (mLockedToSingleRecipe) { GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe.")); + aPlayer, + GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe.")); } else { GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("220", "Single recipe locking disabled.")); mSingleRecipeCheck = null; @@ -377,13 +364,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } aBaseMetaTileEntity.setErrorDisplayID( - (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) - | (mScrewdriver ? 0 : 2) - | (mSoftHammer ? 0 : 4) - | (mHardHammer ? 0 : 8) - | (mSolderingTool ? 0 : 16) - | (mCrowbar ? 0 : 32) - | (mMachine ? 0 : 64)); + (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) + | (mScrewdriver ? 0 : 2) + | (mSoftHammer ? 0 : 4) + | (mHardHammer ? 0 : 8) + | (mSolderingTool ? 0 : 16) + | (mCrowbar ? 0 : 32) + | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; setMufflers(active); @@ -406,7 +393,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { if (isValidMetaTileEntity(tHatch)) { if (tHatch.mAuto - && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) + && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) tHatch.autoMaintainance(); if (tHatch.mWrench) mWrench = true; if (tHatch.mScrewdriver) mScrewdriver = true; @@ -446,9 +433,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) { try { GT_Mod.achievements.issueAchivementHatch( - aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), - tStack); + aBaseMetaTileEntity.getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + tStack); } catch (Exception ignored) {} addOutput(tStack); } @@ -456,10 +443,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity addFluidOutputs(mOutputFluids); } mEfficiency = Math.max( - 0, - Math.min( - mEfficiency + mEfficiencyIncrease, - getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + 0, + Math.min( + mEfficiency + mEfficiencyIncrease, + getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); mOutputItems = null; mProgresstime = 0; mMaxProgresstime = 0; @@ -471,9 +458,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (mOutputFluids.length > 1) { try { GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), - "oilplant"); + aBaseMetaTileEntity.getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + "oilplant"); } catch (Exception ignored) {} } } @@ -481,7 +468,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } else { if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() - || aBaseMetaTileEntity.hasInventoryBeenModified()) { + || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe()) { @@ -517,13 +504,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (getProcessStartSound() != null) GT_Utility.doSoundAtClient(getProcessStartSound(), getTimeBetweenProcessSounds(), 1.0F, aX, aY, aZ); } - case INTERRUPT_SOUND_INDEX -> GT_Utility.doSoundAtClient( - SoundResource.IC2_MACHINES_INTERRUPT_ONE, - 100, - 1.0F, - aX, - aY, - aZ); + case INTERRUPT_SOUND_INDEX -> GT_Utility + .doSoundAtClient(SoundResource.IC2_MACHINES_INTERRUPT_ONE, 100, 1.0F, aX, aY, aZ); } } @@ -542,8 +524,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (activitySoundLoop == null) { activitySoundLoop = new GT_SoundLoop(activitySound, getBaseMetaTileEntity(), false, true); Minecraft.getMinecraft() - .getSoundHandler() - .playSound(activitySoundLoop); + .getSoundHandler() + .playSound(activitySoundLoop); } } else { if (activitySoundLoop != null) { @@ -658,10 +640,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public int getRepairStatus() { return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) - + (mSoftHammer ? 1 : 0) - + (mHardHammer ? 1 : 0) - + (mSolderingTool ? 1 : 0) - + (mCrowbar ? 1 : 0); + + (mSoftHammer ? 1 : 0) + + (mHardHammer ? 1 : 0) + + (mSolderingTool ? 1 : 0) + + (mCrowbar ? 1 : 0); } public int getIdealStatus() { @@ -691,15 +673,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 - && !mInventory[1].getUnlocalizedName() - .startsWith("gt.blockmachines.basicmachine.")) { + && !mInventory[1].getUnlocalizedName() + .startsWith("gt.blockmachines.basicmachine.")) { if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { NBTTagCompound tNBT = mInventory[1].getTagCompound(); ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage( - mInventory[1], - (long) getDamageToComponent(mInventory[1]) * (long) Math.min( - mEUt / this.damageFactorLow, - Math.pow(mEUt, this.damageFactorHigh))); + mInventory[1], + (long) getDamageToComponent(mInventory[1]) + * (long) Math.min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh))); if (mInventory[1].stackSize == 0) mInventory[1] = null; } } @@ -710,34 +691,34 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public void explodeMultiblock() { GT_Log.exp.println( - "MultiBlockExplosion at: " + this.getBaseMetaTileEntity() - .getXCoord() - + " | " - + this.getBaseMetaTileEntity() - .getYCoord() - + " | " - + this.getBaseMetaTileEntity() - .getZCoord() - + " DIMID: " - + this.getBaseMetaTileEntity() - .getWorld().provider.dimensionId - + "."); + "MultiBlockExplosion at: " + this.getBaseMetaTileEntity() + .getXCoord() + + " | " + + this.getBaseMetaTileEntity() + .getYCoord() + + " | " + + this.getBaseMetaTileEntity() + .getZCoord() + + " DIMID: " + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + + "."); GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion); mInventory[1] = null; Iterable<MetaTileEntity> allHatches = Iterables.concat( - mInputBusses, - mOutputBusses, - mInputHatches, - mOutputHatches, - mDynamoHatches, - mMufflerHatches, - mEnergyHatches, - mMaintenanceHatches); + mInputBusses, + mOutputBusses, + mInputHatches, + mOutputHatches, + mDynamoHatches, + mMufflerHatches, + mEnergyHatches, + mMaintenanceHatches); for (MetaTileEntity tTileEntity : allHatches) { if (tTileEntity != null && tTileEntity.getBaseMetaTileEntity() != null) { tTileEntity.getBaseMetaTileEntity() - .doExplosion(V[8]); + .doExplosion(V[8]); } } getBaseMetaTileEntity().doExplosion(V[8]); @@ -796,12 +777,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); for (int i = 0; i < ampsOnCurrentHatch; i++) { aDynamo.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(aVoltage, false); + .increaseStoredEnergyUnits(aVoltage, false); } injected += aVoltage * ampsOnCurrentHatch; if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { aDynamo.getBaseMetaTileEntity() - .increaseStoredEnergyUnits(aRemainder, false); + .increaseStoredEnergyUnits(aRemainder, false); injected += aRemainder; } } @@ -813,7 +794,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity() - .getInputVoltage(); + .getInputVoltage(); return rVoltage; } @@ -827,7 +808,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor */ protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage, - boolean perfectOC) { + boolean perfectOC) { byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage)); if (mTier == 0) { // Long time calculation @@ -896,14 +877,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (aEU <= 0) return true; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { if (tHatch.getBaseMetaTileEntity() - .decreaseStoredEnergyUnits(aEU, false)) - return true; + .decreaseStoredEnergyUnits(aEU, false)) return true; } return false; } protected static boolean dumpFluid(List<GT_MetaTileEntity_Hatch_Output> aOutputHatches, FluidStack copiedFluidStack, - boolean restrictiveHatchesOnly) { + boolean restrictiveHatchesOnly) { for (GT_MetaTileEntity_Hatch_Output tHatch : aOutputHatches) { if (!isValidMetaTileEntity(tHatch) || (restrictiveHatchesOnly && tHatch.mMode == 0)) { continue; @@ -967,8 +947,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { if (!outputSuccess && isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { if (tHatch.getBaseMetaTileEntity() - .addStackToSlot(1, single)) - outputSuccess = true; + .addStackToSlot(1, single)) outputSuccess = true; } } } @@ -983,14 +962,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { if (GT_Utility.areStacksEqual( - aStack, - tHatch.getBaseMetaTileEntity() - .getStackInSlot(0))) { + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(0))) { if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(0).stackSize - >= aStack.stackSize) { + .getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity() - .decrStackSize(0, aStack.stackSize); + .decrStackSize(0, aStack.stackSize); return true; } } @@ -1000,17 +978,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - - 1; i >= 0; i--) { + .getSizeInventory() - 1; i >= 0; i--) { if (GT_Utility.areStacksEqual( - aStack, - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i))) { + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i))) { if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(i).stackSize - >= aStack.stackSize) { + .getStackInSlot(i).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity() - .decrStackSize(i, aStack.stackSize); + .decrStackSize(i, aStack.stackSize); return true; } } @@ -1030,11 +1006,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - - 1; i >= 0; i--) { + .getSizeInventory() - 1; i >= 0; i--) { rList.add( - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i)); + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } @@ -1070,20 +1045,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity() - .getSizeInventory() - - 1; i >= 0; i--) { + .getSizeInventory() - 1; i >= 0; i--) { if (tHatch.getBaseMetaTileEntity() - .getStackInSlot(i) - != null) + .getStackInSlot(i) != null) rList.add( - tHatch.getBaseMetaTileEntity() - .getStackInSlot(i)); + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName() - .startsWith("gt.integrated_circuit")) - rList.add(getStackInSlot(1)); + .startsWith("gt.integrated_circuit")) rList.add(getStackInSlot(1)); return rList; } @@ -1109,7 +1081,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch(IGregTechTileEntity aTileEntity, - int aBaseCasingIndex, Class<T> clazz) { + int aBaseCasingIndex, Class<T> clazz) { if (aTileEntity == null) return null; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (!clazz.isInstance(aMetaTileEntity)) return null; @@ -1177,7 +1149,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch hatch - && GT_ExoticEnergyInputHelper.isExoticEnergyInput(aMetaTileEntity)) { + && GT_ExoticEnergyInputHelper.isExoticEnergyInput(aMetaTileEntity)) { hatch.updateTexture(aBaseCasingIndex); return mExoticEnergyHatches.add(hatch); } @@ -1208,12 +1180,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { return addInputBusToMachineList(aTileEntity, aBaseCasingIndex) - || addInputHatchToMachineList(aTileEntity, aBaseCasingIndex); + || addInputHatchToMachineList(aTileEntity, aBaseCasingIndex); } public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { return addOutputBusToMachineList(aTileEntity, aBaseCasingIndex) - || addOutputHatchToMachineList(aTileEntity, aBaseCasingIndex); + || addOutputHatchToMachineList(aTileEntity, aBaseCasingIndex); } public boolean addInputBusToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -1276,62 +1248,62 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity() - .getStoredEU(); + .getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity() - .getEUCapacity(); + .getEUCapacity(); } } return new String[] { - /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mProgresstime / 20) - + EnumChatFormatting.RESET - + " s / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxProgresstime / 20) - + EnumChatFormatting.RESET - + " s", - /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " - + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(storedEnergy) - + EnumChatFormatting.RESET - + " EU / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(maxEnergy) - + EnumChatFormatting.RESET - + " EU", - /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " - + EnumChatFormatting.RED - + GT_Utility.formatNumbers(getActualEnergyUsage()) - + EnumChatFormatting.RESET - + " EU/t", - /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(getMaxInputVoltage()) - + EnumChatFormatting.RESET - + " EU/t(*2A) " - + StatCollector.translateToLocal("GT5U.machines.tier") - + ": " - + EnumChatFormatting.YELLOW - + VN[GT_Utility.getTier(getMaxInputVoltage())] - + EnumChatFormatting.RESET, - /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " - + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) - + EnumChatFormatting.RESET - + " " - + StatCollector.translateToLocal("GT5U.multiblock.efficiency") - + ": " - + EnumChatFormatting.YELLOW - + mEfficiency / 100.0F - + EnumChatFormatting.RESET - + " %", - /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " - + EnumChatFormatting.GREEN - + mPollutionReduction - + EnumChatFormatting.RESET - + " %" }; + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + + EnumChatFormatting.RESET + + " %", + /* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + + EnumChatFormatting.GREEN + + mPollutionReduction + + EnumChatFormatting.RESET + + " %" }; } @Override @@ -1392,44 +1364,44 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity @Override public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); if (tag.getBoolean("incompleteStructure")) { currentTip.add(RED + "** INCOMPLETE STRUCTURE **" + RESET); } currentTip.add( - (tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET - + " Efficiency: " - + tag.getFloat("efficiency") - + "%"); + (tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET + + " Efficiency: " + + tag.getFloat("efficiency") + + "%"); boolean isActive = tag.getBoolean("isActive"); if (isActive) { long actualEnergyUsage = tag.getLong("energyUsage"); if (actualEnergyUsage > 0) { currentTip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.use", - GT_Utility.formatNumbers(actualEnergyUsage), - GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.use", + GT_Utility.formatNumbers(actualEnergyUsage), + GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage))); } else if (actualEnergyUsage < 0) { currentTip.add( - StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.produce", - GT_Utility.formatNumbers(-actualEnergyUsage), - GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage))); + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.produce", + GT_Utility.formatNumbers(-actualEnergyUsage), + GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage))); } } currentTip.add( - GT_Waila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress"))); + GT_Waila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress"))); super.getWailaBody(itemStack, currentTip, accessor, config); } @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setBoolean("hasProblems", (getIdealStatus() - getRepairStatus()) > 0); @@ -1567,38 +1539,35 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(4, 4) - .setSize(190, 85)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(190, 85)); final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1); builder.widget( - inventorySlot.setPos(173, 167) - .setBackground(GT_UITextures.SLOT_DARK_GRAY)); + inventorySlot.setPos(173, 167) + .setBackground(GT_UITextures.SLOT_DARK_GRAY)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); drawTexts(screenElements, inventorySlot); builder.widget(screenElements); builder.widget(createPowerSwitchButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> getBaseMetaTileEntity().isAllowedToWork(), val -> { - if (val) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); - })); + .widget(new FakeSyncWidget.BooleanSyncer(() -> getBaseMetaTileEntity().isAllowedToWork(), val -> { + if (val) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); + })); builder.widget(createVoidExcessButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)); builder.widget(createInputSeparationButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> inputSeparation, val -> inputSeparation = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> inputSeparation, val -> inputSeparation = val)); builder.widget(createBatchModeButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)); builder.widget(createLockToSingleRecipeButton()) - .widget( - new FakeSyncWidget.BooleanSyncer( - () -> mLockedToSingleRecipe, - val -> mLockedToSingleRecipe = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> mLockedToSingleRecipe, val -> mLockedToSingleRecipe = val)); } @Override @@ -1606,119 +1575,102 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { screenElements.setSynced(false) - .setSpace(0) - .setPos(10, 7); + .setSpace(0) + .setPos(10, 7); - screenElements.widget( + screenElements + .widget( new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); - screenElements.widget( + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); - screenElements.widget( + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); - screenElements.widget( + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); - screenElements.widget( + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); - screenElements.widget( + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor( - COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); - screenElements.widget( + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + screenElements + .widget( new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); screenElements.widget( - new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) - != 0)); + new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0)); screenElements.widget( - new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> (getBaseMetaTileEntity().getErrorDisplayID() - & 256) != 0)); + new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0)); screenElements.widget( - new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && !getBaseMetaTileEntity().isActive())) - .widget( - new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID(val))) - .widget( - new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))); + new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive())) + .widget( + new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val))) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))); screenElements.widget( - new TextWidget( - GT_Utility.trans("140", "to (re-)start the Machine")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && !getBaseMetaTileEntity().isActive())); + new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive())); screenElements.widget( - new TextWidget(GT_Utility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && !getBaseMetaTileEntity().isActive())); + new TextWidget(GT_Utility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && !getBaseMetaTileEntity().isActive())); screenElements.widget( - new TextWidget(GT_Utility.trans("142", "Running perfectly.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && getBaseMetaTileEntity().isActive())); + new TextWidget(GT_Utility.trans("142", "Running perfectly.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 && getBaseMetaTileEntity().isActive())); screenElements.widget( - new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && this instanceof GT_MetaTileEntity_DrillerBase) { - final ItemStack tItem = inventorySlot.getMcSlot() - .getStack(); - return tItem == null - || !GT_Utility.areStacksEqual( - tItem, - GT_ModHandler.getIC2Item( - "miningPipe", - 1L)); - } - return false; - })); + new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() == 0 + && this instanceof GT_MetaTileEntity_DrillerBase) { + final ItemStack tItem = inventorySlot.getMcSlot() + .getStack(); + return tItem == null + || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L)); + } + return false; + })); screenElements.widget( - new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() - == 0 - && this instanceof GT_MetaTileEntity_LargeTurbine) { - final ItemStack tItem = inventorySlot.getMcSlot() - .getStack(); - return tItem == null || !(tItem - .getItem() - == GT_MetaGenerated_Tool_01.INSTANCE - && tItem.getItemDamage() - >= 170 - && tItem.getItemDamage() - <= 177); - } - return false; - })); + new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() == 0 + && this instanceof GT_MetaTileEntity_LargeTurbine) { + final ItemStack tItem = inventorySlot.getMcSlot() + .getStack(); + return tItem == null + || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 + && tItem.getItemDamage() <= 177); + } + return false; + })); } protected ButtonWidget createPowerSwitchButton() { @@ -1729,24 +1681,23 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity getBaseMetaTileEntity().enableWorking(); } }) - .setPlayClickSoundResource( - () -> getBaseMetaTileEntity().isAllowedToWork() - ? SoundResource.GUI_BUTTON_UP.resourceLocation - : SoundResource.GUI_BUTTON_DOWN.resourceLocation) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (getBaseMetaTileEntity().isAllowedToWork()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF); - } - return ret.toArray(new IDrawable[0]); - }) - .setPos(174, 148) - .setSize(16, 16); + .setPlayClickSoundResource( + () -> getBaseMetaTileEntity().isAllowedToWork() ? SoundResource.GUI_BUTTON_UP.resourceLocation + : SoundResource.GUI_BUTTON_DOWN.resourceLocation) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (getBaseMetaTileEntity().isAllowedToWork()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF); + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(174, 148) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1756,29 +1707,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity voidExcess = !voidExcess; } }) - .setPlayClickSound(true) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isVoidExcessButtonEnabled()) { - if (isVoidExcessEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF); - } - } else { - if (isVoidExcessEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }) - .setPos(8, 91) - .setSize(16, 16); + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isVoidExcessButtonEnabled()) { + if (isVoidExcessEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF); + } + } else { + if (isVoidExcessEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(8, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.void_excess")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1788,31 +1739,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity inputSeparation = !inputSeparation; } }) - .setPlayClickSound(true) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isInputSeparationButtonEnabled()) { - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); - } - } else { - if (isInputSeparationEnabled()) { - ret.add( - GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); - } else { - ret.add( - GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }) - .setPos(26, 91) - .setSize(16, 16); + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isInputSeparationButtonEnabled()) { + if (isInputSeparationEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); + } + } else { + if (isInputSeparationEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(26, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1822,29 +1771,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity batchMode = !batchMode; } }) - .setPlayClickSound(true) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isBatchModeButtonEnabled()) { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); - } - } else { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }) - .setPos(44, 91) - .setSize(16, 16); + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isBatchModeButtonEnabled()) { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); + } + } else { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(44, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1854,29 +1803,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mLockedToSingleRecipe = !mLockedToSingleRecipe; } }) - .setPlayClickSound(true) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsSingleRecipeLocking()) { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); - } - } else { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }) - .setPos(62, 91) - .setSize(16, 16); + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (supportsSingleRecipeLocking()) { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); + } + } else { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(62, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.lock_recipe")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java index 890733e363..9672c87f40 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java @@ -29,18 +29,18 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ public boolean bInvertFilter = false; public GT_MetaTileEntity_SpecialFilter(int aID, String aName, String aNameRegional, int aTier, - String[] aDescription) { + String[] aDescription) { // 9 buffer slot, 1 representation slot, 1 holo slot. last seems not needed... super(aID, aName, aNameRegional, aTier, 11, aDescription); } public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -68,8 +68,8 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) - && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) - && (this.isStackAllowed(aStack) != this.bInvertFilter); + && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) + && (this.isStackAllowed(aStack) != this.bInvertFilter); } protected abstract boolean isStackAllowed(ItemStack aStack); @@ -91,79 +91,77 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ bInvertFilter = !bInvertFilter; if (bInvertFilter) { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("124", "Invert Filter")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("124", "Invert Filter")); } else { GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("125", "Don't invert Filter")); + widget.getContext() + .getPlayer(), + GT_Utility.trans("125", "Don't invert Filter")); } }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER) - .setPos(61, 62) - .setSize(18, 18)) - .widget(new ButtonWidget().setOnClick((clickData, widget) -> { - bNBTAllowed = !bNBTAllowed; - if (bNBTAllowed) { - GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("126", "Ignore NBT")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext() - .getPlayer(), - GT_Utility.trans("127", "NBT has to match")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT) - .setPos(79, 62) - .setSize(18, 18)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) - .setPos(6, 19) - .setSize(27, 24)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) - .setPos(53, 19) - .setSize(42, 24)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) - .setPos(152, 19) - .setSize(19, 24)) - .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { - - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - clickTypeIcon(clickData.mouseButton != 0, cursorStack); - } - - @Override - public void buildTooltip(List<Text> tooltip) { - if (getEmptySlotTooltip() != null) { - tooltip.addAll(getEmptySlotTooltip()); - } - super.buildTooltip(tooltip); - } - - @Override - public List<String> getExtraTooltip() { - if (getItemExtraTooltip() != null) { - return getItemExtraTooltip(); - } - return Collections.emptyList(); - } - }.disableShiftInsert() + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER) + .setPos(61, 62) + .setSize(18, 18)) + .widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bNBTAllowed = !bNBTAllowed; + if (bNBTAllowed) { + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("126", "Ignore NBT")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("127", "NBT has to match")); + } + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT) + .setPos(79, 62) + .setSize(18, 18)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) + .setPos(6, 19) + .setSize(27, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) + .setPos(53, 19) + .setSize(42, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) + .setPos(152, 19) + .setSize(19, 24)) + .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + clickTypeIcon(clickData.mouseButton != 0, cursorStack); + } + + @Override + public void buildTooltip(List<Text> tooltip) { + if (getEmptySlotTooltip() != null) { + tooltip.addAll(getEmptySlotTooltip()); + } + super.buildTooltip(tooltip); + } + + @Override + public List<String> getExtraTooltip() { + if (getItemExtraTooltip() != null) { + return getItemExtraTooltip(); + } + return Collections.emptyList(); + } + }.disableShiftInsert() .setPos(34, 22) .setBackground(GT_UITextures.BUTTON_STANDARD)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 3) - .endAtSlot(8) - .build() - .setPos(97, 4)); + .widget( + SlotGroup.ofItemHandler(inventoryHandler, 3) + .endAtSlot(8) + .build() + .setPos(97, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java index 3424baca8b..765cd047ad 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java @@ -35,7 +35,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit public final ITexture[][][] mTextures; public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, - int aInvSlotCount, String aDescription, ITexture... aTextures) { + int aInvSlotCount, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 14)); mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; @@ -46,7 +46,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit } public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, - int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + int aInvSlotCount, String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 15)); mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -63,7 +63,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit } public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; @@ -72,7 +72,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit } public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -124,15 +124,9 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit protected SlotWidget createChargerSlot(int x, int y, String tooltipKey, Object[] tooltipArgs) { return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex()).disableShiftInsert() - .setGTTooltip( - () -> mTooltipCache.getData( - tooltipKey, - tooltipArgs)) - .setTooltipShowUpDelay( - TOOLTIP_DELAY) - .setBackground( - getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_CHARGER) - .setPos(x, y); + .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER) + .setPos(x, y); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java index a4c42dd14d..c12c7c1442 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java @@ -12,10 +12,10 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; * A multiblock with tooltip {@link GT_Multiblock_Tooltip_Builder} */ public abstract class GT_MetaTileEntity_TooltipMultiBlockBase extends GT_MetaTileEntity_MultiBlockBase - implements ISecondaryDescribable { + implements ISecondaryDescribable { private static final AtomicReferenceArray<GT_Multiblock_Tooltip_Builder> tooltips = new AtomicReferenceArray<>( - GregTech_API.METATILEENTITIES.length); + GregTech_API.METATILEENTITIES.length); public GT_MetaTileEntity_TooltipMultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index c7b9c66b70..ae70607416 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java @@ -58,38 +58,38 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi ITexture[][][] rTextures = new ITexture[12][17][]; for (byte i = -1; i < 16; i++) { rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] }; rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] }; rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] }; } return rTextures; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) - + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1]; + + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1]; } @Override @@ -125,7 +125,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public boolean isInputFacing(byte aSide) { return getBaseMetaTileEntity().isAllowedToWork() ? aSide == getBaseMetaTileEntity().getFrontFacing() - : aSide != getBaseMetaTileEntity().getFrontFacing(); + : aSide != getBaseMetaTileEntity().getFrontFacing(); } @Override @@ -175,51 +175,46 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++) if (aBaseMetaTileEntity.inputEnergyFrom(i)) { TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); - if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy( - ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), - 1, - true) == 1) { + if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity) + .extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), 1, true) == 1) { long tEU = ((IEnergyProvider) tTileEntity).extractEnergy( - ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), - GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), - false); + ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), + GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), + false); tEU = tEU * GregTech_API.mRFtoEU / 100; aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); } else if (tTileEntity instanceof IEnergyStorage - && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { - long tEU = ((IEnergyStorage) tTileEntity).extractEnergy( - GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), - false); - tEU = tEU * GregTech_API.mRFtoEU / 100; - aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); - } else - if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer - && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { - int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); - int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU); - long tEU = 0; - if (tTileEntity instanceof TileCapBank) { - ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); - if (network != null && network.getEnergyStoredL() > 0) { - tEU = Math.min( - (Math.min( - Math.min(network.getEnergyStoredL(), storedRF - extractRF), - network.getMaxOutput())) * (long) GregTech_API.mRFtoEU - / 100L, - maxEUInput()); - network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU))); - } + && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { + long tEU = ((IEnergyStorage) tTileEntity) + .extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false); + tEU = tEU * GregTech_API.mRFtoEU / 100; + aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); + } else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer + && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { + int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); + int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU); + long tEU = 0; + if (tTileEntity instanceof TileCapBank) { + ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); + if (network != null && network.getEnergyStoredL() > 0) { + tEU = Math.min( + (Math.min( + Math.min(network.getEnergyStoredL(), storedRF - extractRF), + network.getMaxOutput())) * (long) GregTech_API.mRFtoEU / 100L, + maxEUInput()); + network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU))); + } + } else { + if (storedRF > extractRF) { + ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); + tEU = maxEUInput(); } else { - if (storedRF > extractRF) { - ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); - tEU = maxEUInput(); - } else { - ((IPowerContainer) tTileEntity).setEnergyStored(0); - tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L; - } + ((IPowerContainer) tTileEntity).setEnergyStored(0); + tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L; } - aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); } + aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); + } } } } @@ -252,14 +247,14 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public String getAlternativeModeText() { return (getBaseMetaTileEntity().isAllowedToWork() ? GT_Utility.trans("145", "Step Down, In: ") - : GT_Utility.trans("146", "Step Up, In: ")) + maxEUInput() - + GT_Utility.trans("148", "V ") - + maxAmperesIn() - + GT_Utility.trans("147", "A, Out: ") - + maxEUOutput() - + GT_Utility.trans("148", "V ") - + maxAmperesOut() - + GT_Utility.trans("149", "A"); + : GT_Utility.trans("146", "Step Up, In: ")) + maxEUInput() + + GT_Utility.trans("148", "V ") + + maxAmperesIn() + + GT_Utility.trans("147", "A, Out: ") + + maxEUOutput() + + GT_Utility.trans("148", "V ") + + maxAmperesOut() + + GT_Utility.trans("149", "A"); } @Override @@ -269,45 +264,42 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { final int facing = getBaseMetaTileEntity().getFrontFacing(); final NBTTagCompound tag = accessor.getNBTData(); final int side = (byte) accessor.getSide() - .ordinal(); + .ordinal(); final boolean allowedToWork = tag.getBoolean("isAllowedToWork"); final byte inputTier = GT_Utility.getTier(tag.getLong("maxEUInput")); final byte outputTier = GT_Utility.getTier(tag.getLong("maxEUOutput")); currenttip.add( - String.format( - "%s %s(%dA) -> %s(%dA)", - (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET, - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(inputTier) - : tag.getLong("maxEUInput"), - tag.getLong("maxAmperesIn"), - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(outputTier) - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut"))); + String.format( + "%s %s(%dA) -> %s(%dA)", + (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET, + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier ? GT_Utility.getColoredTierNameFromTier(inputTier) + : tag.getLong("maxEUInput"), + tag.getLong("maxAmperesIn"), + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier ? GT_Utility.getColoredTierNameFromTier(outputTier) + : tag.getLong("maxEUOutput"), + tag.getLong("maxAmperesOut"))); if ((side == facing && allowedToWork) || (side != facing && !allowedToWork)) { currenttip.add( - String.format( - GOLD + "Input:" + RESET + " %s(%dA)", - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(inputTier) - : tag.getLong("maxEUInput"), - tag.getLong("maxAmperesIn"))); + String.format( + GOLD + "Input:" + RESET + " %s(%dA)", + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier ? GT_Utility.getColoredTierNameFromTier(inputTier) + : tag.getLong("maxEUInput"), + tag.getLong("maxAmperesIn"))); } else { currenttip.add( - String.format( - BLUE + "Output:" + RESET + " %s(%dA)", - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(outputTier) - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut"))); + String.format( + BLUE + "Output:" + RESET + " %s(%dA)", + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier + ? GT_Utility.getColoredTierNameFromTier(outputTier) + : tag.getLong("maxEUOutput"), + tag.getLong("maxAmperesOut"))); } super.getWailaBody(itemStack, currenttip, accessor, config); @@ -315,7 +307,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setBoolean("isAllowedToWork", getBaseMetaTileEntity().isAllowedToWork()); tag.setLong("maxEUInput", maxEUInput()); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java index 1c61f9ffa7..0e313a4c00 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java @@ -14,13 +14,13 @@ import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_Dynamo - implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { + implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { private String owner_uuid; private String owner_name; public GT_MetaTileEntity_Wireless_Dynamo(String aName, byte aTier, String[] aDescription, - ITexture[][][] aTextures) { + ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -86,8 +86,8 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D @Override public String[] getDescription() { return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", - EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.", - AuthorColen }; + EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.", + AuthorColen }; } @Override @@ -126,7 +126,7 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D // UUID and username of the owner. owner_uuid = aBaseMetaTileEntity.getOwnerUuid() - .toString(); + .toString(); owner_name = aBaseMetaTileEntity.getOwnerName(); strongCheckOrAddUser(owner_uuid, owner_name); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java index e17cc6fbfb..c363bb6eb0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java @@ -16,10 +16,10 @@ import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_Energy - implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { + implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { - private final BigInteger eu_transferred_per_operation = BigInteger.valueOf( - 2 * V[mTier] * ticks_between_energy_addition); + private final BigInteger eu_transferred_per_operation = BigInteger + .valueOf(2 * V[mTier] * ticks_between_energy_addition); private final long eu_transferred_per_operation_long = eu_transferred_per_operation.longValue(); private String owner_uuid; @@ -36,8 +36,8 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En @Override public String[] getDescription() { return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", - EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.", - AuthorColen }; + EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.", + AuthorColen }; } @Override @@ -132,7 +132,7 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En // UUID and username of the owner. owner_uuid = aBaseMetaTileEntity.getOwnerUuid() - .toString(); + .toString(); owner_name = aBaseMetaTileEntity.getOwnerName(); strongCheckOrAddUser(owner_uuid, owner_name); |