From 5f50e4a36ec000657b0a1664784acf00275293c6 Mon Sep 17 00:00:00 2001 From: boubou19 Date: Sat, 1 Apr 2023 18:11:43 +0200 Subject: update spotless formatting (#1827) --- .../implementations/GT_MetaPipeEntity_Cable.java | 21 +- .../implementations/GT_MetaPipeEntity_Fluid.java | 132 +++-- .../implementations/GT_MetaPipeEntity_Frame.java | 5 +- .../implementations/GT_MetaPipeEntity_Item.java | 23 +- .../GT_MetaTileEntity_BasicBatteryBuffer.java | 87 ++-- .../GT_MetaTileEntity_BasicGenerator.java | 6 +- .../GT_MetaTileEntity_BasicMachine.java | 228 ++++++--- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 70 ++- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 180 ++++--- .../GT_MetaTileEntity_BasicTank.java | 96 ++-- .../implementations/GT_MetaTileEntity_Buffer.java | 100 +++- .../GT_MetaTileEntity_CubicMultiBlockBase.java | 38 +- .../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 10 +- ...MetaTileEntity_ExtendedPowerMultiBlockBase.java | 6 +- .../GT_MetaTileEntity_Hatch_DataAccess.java | 12 +- .../GT_MetaTileEntity_Hatch_InputBus.java | 11 +- .../GT_MetaTileEntity_Hatch_Maintenance.java | 76 +-- .../GT_MetaTileEntity_Hatch_Muffler.java | 32 +- .../GT_MetaTileEntity_Hatch_MultiInput.java | 52 +- .../GT_MetaTileEntity_Hatch_Output.java | 121 +++-- .../GT_MetaTileEntity_Hatch_OutputBus.java | 4 +- .../GT_MetaTileEntity_MultiBlockBase.java | 563 ++++++++++++--------- .../GT_MetaTileEntity_SpecialFilter.java | 120 +++-- .../GT_MetaTileEntity_TieredMachineBlock.java | 12 +- .../GT_MetaTileEntity_Transformer.java | 10 +- .../GT_MetaTileEntity_Wireless_Dynamo.java | 3 +- .../GT_MetaTileEntity_Wireless_Hatch.java | 7 +- 27 files changed, 1277 insertions(+), 748 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') 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 e2e0b13f12..790d4d6c1f 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 @@ -205,7 +205,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (!isConnectedAtSide(aSide) && aSide != 6) return 0; - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsEnergyIn()) return 0; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsEnergyIn()) + return 0; final HashSet nul = null; return transferElectricity(aSide, aVoltage, aAmperage, nul); } @@ -245,9 +247,11 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { 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 + lastWorldTick = aBaseMetaTileEntity.getWorld() + .getTotalWorldTime() + - 1; // sets initial value -1 since it is + // in the same tick as first on post + // tick } } @@ -546,8 +550,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 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 29237218a1..a3e44640e8 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 @@ -263,7 +263,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { && aEntity instanceof EntityLivingBase) { for (FluidStack tFluid : mFluids) { if (tFluid != null) { - final int tTemperature = tFluid.getFluid().getTemperature(tFluid); + final int tTemperature = tFluid.getFluid() + .getTemperature(tFluid); if (tTemperature > 320 && !isCoverOnSide( (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { @@ -314,7 +315,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final FluidStack tFluid = mFluids[index]; if (tFluid != null && tFluid.amount > 0) { - final int tTemperature = tFluid.getFluid().getTemperature(tFluid); + final int tTemperature = tFluid.getFluid() + .getTemperature(tFluid); if (tTemperature > mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { // Poof @@ -341,21 +343,28 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); } - if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) { + if (!mGasProof && tFluid.getFluid() + .isGaseous(tFluid)) { tFluid.amount -= 5; sendSound((byte) 9); if (tTemperature > 320) { try { for (EntityLivingBase tLiving : (ArrayList) 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) { @@ -364,15 +373,21 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } else if (tTemperature < 260) { try { for (EntityLivingBase tLiving : (ArrayList) 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) { @@ -402,8 +417,10 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 - && getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsFluidOut(tFluid.getFluid()) - && (gTank == null || gTank.getCoverInfoAtSide(tSide).letsFluidIn(tFluid.getFluid()))) { + && 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)); } @@ -435,8 +452,10 @@ 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); @@ -510,7 +529,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public boolean canConnect(byte aSide, TileEntity tTileEntity) { if (tTileEntity == null) return false; - final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + final byte tSide = (byte) ForgeDirection.getOrientation(aSide) + .getOpposite() + .ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; @@ -559,19 +580,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()) - .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()); + new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD) + .setWorld(getBaseMetaTileEntity().getWorld()) + .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()); } } @@ -625,16 +646,21 @@ 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; + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0) + return 0; int index = -1; for (int i = 0; i < mPipeAmount; i++) { if (mFluids[i] != null && mFluids[i].isFluidEqual(aFluid)) { index = i; break; - } else if ((mFluids[i] == null || mFluids[i].getFluid().getID() <= 0) && index < 0) { - index = i; - } + } else if ((mFluids[i] == null || mFluids[i].getFluid() + .getID() + <= 0) && index < 0) { + index = i; + } } return fill_default_intoIndex(aSide, aFluid, doFill, index); @@ -642,9 +668,14 @@ 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; - - if (mFluids[index] == null || mFluids[index].getFluid().getID() <= 0) { + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0) + return 0; + + if (mFluids[index] == null || mFluids[index].getFluid() + .getID() + <= 0) { if (aFluid.amount * mPipeAmount <= getCapacity()) { if (doFill) { mFluids[index] = aFluid.copy(); @@ -811,8 +842,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 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 e449921d1d..302155a186 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,8 +19,9 @@ 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) { 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 5d2211528b..9e55aa94c7 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 @@ -228,10 +228,9 @@ 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( - IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) - .keySet()) { + for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending( + IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) + .keySet()) { if (temp) break; tPipeList.add(tTileEntity); while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity)) @@ -308,7 +307,9 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE : null; if (gTileEntity != null) { if (gTileEntity.getMetaTileEntity() == null) return false; - if (gTileEntity.getMetaTileEntity().connectsToItemPipe(tSide)) return true; + if (gTileEntity.getMetaTileEntity() + .connectsToItemPipe(tSide)) + return true; connectable = true; } @@ -355,7 +356,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide) { - if (getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsItemsOut(-1)) { + if (getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsItemsOut(-1)) { final TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) @@ -510,8 +512,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 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 7eb396a293..7b2a4fa232 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 @@ -237,7 +237,8 @@ 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.")) { + if (GT_ModHandler.isElectricItem(aStack) && aStack.getUnlocalizedName() + .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") @@ -383,47 +384,67 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier 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)); break; 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)); break; 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)); break; 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)); break; } } 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 669b3c9495..a71b94b916 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 @@ -278,8 +278,10 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity // 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() + .getUnlocalizedName() + .contains("bucket"); // since we cant really check for + // buckets... } } 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 7ff173615a..78fc68ee81 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 @@ -503,8 +503,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B 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(); @@ -569,8 +569,9 @@ 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()); @@ -731,8 +732,10 @@ 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()); } } } @@ -1058,11 +1061,26 @@ 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"); + 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"); } /** @@ -1213,12 +1231,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B currenttip.add( String.format( "Machine Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")).name())); + ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")) + .name())); currenttip.add( String.format( "Output Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")).name())); + ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")) + .name())); } @Override @@ -1267,8 +1287,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)); } } @@ -1331,7 +1352,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); } /** @@ -1339,7 +1361,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); } /** @@ -1347,46 +1370,71 @@ 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); + .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); } @@ -1394,25 +1442,36 @@ 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) { 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; } @@ -1425,11 +1484,13 @@ 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); } @@ -1440,34 +1501,53 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (isSteampowered()) { for (Pair> 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> specialTexture : getRecipeList().specialTextures) { builder.widget( new DrawableWidget().setDrawable(specialTexture.getLeft()) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight())); + .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()); + 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()); } protected List getErrorDescriptions() { 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 4098831e48..934554dfbc 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 @@ -174,18 +174,30 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE mNeedsSteamVenting = false; try { for (EntityLivingBase tLiving : (ArrayList) 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) { @@ -230,17 +242,22 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE if (aIndex == 9) { 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) - .times( - 8, - x -> x.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()).run()); + 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) + .times( + 8, + x -> x.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat