diff options
author | boubou19 <miisterunknown@gmail.com> | 2023-04-01 18:11:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 18:11:43 +0200 |
commit | 5f50e4a36ec000657b0a1664784acf00275293c6 (patch) | |
tree | 5ef81441032735438c9fd9c620224ca58e46e537 /src/main/java/gregtech/api/metatileentity | |
parent | 6b77557e0e87cf5afd9ebd3985323ff1249e615c (diff) | |
download | GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.tar.gz GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.tar.bz2 GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.zip |
update spotless formatting (#1827)
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
36 files changed, 1595 insertions, 888 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 335639c9e3..e1a83f5cc6 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -943,7 +943,7 @@ 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) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); mMetaTileEntity.markDirty(); @@ -1224,7 +1224,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide( aSide, - mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid(), false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 6b7368ae02..00e31ed9a0 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -82,8 +82,10 @@ import ic2.api.Direction; public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, 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]; @@ -384,8 +386,9 @@ 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); @@ -415,7 +418,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (getRandomNumber(10) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(mOwnerName), + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( @@ -449,7 +453,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec && getRandomNumber(3) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(mOwnerName), + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( @@ -482,11 +487,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec 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]), + (long) ic2.api.info.Info.itemEnergy.getEnergyValue( + mMetaTileEntity.mInventory[i]), false); mMetaTileEntity.mInventory[i].stackSize--; mInventoryChanged = true; @@ -1112,7 +1117,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void generatePowerNodes() { if (isServerSide() && (isEnetInput() || isEnetOutput())) { - final int time = MinecraftServer.getServer().getTickCounter(); + final int time = MinecraftServer.getServer() + .getTickCounter(); for (byte i : ALL_VALID_SIDES) { if (outputsEnergyTo(i, false) || inputEnergyFrom(i, false)) { final IGregTechTileEntity TE = getIGregTechTileEntityAtSide(i); @@ -1202,8 +1208,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override 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) + final ITexture[] textureUncovered = hasValidMetaTileEntity() + ? mMetaTileEntity.getTexture( + this, + aSide, + mFacing, + (byte) (mColor - 1), + mActive, + getOutputRedstoneSignal(aSide) > 0) : Textures.BlockIcons.ERROR_RENDERING; final ITexture[] textureCovered; if (coverTexture != null) { @@ -1293,7 +1305,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if ((mOwnerName.length() == 0) && isServerSide()) { setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - } else return !privateAccess() || aPlayer.getDisplayName().equals("Player") + } else return !privateAccess() || aPlayer.getDisplayName() + .equals("Player") || mOwnerName.equals("Player") || mOwnerName.equals(aPlayer.getDisplayName()); return true; @@ -1315,8 +1328,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec doExplosion( oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); - GT_Mod.achievements - .issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); + GT_Mod.achievements.issueAchievement( + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), + "electricproblems"); } } @@ -1364,7 +1379,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec 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()); + tItemEntity.getEntityItem() + .setTagCompound( + (NBTTagCompound) tItem.getTagCompound() + .copy()); } tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D); tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D); @@ -1423,7 +1441,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (isServerSide()) { - if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) { + if (!privateAccess() || aPlayer.getDisplayName() + .equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { if (getColorization() >= 0 @@ -1434,8 +1453,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } 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, @@ -1497,16 +1516,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { 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")))); + 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")))); GT_Utility.sendSoundToPlayers( worldObj, SoundResource.RANDOM_ANVIL_USE, @@ -1602,7 +1619,7 @@ 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) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; @@ -1994,8 +2011,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn( + aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.fill(aSide, aFluid, doFill); return 0; } @@ -2006,7 +2023,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( - mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid())))) + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid())))) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @@ -2016,8 +2035,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( + aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.drain(aSide, aFluid, doDrain); return null; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 31d388cf71..238dc6ba30 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -201,7 +201,8 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public int getRandomNumber(int aRange) { - return ThreadLocalRandom.current().nextInt(aRange); + return ThreadLocalRandom.current() + .nextInt(aRange); } @Override @@ -530,8 +531,9 @@ 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()) { - final int skipUpdateSide = dir.getOpposite().ordinal(); // Don't update this block. Still updates - // diagonal blocks twice if conditions + final int skipUpdateSide = dir.getOpposite() + .ordinal(); // Don't update this block. Still updates + // diagonal blocks twice if conditions // meet. for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) { @@ -707,8 +709,9 @@ 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); // noinspection PointlessArithmeticExpression @@ -717,27 +720,35 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje 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); + tab.setDrawable(getGUITextureSet().getTitleTabAngular()) + .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); + tab.setDrawable(getGUITextureSet().getTitleTabDark()) + .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); + builder.widget(tab) + .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 @@ -752,7 +763,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() { @@ -776,8 +789,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 @@ -789,8 +806,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 @@ -802,8 +823,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 @@ -815,8 +840,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) { @@ -857,8 +886,9 @@ 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 { @@ -894,10 +924,13 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje 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) { @@ -915,9 +948,17 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje 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))); + .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 a49071cdcf..853dd3699a 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -34,7 +34,8 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement GT_Log.err.println("MetaID " + aID + " not loadable => locking TileEntity!"); } else { if (hasValidMetaTileEntity()) getMetaTileEntity().setBaseMetaTileEntity(null); - GregTech_API.METATILEENTITIES[aID].newMetaEntity(this).setBaseMetaTileEntity(this); + GregTech_API.METATILEENTITIES[aID].newMetaEntity(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 1228e3f668..f2929e7e1e 100644 --- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java @@ -64,7 +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 }; @@ -102,7 +104,10 @@ 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()); + aNBT.setTag( + COVER_DATA_NBT_KEYS[i], + coverInfo.getCoverData() + .saveDataToNBT()); } if (tList.tagCount() > 0) { aNBT.setTag(GT_Values.NBT.COVERS, tList); @@ -159,8 +164,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (coverBehavior instanceof GT_Cover_Fluidfilter) { 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)); + coverData = coverInfo.getCoverBehavior() + .createDataObject( + (tOldData[i] & 7) + | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) + << 3)); } } else { coverData = coverBehavior.createDataObject(tOldData[i]); @@ -290,7 +298,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverDataAtSide(byte aSide, ISerializableObject aData) { final CoverInfo coverInfo = getCoverInfoAtSide(aSide); - if (coverInfo.isValid() && coverInfo.getCoverBehavior().cast(aData) != null) coverInfo.setCoverData(aData); + if (coverInfo.isValid() && coverInfo.getCoverBehavior() + .cast(aData) + != null) + coverInfo.setCoverData(aData); } @Override @@ -303,7 +314,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverItemAtSide(byte aSide, ItemStack aCover) { - GregTech_API.getCoverBehaviorNew(aCover).placeCover(aSide, aCover, this); + GregTech_API.getCoverBehaviorNew(aCover) + .placeCover(aSide, aCover, this); } @Override @@ -426,14 +438,18 @@ 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)); + return IntStream.range(1, 6) + .anyMatch(i -> getRedstone((byte) i)); } @Override @@ -443,7 +459,10 @@ 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); + return (byte) IntStream.range(1, 6) + .map(i -> getInternalInputRedstoneSignal((byte) i)) + .max() + .orElse(0); } @Override @@ -469,16 +488,20 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @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) { @@ -531,7 +554,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - final byte currentFacing = (byte) accessor.getSide().ordinal(); + final byte currentFacing = (byte) accessor.getSide() + .ordinal(); final NBTTagList tList = tag.getTagList(GT_Values.NBT.COVERS, 10); for (byte i = 0; i < tList.tagCount(); i++) { @@ -547,8 +571,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov currentFacing == coverInfo.getSide() ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") : StatCollector.translateToLocal( - "GT5U.interface.coverTabs." + ForgeDirection - .getOrientation(coverInfo.getSide()).toString().toLowerCase()), + "GT5U.interface.coverTabs." + + ForgeDirection.getOrientation(coverInfo.getSide()) + .toString() + .toLowerCase()), coverStack.getDisplayName())); final String behaviorDesc = coverInfo.getBehaviorDescription(); if (!Objects.equals(behaviorDesc, E)) currenttip.add(behaviorDesc); @@ -602,8 +628,8 @@ 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( @@ -634,11 +660,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); + columnWidget.setAlignment(MainAxisAlignment.SPACE_BETWEEN) + .setSpace(COVER_TAB_SPACING); for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { final byte side = (byte) direction.ordinal(); @@ -668,12 +698,23 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov 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(() -> { return 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( + () -> { return getCoverItemAtSide(side); }) + .asWidget() + .setPos( + (COVER_TAB_WIDTH + - ICON_SIZE) + / 2 + + (flipHorizontally + ? -1 + : 1), + (COVER_TAB_HEIGHT + - ICON_SIZE) + / 2)) + .setEnabled(widget -> getCoverItemAtSide(side) != null)); } } @@ -708,14 +749,20 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (isClientSide()) return; final CoverInfo coverInfo = getCoverInfoAtSide(side); if (coverInfo.useModularUI()) { - widget.getContext().openSyncedWindow(side + COVER_WINDOW_ID_START); + widget.getContext() + .openSyncedWindow(side + COVER_WINDOW_ID_START); } else { final GT_Packet_TileEntityCoverGUI packet = new GT_Packet_TileEntityCoverGUI( coverInfo, getWorld().provider.dimensionId, - widget.getContext().getPlayer().getEntityId(), + widget.getContext() + .getPlayer() + .getEntityId(), 0); - GT_Values.NW.sendToPlayer(packet, (EntityPlayerMP) widget.getContext().getPlayer()); + GT_Values.NW.sendToPlayer( + 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 3aa0cbfb32..cf1cb5dc1b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -98,7 +98,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } else { throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } - mName = aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH); + mName = aBasicName.replaceAll(" ", "_") + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(new BaseMetaPipeEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -113,7 +114,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { if (!GT.isClientSide()) return; ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); + tStack.getItem() + .addInformation(tStack, null, new ArrayList<String>(), true); } /** @@ -146,7 +148,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + mBaseMetaTileEntity.getMetaTileEntity() + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -786,8 +789,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { 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(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength) + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } @@ -875,7 +881,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { final IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; - if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) { + if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass() + .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 @@ -890,8 +897,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { connectAtSide(aSide); return 1; } - if (!baseMetaTile.getWorld().getChunkProvider() - .chunkExists(baseMetaTile.getOffsetX(aSide, 1) >> 4, baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { + if (!baseMetaTile.getWorld() + .getChunkProvider() + .chunkExists( + baseMetaTile.getOffsetX(aSide, 1) >> 4, + baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { // Target chunk unloaded return -1; } @@ -921,7 +931,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { byte tSide = GT_Utility.getOppositeSide(aSide); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); - if ((this.getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) + if ((this.getClass() + .isInstance(tPipe) + || (tPipe != null && tPipe.getClass() + .isInstance(this))) && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide); } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 26caeaa416..a017fca2e0 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -129,7 +129,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } else { throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } - mName = aBasicName.replace(" ", "_").toLowerCase(Locale.ENGLISH); + mName = aBasicName.replace(" ", "_") + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -165,7 +166,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + mBaseMetaTileEntity.getMetaTileEntity() + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -245,7 +247,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac && (((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; } @@ -260,7 +268,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac && (((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; } @@ -268,13 +282,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onExplosion() { GT_Log.exp.println( - "Machine at " + this.getBaseMetaTileEntity().getXCoord() + "Machine at " + this.getBaseMetaTileEntity() + .getXCoord() + " | " - + this.getBaseMetaTileEntity().getYCoord() + + this.getBaseMetaTileEntity() + .getYCoord() + " | " - + this.getBaseMetaTileEntity().getZCoord() + + this.getBaseMetaTileEntity() + .getZCoord() + " DIMID: " - + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + " exploded."); } @@ -1180,7 +1198,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac currenttip.add( String.format( "Facing: %s", - ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()).name())); + ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()) + .name())); if (this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider @@ -1221,11 +1240,20 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac try { if (getProxy() == null) return "(proxy)"; if (getProxy().getNode() == null) return "(node)"; - if (getProxy().getNode().getGrid() == null) return "(grid)"; - if (!getProxy().getNode().meetsChannelRequirements()) return "(channels)"; - IPathingGrid pg = getProxy().getNode().getGrid().getCache(IPathingGrid.class); + if (getProxy().getNode() + .getGrid() + == null) + return "(grid)"; + if (!getProxy().getNode() + .meetsChannelRequirements()) + return "(channels)"; + IPathingGrid pg = getProxy().getNode() + .getGrid() + .getCache(IPathingGrid.class); if (!pg.isNetworkBooting()) return "(booting)"; - IEnergyGrid eg = getProxy().getNode().getGrid().getCache(IEnergyGrid.class); + IEnergyGrid eg = getProxy().getNode() + .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 6d6ec378d4..674ced4535 100644 --- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java +++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java @@ -82,8 +82,9 @@ 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(); @@ -97,8 +98,10 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { amps, Sets.newHashSet((TileEntity) myMeta)); - } else usedAmps = myMeta - .injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); + } else usedAmps = myMeta.injectEnergyUnits( + (byte) directionFrom.ordinal(), + Math.min(euPerAmp, myMeta.getInputVoltage()), + amps); return amount - (usedAmps * euPerAmp); // transferElectricity for cables 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 a372a37103..e8e313141d 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 @@ -32,28 +32,52 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine "smelting", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), + 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.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.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.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.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.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.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())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String aDescription, ITexture[][][] aTextures, 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<TileEntity> 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<EntityLivingBase>) 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<EntityLivingBase>) 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()) - .<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()); + 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()); } } @@ -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<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())); + .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<String> 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<EntityLivingBase>) 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) - .<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()); + 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()); } } @@ -251,7 +268,8 @@ 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() + return GregTech_API.getCoverBehaviorNew(aCoverID.toStack()) + .isSimpleCover() && super.allowCoverOnSide(aSide, aCoverID); } @@ -370,7 +388,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 e51da3bbdc..5331f67dca 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 @@ -81,84 +81,92 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_ACTIVE_GLOW"))) - .glow().build()), + .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()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_SIDE_GLOW"))) + .glow() + .build()), 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()), + .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()), + .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()), + .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()), + .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()), + .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())); + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_GLOW"))) + .glow() + .build())); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; @@ -1058,23 +1066,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case 0: return false; case 1: - if (this.getFillableStack() == null) - return !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack); - else return this.getRecipeList().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( + if (this.getFillableStack() == null) return !this.mRequiresFluidForFiltering && this.getRecipeList() + .containsInput( + aStack); + else return this.getRecipeList() + .findRecipe( this.getBaseMetaTileEntity(), this.mLastRecipe, true, @@ -1082,12 +1078,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ V[this.mTier], new FluidStack[] { this.getFillableStack() }, this.getSpecialSlot(), - aIndex == this.getInputSlot() - ? appendSelectedCircuit(aStack, this.getInputAt(1)) - : appendSelectedCircuit(this.getInputAt(0), aStack)) - != null)))); + 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)))); default: { - int tID = this.getBaseMetaTileEntity().getMetaTileID(); + int tID = this.getBaseMetaTileEntity() + .getMetaTileID(); if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { // assembler // lv-iv; // circuit @@ -1097,10 +1112,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ // assemblers // luv-uev if (GT_Utility.isStackValid(aStack)) for (int oreID : OreDictionary.getOreIDs(aStack)) { - if (OreDictionary.getOreName(oreID).startsWith("circuit")) return true; + if (OreDictionary.getOreName(oreID) + .startsWith("circuit")) + return true; } } - return this.getRecipeList().containsInput(aStack); + return this.getRecipeList() + .containsInput(aStack); } } } @@ -1124,12 +1142,22 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { new WorldSpawnedEventBuilder.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(); } break; default: @@ -1192,8 +1220,11 @@ 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()); - particleEventBuilder.setIdentifier(ParticleFX.LAVA).run(); + .setPosition(x, y, z) + .setWorld( + getBaseMetaTileEntity().getWorld()); + particleEventBuilder.setIdentifier(ParticleFX.LAVA) + .run(); } } break; @@ -1253,8 +1284,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()); + 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_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java index 1286c84c9b..193d654af6 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 @@ -208,8 +208,11 @@ 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); @@ -227,8 +230,10 @@ 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()); } } } @@ -245,13 +250,14 @@ 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)) + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; - if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { + if (getFillableStack() == null || getFillableStack().getFluid() + .getID() + <= 0) { if (aFluid.amount <= getCapacity()) { if (doFill) { setFillableStack(aFluid.copy()); @@ -337,34 +343,56 @@ 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 827f2b2ec9..1138b0a51d 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 @@ -61,14 +61,30 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; 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()); - ITexture tDown = TextureFactory - .of(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()); - ITexture tRight = TextureFactory - .of(TextureFactory.of(ARROW_RIGHT), TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build()); + ITexture tUp = TextureFactory.of( + 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()); + ITexture tLeft = TextureFactory.of( + 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()); 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 }; @@ -401,7 +417,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; - mInventory[slot] = stacks.get(sID).copy(); + mInventory[slot] = stacks.get(sID) + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -433,15 +450,21 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bOutput = !bOutput; if (bOutput) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("116", "Emit Energy to Outputside")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + 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) { @@ -449,30 +472,43 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bRedstoneIfFull = !bRedstoneIfFull; if (bRedstoneIfFull) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("118", "Emit Redstone if no Slot is free")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + 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) { builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { bInvert = !bInvert; if (bInvert) { - GT_Utility - .sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone")); + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("120", "Invert Redstone")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + 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) { @@ -480,22 +516,32 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bStockingMode = !bStockingMode; if (bStockingMode) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + 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(), + 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)); + builder.widget( + 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 830706f8fe..d9c32911b7 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 @@ -44,23 +44,27 @@ 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; 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 e5cf3d5cc4..bd6facceee 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 @@ -131,8 +131,14 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setByte("eRotation", (byte) mExtendedFacing.getRotation().getIndex()); - aNBT.setByte("eFlip", (byte) mExtendedFacing.getFlip().getIndex()); + aNBT.setByte( + "eRotation", + (byte) mExtendedFacing.getRotation() + .getIndex()); + aNBT.setByte( + "eFlip", + (byte) mExtendedFacing.getFlip() + .getIndex()); } @Override 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 9f75c283ec..cfc1ce6558 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 @@ -139,8 +139,10 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT long maxEnergy = 0; for (GT_MetaTileEntity_Hatch tHatch : getExoticAndNormalEnergyHatchList()) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); } } long voltage = getAverageInputVoltage(); 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 fc25a15beb..fc6dce9e70 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 @@ -145,12 +145,16 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mTier) { case 4: - getBaseMetaTileEntity() - .add2by2Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity().add2by2Slots( + builder, + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_CIRCUIT); break; default: - getBaseMetaTileEntity() - .add4by4Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity().add4by4Slots( + builder, + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_CIRCUIT); break; } } 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 959bcda530..42abf4839b 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 @@ -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(); } } @@ -174,7 +174,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; - mInventory[slot] = stacks.get(sID).copy(); + mInventory[slot] = stacks.get(sID) + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -201,7 +202,9 @@ 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; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return; if (aPlayer.isSneaking()) { if (disableSort) { disableSort = false; 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 bcc260fd2e..d380baf8ed 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 @@ -96,14 +96,20 @@ 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) }; } @@ -146,7 +152,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch 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; + if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile() + .getName() + .endsWith(".robot")) + return false; ItemStack tStack = aPlayer.getCurrentEquippedItem(); if (tStack != null) { if (tStack.getItem() instanceof ItemToolbox) { @@ -193,8 +202,10 @@ 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; @@ -211,8 +222,10 @@ 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; @@ -322,28 +335,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().setBackground(GT_UITextures.TRANSPARENT).setPos(79, 34)).widget( - new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(8, 12)); + 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)); } } } 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 b41f45e6d2..f0f1705b1f 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 @@ -34,7 +34,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { 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) { @@ -103,8 +103,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) { - pollutionParticles(this.getBaseMetaTileEntity().getWorld(), ParticleFX.LARGE_SMOKE.toString()); + if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity() + .isActive()) { + pollutionParticles( + this.getBaseMetaTileEntity() + .getWorld(), + ParticleFX.LARGE_SMOKE.toString()); } } @@ -159,26 +163,35 @@ 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( xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk2) { events.setPosition( xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk3) { events.setPosition( xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } } @@ -217,6 +230,7 @@ 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); + Arrays.stream(aFacings) + .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 7d95e0b17c..1b7fedce22 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 @@ -171,10 +171,9 @@ 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)) + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; if (!hasFluid(aFluid) && getFirstEmptySlot() != -1) { int tFilled = Math.min(aFluid.amount, mCapacityPer); @@ -304,21 +303,36 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ 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])); + .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 ed29f8fe08..4a8e745a25 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 @@ -123,16 +123,18 @@ 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); 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()), @@ -163,7 +165,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl lockedFluidName = aNBT.getString("lockedFluidName"); lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName; if (GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) != null) { - lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName(); + lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) + .getName(); } } @@ -239,7 +242,9 @@ 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; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return; if (aPlayer.isSneaking()) { mMode = (byte) ((mMode + 9) % 10); } else { @@ -287,8 +292,12 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "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()); - inBrackets = this.getDrainableStack().getLocalizedName(); + this.setLockedFluidName( + this.getDrainableStack() + .getFluid() + .getName()); + inBrackets = this.getDrainableStack() + .getLocalizedName(); } GT_Utility.sendChatToPlayer( aPlayer, @@ -305,8 +314,12 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "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()); - inBrackets = this.getDrainableStack().getLocalizedName(); + this.setLockedFluidName( + this.getDrainableStack() + .getFluid() + .getName()); + inBrackets = this.getDrainableStack() + .getLocalizedName(); } GT_Utility.sendChatToPlayer( aPlayer, @@ -316,7 +329,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl } private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) { - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).isGUIClickable()) return false; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return false; if (!isFluidLocked()) return false; final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem == null) return false; @@ -324,7 +339,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem) tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem); if (tFluid != null) { - if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getFluid().getName())) { + if (getLockedFluidName() != null && !getLockedFluidName().equals( + tFluid.getFluid() + .getName())) { GT_Utility.sendChatToPlayer( aPlayer, String.format( @@ -334,7 +351,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "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()); + setLockedFluidName( + tFluid.getFluid() + .getName()); if (mMode == 8) GT_Utility.sendChatToPlayer( aPlayer, String.format( @@ -427,7 +446,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override protected void onEmptyingContainerWhenEmpty() { if (this.lockedFluidName == null && this.mFluid != null && isFluidLocked()) { - this.setLockedFluidName(this.mFluid.getFluid().getName()); + this.setLockedFluidName( + this.mFluid.getFluid() + .getName()); final EntityPlayer player; if (playerThatLockedfluid == null || (player = playerThatLockedfluid.get()) == null) return; GT_Utility.sendChatToPlayer( @@ -459,7 +480,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl + EnumChatFormatting.RESET, (!isFluidLocked() || lockedFluidName == null) ? "Not Locked" : ("Locked to " + StatCollector.translateToLocal( - FluidRegistry.getFluidStack(lockedFluidName, 1).getUnlocalizedName())) }; + FluidRegistry.getFluidStack(lockedFluidName, 1) + .getUnlocalizedName())) }; } @Override @@ -471,28 +493,51 @@ 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 094ad29471..c970b64cb9 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 @@ -160,8 +160,8 @@ 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, 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 51086d806b..d2083fc87c 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 @@ -104,29 +104,43 @@ 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(); + return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity() + .getMetaTileEntity() + == aMetaTileEntity + && !aMetaTileEntity.getBaseMetaTileEntity() + .isDead(); } @Override @@ -433,7 +447,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity try { GT_Mod.achievements.issueAchivementHatch( aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); } catch (Exception ignored) {} addOutput(tStack); @@ -458,7 +472,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity try { GT_Mod.achievements.issueAchievement( aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); } catch (Exception ignored) {} } @@ -523,7 +537,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (getBaseMetaTileEntity().isActive() && activitySound != null) { if (activitySoundLoop == null) { activitySoundLoop = new GT_SoundLoop(activitySound, getBaseMetaTileEntity(), false, true); - Minecraft.getMinecraft().getSoundHandler().playSound(activitySoundLoop); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(activitySoundLoop); } } else { if (activitySoundLoop != null) { @@ -683,13 +699,15 @@ 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))); + (long) getDamageToComponent(mInventory[1]) * (long) Math.min( + mEUt / this.damageFactorLow, + Math.pow(mEUt, this.damageFactorHigh))); if (mInventory[1].stackSize == 0) mInventory[1] = null; } } @@ -700,13 +718,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public void explodeMultiblock() { GT_Log.exp.println( - "MultiBlockExplosion at: " + this.getBaseMetaTileEntity().getXCoord() + "MultiBlockExplosion at: " + this.getBaseMetaTileEntity() + .getXCoord() + " | " - + this.getBaseMetaTileEntity().getYCoord() + + this.getBaseMetaTileEntity() + .getYCoord() + " | " - + this.getBaseMetaTileEntity().getZCoord() + + this.getBaseMetaTileEntity() + .getZCoord() + " DIMID: " - + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + "."); GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion); @@ -722,7 +744,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mMaintenanceHatches); for (MetaTileEntity tTileEntity : allHatches) { if (tTileEntity != null && tTileEntity.getBaseMetaTileEntity() != null) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + tTileEntity.getBaseMetaTileEntity() + .doExplosion(V[8]); } } getBaseMetaTileEntity().doExplosion(V[8]); @@ -780,11 +803,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); for (int i = 0; i < ampsOnCurrentHatch; i++) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); + aDynamo.getBaseMetaTileEntity() + .increaseStoredEnergyUnits(aVoltage, false); } injected += aVoltage * ampsOnCurrentHatch; if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); + aDynamo.getBaseMetaTileEntity() + .increaseStoredEnergyUnits(aRemainder, false); injected += aRemainder; } } @@ -795,7 +820,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public long getMaxInputVoltage() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity() + .getInputVoltage(); return rVoltage; } @@ -877,7 +903,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public boolean drainEnergyInput(long aEU) { if (aEU <= 0) return true; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; + if (tHatch.getBaseMetaTileEntity() + .decreaseStoredEnergyUnits(aEU, false)) + return true; } return false; } @@ -946,7 +974,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity ItemStack single = aStack.splitStack(1); for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { if (!outputSuccess && isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, single)) outputSuccess = true; + if (tHatch.getBaseMetaTileEntity() + .addStackToSlot(1, single)) + outputSuccess = true; } } } @@ -960,9 +990,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + if (GT_Utility.areStacksEqual( + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(0))) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(0).stackSize + >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity() + .decrStackSize(0, aStack.stackSize); return true; } } @@ -971,10 +1007,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(i, aStack.stackSize); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + if (GT_Utility.areStacksEqual( + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i))) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(i).stackSize + >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity() + .decrStackSize(i, aStack.stackSize); return true; } } @@ -993,8 +1037,12 @@ 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--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + rList.add( + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } @@ -1029,13 +1077,20 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(i) + != null) + rList.add( + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } - if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().startsWith("gt.integrated_circuit")) + if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName() + .startsWith("gt.integrated_circuit")) rList.add(getStackInSlot(1)); return rList; } @@ -1229,8 +1284,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); } } @@ -1519,134 +1576,158 @@ 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)); + builder.widget( + 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)); + builder.widget(createLockToSingleRecipeButton()) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> mLockedToSingleRecipe, + val -> mLockedToSingleRecipe = val)); } @Override public void addGregTechLogo(ModularWindow.Builder builder) {} protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); - - 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( - 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( - 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( - 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( - 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( - 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( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); + + 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( + 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( + 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( + 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( + 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( + 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( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .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)); + .setEnabled( + widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) + != 0)); screenElements.widget( 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))); + .setEnabled( + widget -> (getBaseMetaTileEntity().getErrorDisplayID() + & 256) != 0)); + 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("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())); 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())); + .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())); + .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; - })); + .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; - })); + .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() { @@ -1656,21 +1737,25 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } else { 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; } @@ -1679,26 +1764,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isVoidExcessButtonEnabled()) { 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; } @@ -1707,26 +1796,32 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isInputSeparationButtonEnabled()) { 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; } @@ -1735,26 +1830,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isBatchModeButtonEnabled()) { 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; } @@ -1763,26 +1862,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (supportsSingleRecipeLocking()) { 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 6becb5e806..890733e363 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 @@ -90,58 +90,80 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { bInvertFilter = !bInvertFilter; if (bInvertFilter) { - GT_Utility.sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter")); + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("124", "Invert Filter")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + 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().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD)) - .widget(SlotGroup.ofItemHandler(inventoryHandler, 3).endAtSlot(8).build().setPos(97, 4)); + }) + .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)); } } 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 9c069bbd5f..3424baca8b 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 @@ -124,7 +124,15 @@ 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_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index a70ee0d5e7..cb98e202ad 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 @@ -175,9 +175,10 @@ 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 = (long) ((IEnergyProvider) tTileEntity).extractEnergy( ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), @@ -271,7 +272,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi IWailaConfigHandler config) { final int facing = getBaseMetaTileEntity().getFrontFacing(); final NBTTagCompound tag = accessor.getNBTData(); - final int side = (byte) accessor.getSide().ordinal(); + final int side = (byte) accessor.getSide() + .ordinal(); final boolean allowedToWork = tag.getBoolean("isAllowedToWork"); final byte inputTier = GT_Utility.getTier(tag.getLong("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 997898a34e..1c61f9ffa7 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 @@ -125,7 +125,8 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D if (aTick == 1) { // UUID and username of the owner. - owner_uuid = aBaseMetaTileEntity.getOwnerUuid().toString(); + owner_uuid = aBaseMetaTileEntity.getOwnerUuid() + .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 756a1b138a..e17cc6fbfb 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 @@ -18,8 +18,8 @@ import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_Energy 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; @@ -131,7 +131,8 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En if (aTick == 1) { // UUID and username of the owner. - owner_uuid = aBaseMetaTileEntity.getOwnerUuid().toString(); + owner_uuid = aBaseMetaTileEntity.getOwnerUuid() + .toString(); owner_name = aBaseMetaTileEntity.getOwnerName(); strongCheckOrAddUser(owner_uuid, owner_name); |