diff options
author | Raven Szewczyk <git@eigenraven.me> | 2023-04-10 17:49:16 +0100 |
---|---|---|
committer | Raven Szewczyk <git@eigenraven.me> | 2023-04-10 17:49:16 +0100 |
commit | 8ac58626bd4caa9e49f58acc6b97ac031f6c2107 (patch) | |
tree | 0a8c7b737f1f2607fa6875309f4c6a5c2b8b3331 /src/main/java/gregtech/api/multitileentity | |
parent | d795cf740c3b48b602d3bfb708ed9e6c492ad37d (diff) | |
download | GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.tar.gz GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.tar.bz2 GT5-Unofficial-8ac58626bd4caa9e49f58acc6b97ac031f6c2107.zip |
Update spotless config to 0.2.2
Diffstat (limited to 'src/main/java/gregtech/api/multitileentity')
12 files changed, 719 insertions, 805 deletions
diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java index 2e6bdca647..55edf332bd 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java @@ -77,7 +77,7 @@ import gregtech.common.render.IRenderedBlock; */ @Optional.Interface(iface = "com.cricketcraft.chisel.api.IFacade", modid = "ChiselAPI") public class MultiTileEntityBlock extends Block - implements IDebugableBlock, ITileEntityProvider, IRenderedBlock, IFacade { + implements IDebugableBlock, ITileEntityProvider, IRenderedBlock, IFacade { protected static final Map<String, MultiTileEntityBlock> MULTI_BLOCK_MAP = new HashMap<>(); private static boolean LOCK = false; @@ -87,22 +87,22 @@ public class MultiTileEntityBlock extends Block protected final boolean mOpaque, mNormalCube; public static String getName(String aMaterialName, SoundType aSoundType, String aTool, int aHarvestLevelOffset, - int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube) { + int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube) { return "gt.block.multiblock." + aMaterialName - + "." - + aSoundType.soundName - + "." - + aTool - + "." - + aHarvestLevelOffset - + "." - + aHarvestLevelMinimum - + "." - + aHarvestLevelMaximum - + "." - + aOpaque - + "." - + aNormalCube; + + "." + + aSoundType.soundName + + "." + + aTool + + "." + + aHarvestLevelOffset + + "." + + aHarvestLevelMinimum + + "." + + aHarvestLevelMaximum + + "." + + aOpaque + + "." + + aNormalCube; } /** @@ -118,50 +118,50 @@ public class MultiTileEntityBlock extends Block * @param aNormalCube if this Block is a normal Cube (for Redstone Stuff). */ public static MultiTileEntityBlock getOrCreate(String aModID, String aMaterialName, Material aMaterial, - SoundType aSoundType, String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, - int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube) { + SoundType aSoundType, String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, int aHarvestLevelMaximum, + boolean aOpaque, boolean aNormalCube) { final MultiTileEntityBlock rBlock = MULTI_BLOCK_MAP.get( - aModID + ":" - + getName( - aMaterialName, - aSoundType, - aTool = aTool.toLowerCase(), - aHarvestLevelOffset, - aHarvestLevelMinimum, - aHarvestLevelMaximum, - aOpaque, - aNormalCube)); + aModID + ":" + + getName( + aMaterialName, + aSoundType, + aTool = aTool.toLowerCase(), + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube)); return rBlock == null - ? new MultiTileEntityBlock( - aModID, - aMaterialName, - aMaterial, - aSoundType, - aTool, - aHarvestLevelOffset, - aHarvestLevelMinimum, - aHarvestLevelMaximum, - aOpaque, - aNormalCube) - : rBlock; + ? new MultiTileEntityBlock( + aModID, + aMaterialName, + aMaterial, + aSoundType, + aTool, + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube) + : rBlock; } protected MultiTileEntityBlock(String aModID, String aMaterialName, Material aMaterial, SoundType aSoundType, - String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, - boolean aNormalCube) { + String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, + boolean aNormalCube) { super(aMaterial); if (GregTech_API.sPreloadFinished) throw new IllegalStateException("Blocks can only be initialized within preInit!"); mNameInternal = getName( - aMaterialName, - aSoundType, - aTool, - aHarvestLevelOffset, - aHarvestLevelMinimum, - aHarvestLevelMaximum, - aOpaque, - aNormalCube); + aMaterialName, + aSoundType, + aTool, + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube); GameRegistry.registerBlock(this, ItemBlock.class, mNameInternal); MULTI_BLOCK_MAP.put(aModID + ":" + mNameInternal, this); @@ -187,7 +187,7 @@ public class MultiTileEntityBlock extends Block return; if (aTileEntity instanceof IMTE_BreakBlock && ((IMTE_BreakBlock) aTileEntity).breakBlock()) return; if (aTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData - && ((IMTE_HasMultiBlockMachineRelevantData) aTileEntity).hasMultiBlockMachineRelevantData()) + && ((IMTE_HasMultiBlockMachineRelevantData) aTileEntity).hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); aWorld.removeTileEntity(aX, aY, aZ); @@ -226,7 +226,7 @@ public class MultiTileEntityBlock extends Block public final float getBlockHardness(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_GetBlockHardness ? ((IMTE_GetBlockHardness) aTileEntity).getBlockHardness() - : 1.0F; + : 1.0F; } @SideOnly(Side.CLIENT) @@ -244,7 +244,7 @@ public class MultiTileEntityBlock extends Block @Override @SuppressWarnings("unchecked") public final void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB aAABB, - List<AxisAlignedBB> aList, Entity aEntity) { + List<AxisAlignedBB> aList, Entity aEntity) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (aTileEntity instanceof IMultiTileEntity) ((IMultiTileEntity) aTileEntity).addCollisionBoxesToList(aAABB, aList, aEntity); @@ -255,16 +255,16 @@ public class MultiTileEntityBlock extends Block public final AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity).getCollisionBoundingBoxFromPool() - : aTileEntity == null ? null : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + ? ((IMultiTileEntity) aTileEntity).getCollisionBoundingBoxFromPool() + : aTileEntity == null ? null : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } @Override public final AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity).getSelectedBoundingBoxFromPool() - : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); + ? ((IMultiTileEntity) aTileEntity).getSelectedBoundingBoxFromPool() + : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); } @Override @@ -284,7 +284,7 @@ public class MultiTileEntityBlock extends Block @Override public final void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, - int aTileZ) { + int aTileZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!LOCK) { LOCK = true; @@ -317,8 +317,8 @@ public class MultiTileEntityBlock extends Block public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity) aTileEntity).privateAccess() - && !((IMultiTileEntity) aTileEntity).playerOwnsThis(aPlayer, true) ? -1.0F - : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); + && !((IMultiTileEntity) aTileEntity).playerOwnsThis(aPlayer, true) ? -1.0F + : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); } @Override @@ -330,42 +330,42 @@ public class MultiTileEntityBlock extends Block @Override public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float aHitX, - float aHitY, float aHitZ) { + float aHitY, float aHitZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (aPlayer != null && ItemList.TC_Thaumometer.isStackEqual(aPlayer.getHeldItem(), true, true)) return false; return aTileEntity instanceof IMultiTileEntity - && ((IMultiTileEntity) aTileEntity).onBlockActivated(aPlayer, (byte) aSide, aHitX, aHitY, aHitZ); + && ((IMultiTileEntity) aTileEntity).onBlockActivated(aPlayer, (byte) aSide, aHitX, aHitY, aHitZ); } @Override public final int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_IsProvidingWeakPower - ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower((byte) aSide) - : super.isProvidingWeakPower(aWorld, aX, aY, aZ, aSide); + ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower((byte) aSide) + : super.isProvidingWeakPower(aWorld, aX, aY, aZ, aSide); } @Override public final int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_IsProvidingStrongPower - ? ((IMTE_IsProvidingStrongPower) aTileEntity).isProvidingStrongPower((byte) aSide) - : super.isProvidingStrongPower(aWorld, aX, aY, aZ, aSide); + ? ((IMTE_IsProvidingStrongPower) aTileEntity).isProvidingStrongPower((byte) aSide) + : super.isProvidingStrongPower(aWorld, aX, aY, aZ, aSide); } @Override public final boolean shouldCheckWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_ShouldCheckWeakPower - ? ((IMTE_ShouldCheckWeakPower) aTileEntity).shouldCheckWeakPower((byte) aSide) - : isNormalCube(aWorld, aX, aY, aZ); + ? ((IMTE_ShouldCheckWeakPower) aTileEntity).shouldCheckWeakPower((byte) aSide) + : isNormalCube(aWorld, aX, aY, aZ); } @Override public final boolean getWeakChanges(IBlockAccess aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_GetWeakChanges ? ((IMTE_GetWeakChanges) aTileEntity).getWeakChanges() - : super.getWeakChanges(aWorld, aX, aY, aZ); + : super.getWeakChanges(aWorld, aX, aY, aZ); } @Override @@ -379,18 +379,8 @@ public class MultiTileEntityBlock extends Block final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity instanceof IMultiTileEntity) { final ArrayList<ItemStack> tList = ((IMultiTileEntity) aTileEntity).getDrops(aFortune, aSilkTouch); - aChance = ForgeEventFactory.fireBlockHarvesting( - tList, - aWorld, - this, - aX, - aY, - aZ, - aMeta, - aFortune, - aChance, - aSilkTouch, - aPlayer); + aChance = ForgeEventFactory + .fireBlockHarvesting(tList, aWorld, this, aX, aY, aZ, aMeta, aFortune, aChance, aSilkTouch, aPlayer); for (ItemStack tStack : tList) if (XSTR.XSTR_INSTANCE.nextFloat() <= aChance) dropBlockAsItem(aWorld, aX, aY, aZ, tStack); } @@ -437,8 +427,8 @@ public class MultiTileEntityBlock extends Block public final boolean shouldSideBeRendered(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX - OFFX[aSide], aY - OFFY[aSide], aZ - OFFZ[aSide]); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity).shouldSideBeRendered((byte) aSide) - : super.shouldSideBeRendered(aWorld, aX, aY, aZ, aSide); + ? ((IMultiTileEntity) aTileEntity).shouldSideBeRendered((byte) aSide) + : super.shouldSideBeRendered(aWorld, aX, aY, aZ, aSide); } @Override @@ -448,14 +438,14 @@ public class MultiTileEntityBlock extends Block final byte aSide = (byte) side; if (side != -1) { final Block facadeBlock = tile.getCoverInfoAtSide(aSide) - .getFacadeBlock(); + .getFacadeBlock(); if (facadeBlock != null) return facadeBlock; } else { // we do not allow more than one type of facade per block, so no need to check every side // see comment in gregtech.common.covers.GT_Cover_FacadeBase.isCoverPlaceable for (byte tSide : ALL_VALID_SIDES) { final Block facadeBlock = tile.getCoverInfoAtSide(tSide) - .getFacadeBlock(); + .getFacadeBlock(); if (facadeBlock != null) { return facadeBlock; } @@ -529,11 +519,10 @@ public class MultiTileEntityBlock extends Block public final int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMTE_GetComparatorInputOverride - ? ((IMTE_GetComparatorInputOverride) aTileEntity).getComparatorInputOverride((byte) aSide) - : aTileEntity instanceof IMTE_IsProvidingWeakPower - ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower( - GT_Utility.getOppositeSide(aSide)) - : super.getComparatorInputOverride(aWorld, aX, aY, aZ, aSide); + ? ((IMTE_GetComparatorInputOverride) aTileEntity).getComparatorInputOverride((byte) aSide) + : aTileEntity instanceof IMTE_IsProvidingWeakPower + ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower(GT_Utility.getOppositeSide(aSide)) + : super.getComparatorInputOverride(aWorld, aX, aY, aZ, aSide); } @Override @@ -550,9 +539,9 @@ public class MultiTileEntityBlock extends Block public final boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity).isSideSolid( - (byte) (aSide != null ? aSide.ordinal() : GT_Values.SIDE_UNKNOWN)) - : mOpaque; + ? ((IMultiTileEntity) aTileEntity) + .isSideSolid((byte) (aSide != null ? aSide.ordinal() : GT_Values.SIDE_UNKNOWN)) + : mOpaque; } @Override @@ -579,7 +568,7 @@ public class MultiTileEntityBlock extends Block @Override public final ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aUnusableMetaData, - int aFortune) { + int aFortune) { final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity instanceof IMultiTileEntity) return ((IMultiTileEntity) aTileEntity).getDrops(aFortune, false); return new ArrayList<>(); @@ -592,15 +581,11 @@ public class MultiTileEntityBlock extends Block @Override public final float getExplosionResistance(Entity aExploder, World aWorld, int aX, int aY, int aZ, - double aExplosionX, double aExplosionY, double aExplosionZ) { + double aExplosionX, double aExplosionY, double aExplosionZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity).getExplosionResistance( - aExploder, - aExplosionX, - aExplosionY, - aExplosionZ) - : 1.0F; + ? ((IMultiTileEntity) aTileEntity).getExplosionResistance(aExploder, aExplosionX, aExplosionY, aExplosionZ) + : 1.0F; } @Override @@ -610,11 +595,11 @@ public class MultiTileEntityBlock extends Block if (aTileEntity != null) LAST_BROKEN_TILEENTITY.set(aTileEntity); if (aTileEntity instanceof IMultiTileEntity) { GT_Log.exp.printf( - "Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", - aX, - aY, - aZ, - aWorld.provider.dimensionId); + "Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", + aX, + aY, + aZ, + aWorld.provider.dimensionId); ((IMultiTileEntity) aTileEntity).onExploded(aExplosion); } else aWorld.setBlockToAir(aX, aY, aZ); } @@ -628,7 +613,7 @@ public class MultiTileEntityBlock extends Block public final boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - && ((IMultiTileEntity) aTileEntity).recolourBlock((byte) aSide.ordinal(), (byte) aColor); + && ((IMultiTileEntity) aTileEntity).recolourBlock((byte) aSide.ordinal(), (byte) aColor); } @Override @@ -648,7 +633,7 @@ public class MultiTileEntityBlock extends Block @Override public final ItemStack getPickBlock(MovingObjectPosition aTarget, World aWorld, int aX, int aY, int aZ, - EntityPlayer aPlayer) { + EntityPlayer aPlayer) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getPickBlock(aTarget) : null; } @@ -660,13 +645,13 @@ public class MultiTileEntityBlock extends Block } public final IMultiTileEntity receiveMultiTileEntityData(IBlockAccess aWorld, int aX, short aY, int aZ, short aRID, - short aID) { + short aID) { if (!(aWorld instanceof World)) return null; TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(aTileEntity instanceof IMultiTileEntity) - || ((IMultiTileEntity) aTileEntity).getMultiTileEntityRegistryID() != aRID - || ((IMultiTileEntity) aTileEntity).getMultiTileEntityID() != aID) { + || ((IMultiTileEntity) aTileEntity).getMultiTileEntityRegistryID() != aRID + || ((IMultiTileEntity) aTileEntity).getMultiTileEntityID() != aID) { final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(aRID); if (tRegistry == null) return null; @@ -679,7 +664,7 @@ public class MultiTileEntityBlock extends Block } public void receiveCoverData(IMultiTileEntity mte, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, - int aCover5) { + int aCover5) { boolean updated; updated = mte.setCoverIDAtSideNoUpdate((byte) 0, aCover0); updated |= mte.setCoverIDAtSideNoUpdate((byte) 1, aCover1); diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java index 91855aae55..ec24654a1c 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java @@ -50,14 +50,9 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc } public boolean placeBlock(World aWorld, int aX, int aY, int aZ, byte aSide, short aMetaData, NBTTagCompound aNBT, - boolean aCauseBlockUpdates, boolean aForcePlacement) { - final MultiTileEntityContainer aMTEContainer = mMultiTileEntityRegistry.getNewTileEntityContainer( - aWorld, - aX, - aY, - aZ, - aMetaData, - aNBT); + boolean aCauseBlockUpdates, boolean aForcePlacement) { + final MultiTileEntityContainer aMTEContainer = mMultiTileEntityRegistry + .getNewTileEntityContainer(aWorld, aX, aY, aZ, aMetaData, aNBT); if (aMTEContainer == null) return false; final Block tReplacedBlock = aWorld.getBlock(aX, aY, aZ); @@ -90,8 +85,8 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData) { - if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData()) - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) + .hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { GT_FML_LOGGER.error("causeMachineUpdate", e); diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java index 593a3c46e7..4e4be793b1 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java @@ -32,7 +32,7 @@ public class MultiTileEntityClassContainer { public boolean mHidden = false; public MultiTileEntityClassContainer(MultiTileEntityRegistry aRegistry, int aID, - Class<? extends MultiTileEntity> aClass) { + Class<? extends MultiTileEntity> aClass) { /* Start the Builder */ mRegistry = new WeakReference<>(aRegistry); mID = (short) aID; @@ -45,10 +45,10 @@ public class MultiTileEntityClassContainer { final MultiTileEntityRegistry registry = mRegistry.get(); if (mParameters.hasKey(NBT.MATERIAL) && !mParameters.hasKey(NBT.COLOR)) mParameters.setInteger( - NBT.COLOR, - GT_Util.getRGBInt( - Materials.get(mParameters.getString(NBT.MATERIAL)) - .getRGBA())); + NBT.COLOR, + GT_Util.getRGBInt( + Materials.get(mParameters.getString(NBT.MATERIAL)) + .getRGBA())); try { mCanonicalTileEntity = mClass.newInstance(); @@ -162,7 +162,7 @@ public class MultiTileEntityClassContainer { // Check if cls is extended by mClass if (!cls.isAssignableFrom(mClass)) { throw new IllegalArgumentException( - "Expected a descendent of " + cls.getName() + " got " + mClass.getName() + " instead."); + "Expected a descendent of " + cls.getName() + " got " + mClass.getName() + " instead."); } } @@ -183,7 +183,7 @@ public class MultiTileEntityClassContainer { if (!atLeastOne) { throw new IllegalArgumentException( - "Expected a descendent of any of these " + classNames + " got " + mClass.getName() + " instead."); + "Expected a descendent of any of these " + classNames + " got " + mClass.getName() + " instead."); } } } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java index 1f3c2dd5ca..a37fa9956e 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java @@ -50,8 +50,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override @SuppressWarnings("unchecked") public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List<String> aList, boolean aF3_H) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer == null) { aList.add("INVALID ITEM!"); return; @@ -74,12 +74,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void getSubItems(Item aItem, CreativeTabs aTab, List<ItemStack> aList) { for (MultiTileEntityClassContainer tClass : mBlock.mMultiTileEntityRegistry.mRegistrations) { if (!tClass.mHidden) { - if (((IMultiTileEntity) tClass.mCanonicalTileEntity).getSubItems( - mBlock, - aItem, - aTab, - aList, - tClass.mID)) { + if (((IMultiTileEntity) tClass.mCanonicalTileEntity) + .getSubItems(mBlock, aItem, aTab, aList, tClass.mID)) { aList.add(mBlock.mMultiTileEntityRegistry.getItem(tClass.mID)); } } @@ -88,91 +84,70 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, - float aHitX, float aHitY, float aHitZ) { + float aHitX, float aHitY, float aHitZ) { if (aY < 0 || aY > aWorld.getHeight()) return false; try { final Block tClickedBlock = aWorld.getBlock(aX, aY, aZ); if (tClickedBlock instanceof BlockSnow && (aWorld.getBlockMetadata(aX, aY, aZ) & 7) < 1) { aSide = SIDE_TOP; } else if (tClickedBlock != Blocks.vine && tClickedBlock != Blocks.tallgrass - && tClickedBlock != Blocks.deadbush - && !tClickedBlock.isReplaceable(aWorld, aX, aY, aZ)) { - aX += GT_Values.OFFX[aSide]; - aY += GT_Values.OFFY[aSide]; - aZ += GT_Values.OFFZ[aSide]; - } + && tClickedBlock != Blocks.deadbush + && !tClickedBlock.isReplaceable(aWorld, aX, aY, aZ)) { + aX += GT_Values.OFFX[aSide]; + aY += GT_Values.OFFY[aSide]; + aZ += GT_Values.OFFZ[aSide]; + } final Block tReplacedBlock = aWorld.getBlock(aX, aY, aZ); if (!tReplacedBlock.isReplaceable(aWorld, aX, aY, aZ) - || !mBlock.canReplace(aWorld, aX, aY, aZ, aSide, aStack)) - return false; + || !mBlock.canReplace(aWorld, aX, aY, aZ, aSide, aStack)) return false; if (aStack.stackSize == 0 || (aPlayer != null && !aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) return false; - final MultiTileEntityContainer aMTEContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aWorld, - aX, - aY, - aZ, - aStack); + final MultiTileEntityContainer aMTEContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aWorld, aX, aY, aZ, aStack); - if (aMTEContainer != null && (aPlayer == null || aPlayer.isSneaking() + if (aMTEContainer != null + && (aPlayer == null || aPlayer.isSneaking() || !(aMTEContainer.mTileEntity instanceof IMTE_OnlyPlaceableWhenSneaking) || !((IMTE_OnlyPlaceableWhenSneaking) aMTEContainer.mTileEntity).onlyPlaceableWhenSneaking()) - && (aWorld.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1)) - || (aMTEContainer.mTileEntity instanceof IMTE_IgnoreEntityCollisionWhenPlacing - && ((IMTE_IgnoreEntityCollisionWhenPlacing) aMTEContainer.mTileEntity).ignoreEntityCollisionWhenPlacing( - aStack, - aPlayer, - aWorld, - aX, - aY, - aZ, - (byte) aSide, - aHitX, - aHitY, - aHitZ))) - && (!(aMTEContainer.mTileEntity instanceof IMTE_CanPlace) - || ((IMTE_CanPlace) aMTEContainer.mTileEntity).canPlace( - aStack, - aPlayer, - aWorld, - aX, - aY, - aZ, - (byte) aSide, - aHitX, - aHitY, - aHitZ)) - && aWorld.setBlock(aX, aY, aZ, aMTEContainer.mBlock, 15 - aMTEContainer.mBlockMetaData, 2)) { + && (aWorld.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1)) + || (aMTEContainer.mTileEntity instanceof IMTE_IgnoreEntityCollisionWhenPlacing + && ((IMTE_IgnoreEntityCollisionWhenPlacing) aMTEContainer.mTileEntity) + .ignoreEntityCollisionWhenPlacing( + aStack, + aPlayer, + aWorld, + aX, + aY, + aZ, + (byte) aSide, + aHitX, + aHitY, + aHitZ))) + && (!(aMTEContainer.mTileEntity instanceof IMTE_CanPlace) || ((IMTE_CanPlace) aMTEContainer.mTileEntity) + .canPlace(aStack, aPlayer, aWorld, aX, aY, aZ, (byte) aSide, aHitX, aHitY, aHitZ)) + && aWorld.setBlock(aX, aY, aZ, aMTEContainer.mBlock, 15 - aMTEContainer.mBlockMetaData, 2)) { aMTEContainer.setMultiTile(aWorld, aX, aY, aZ); try { - if (((IMultiTileEntity) aMTEContainer.mTileEntity).onPlaced( - aStack, - aPlayer, - aWorld, - aX, - aY, - aZ, - (byte) aSide, - aHitX, - aHitY, - aHitZ)) { + if (((IMultiTileEntity) aMTEContainer.mTileEntity) + .onPlaced(aStack, aPlayer, aWorld, aX, aY, aZ, (byte) aSide, aHitX, aHitY, aHitZ)) { aWorld.playSoundEffect( - aX + 0.5, - aY + 0.5, - aZ + 0.5, - aMTEContainer.mBlock.stepSound.func_150496_b(), - (aMTEContainer.mBlock.stepSound.getVolume() + 1) / 2, - aMTEContainer.mBlock.stepSound.getPitch() * 0.8F); + aX + 0.5, + aY + 0.5, + aZ + 0.5, + aMTEContainer.mBlock.stepSound.func_150496_b(), + (aMTEContainer.mBlock.stepSound.getVolume() + 1) / 2, + aMTEContainer.mBlock.stepSound.getPitch() * 0.8F); } } catch (Throwable e) { GT_FML_LOGGER.error("onPlaced", e); } try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData - && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData())) { + && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) + .hasMultiBlockMachineRelevantData())) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { @@ -210,8 +185,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack); } @@ -221,8 +196,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack, World aWorld, int aX, int aY, int aZ) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack, aWorld, aX, aY, aZ); } @@ -232,12 +207,11 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public int getItemStackLimit(ItemStack aStack) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return 1; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IMTE_GetMaxStackSize) { - return ((IMTE_GetMaxStackSize) tTileEntityContainer.mTileEntity).getMaxStackSize( - aStack, - tContainer.mStackSize); + return ((IMTE_GetMaxStackSize) tTileEntityContainer.mTileEntity) + .getMaxStackSize(aStack, tContainer.mStackSize); } return tContainer.mStackSize; } @@ -249,8 +223,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public FluidStack getFluid(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getFluid(aStack); updateItemStack(aStack); @@ -261,8 +235,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int getCapacity(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int rCapacity = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getCapacity(aStack); updateItemStack(aStack); @@ -273,8 +247,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int fill(ItemStack aStack, FluidStack aFluid, boolean aDoFill) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int tFilled = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).fill(aStack, aFluid, aDoFill); updateItemStack(aStack); @@ -285,13 +259,11 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public FluidStack drain(ItemStack aStack, int aMaxDrain, boolean aDoDrain) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( - aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { - final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).drain( - aStack, - aMaxDrain, - aDoDrain); + final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity) + .drain(aStack, aMaxDrain, aDoDrain); updateItemStack(aStack); return rFluid; } @@ -300,7 +272,7 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public boolean func_150936_a /* canPlaceAtSide */(World aWorld, int aX, int aY, int aZ, int aSide, - EntityPlayer aPlayer, ItemStack aStack) { + EntityPlayer aPlayer, ItemStack aStack) { return true; } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java index 1aeed1b3de..1c425106b5 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java @@ -47,7 +47,7 @@ public class MultiTileEntityRegistry { public final MultiTileEntityBlockInternal mBlock; private static MultiTileEntityBlockInternal regblock(String aNameInternal, MultiTileEntityBlockInternal aBlock, - Class<? extends ItemBlock> aItemClass) { + Class<? extends ItemBlock> aItemClass) { GameRegistry.registerBlock(aBlock, aItemClass == null ? ItemBlock.class : aItemClass, aNameInternal); return aBlock; } @@ -63,7 +63,7 @@ public class MultiTileEntityRegistry { * @param aNameInternal the internal Name of the Item */ public MultiTileEntityRegistry(String aNameInternal, MultiTileEntityBlockInternal aBlock, - Class<? extends ItemBlock> aItemClass) { + Class<? extends ItemBlock> aItemClass) { this(aNameInternal, regblock(aNameInternal, aBlock, aItemClass)); } @@ -72,7 +72,7 @@ public class MultiTileEntityRegistry { */ public MultiTileEntityRegistry(String aNameInternal, MultiTileEntityBlockInternal aBlock) { if (!GregTech_API.sPreloadStarted || GregTech_API.sPreloadFinished) throw new IllegalStateException( - "The MultiTileEntity Registry must be initialised during Preload Phase and not before"); + "The MultiTileEntity Registry must be initialised during Preload Phase and not before"); mNameInternal = aNameInternal; mBlock = aBlock; GT_FML_LOGGER.info(aNameInternal + " " + Block.getIdFromBlock(aBlock) + "This is the answer"); @@ -129,8 +129,7 @@ public class MultiTileEntityRegistry { } if (mRegistry.containsKey(aClassContainer.mID)) { GT_FML_LOGGER.error( - "MULTI-TILE REGISTRY ERROR: Class Container uses occupied MetaData! (" + aClassContainer.mID - + ")"); + "MULTI-TILE REGISTRY ERROR: Class Container uses occupied MetaData! (" + aClassContainer.mID + ")"); tFailed = true; } } @@ -138,18 +137,14 @@ public class MultiTileEntityRegistry { GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: STACKTRACE START"); int i = 0; for (StackTraceElement tElement : new Exception().getStackTrace()) if (i++ < 5 && !tElement.getClassName() - .startsWith( - "sun")) - GT_FML_LOGGER.error("\tat " + tElement); + .startsWith("sun")) GT_FML_LOGGER.error("\tat " + tElement); else break; GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: STACKTRACE END"); return null; } - GT_LanguageManager.addStringLocalization( - mNameInternal + "." + aClassContainer.mID + ".name", - aLocalised, - false); + GT_LanguageManager + .addStringLocalization(mNameInternal + "." + aClassContainer.mID + ".name", aLocalised, false); mRegistry.put(aClassContainer.mID, aClassContainer); mLastRegisteredID = aClassContainer.mID; mRegistrations.add(aClassContainer); @@ -223,22 +218,22 @@ public class MultiTileEntityRegistry { } public MultiTileEntityContainer getNewTileEntityContainer(World aWorld, int aX, int aY, int aZ, int aID, - NBTTagCompound aNBT) { + NBTTagCompound aNBT) { final MultiTileEntityClassContainer tClass = mRegistry.get((short) aID); if (tClass == null || tClass.mBlock == null) return null; final MultiTileEntityContainer rContainer = new MultiTileEntityContainer( - (TileEntity) GT_Utility.callConstructor(tClass.mClass, -1, null, true), - tClass.mBlock, - tClass.mBlockMetaData); + (TileEntity) GT_Utility.callConstructor(tClass.mClass, -1, null, true), + tClass.mBlock, + tClass.mBlockMetaData); if (rContainer.mTileEntity == null) return null; rContainer.mTileEntity.setWorldObj(aWorld); rContainer.mTileEntity.xCoord = aX; rContainer.mTileEntity.yCoord = aY; rContainer.mTileEntity.zCoord = aZ; ((IMultiTileEntity) rContainer.mTileEntity).initFromNBT( - aNBT == null || aNBT.hasNoTags() ? tClass.mParameters : GT_Util.fuseNBT(aNBT, tClass.mParameters), - (short) aID, - (short) Block.getIdFromBlock(mBlock)); + aNBT == null || aNBT.hasNoTags() ? tClass.mParameters : GT_Util.fuseNBT(aNBT, tClass.mParameters), + (short) aID, + (short) Block.getIdFromBlock(mBlock)); return rContainer; } @@ -249,23 +244,23 @@ public class MultiTileEntityRegistry { public TileEntity getNewTileEntity(ItemStack aStack) { final MultiTileEntityContainer tContainer = getNewTileEntityContainer( - null, - 0, - 0, - 0, - Items.feather.getDamage(aStack), - aStack.getTagCompound()); + null, + 0, + 0, + 0, + Items.feather.getDamage(aStack), + aStack.getTagCompound()); return tContainer == null ? null : tContainer.mTileEntity; } public TileEntity getNewTileEntity(World aWorld, int aX, int aY, int aZ, ItemStack aStack) { final MultiTileEntityContainer tContainer = getNewTileEntityContainer( - aWorld, - aX, - aY, - aZ, - Items.feather.getDamage(aStack), - aStack.getTagCompound()); + aWorld, + aX, + aY, + aZ, + Items.feather.getDamage(aStack), + aStack.getTagCompound()); return tContainer == null ? null : tContainer.mTileEntity; } diff --git a/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java index bff998aa89..2ef1042a01 100644 --- a/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java @@ -129,17 +129,16 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu // Loading the registry final String textureName = nbt.getString(NBT.TEXTURE); textures = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/top"), - new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/side"), }; + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/side"), }; } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( - getMultiTileEntityRegistryID(), - getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiTileEntity) textures = ((MultiTileEntity) tCanonicalTileEntity).textures; } @@ -168,7 +167,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (nbt.hasKey("z")) zCoord = nbt.getInteger("z"); // read the custom Name. if (nbt.hasKey(NBT.DISPAY)) customName = nbt.getCompoundTag(NBT.DISPAY) - .getString(NBT.CUSTOM_NAME); + .getString(NBT.CUSTOM_NAME); // And now everything else. try { @@ -267,8 +266,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public TileEntity getTileEntity(int aX, int aY, int aZ) { if (worldObj == null - || (ignoreUnloadedChunks && crossedChunkBorder(aX, aZ) && !worldObj.blockExists(aX, aY, aZ))) - return null; + || (ignoreUnloadedChunks && crossedChunkBorder(aX, aZ) && !worldObj.blockExists(aX, aY, aZ))) return null; return GT_Util.getTileEntity(worldObj, aX, aY, aZ, true); } @@ -279,7 +277,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public boolean shouldRefresh(Block aOldBlock, Block aNewBlock, int aOldMeta, int aNewMeta, World aWorld, int aX, - int aY, int aZ) { + int aY, int aZ) { return shouldRefresh || aOldBlock != aNewBlock; } @@ -294,16 +292,16 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, tBlock); if (this instanceof IMTE_IsProvidingStrongPower) for (byte tSide : GT_Values.ALL_VALID_SIDES) { if (getBlockAtSide(tSide).isNormalCube( - worldObj, + worldObj, + xCoord + GT_Values.OFFX[tSide], + yCoord + GT_Values.OFFY[tSide], + zCoord + GT_Values.OFFZ[tSide])) { + worldObj.notifyBlocksOfNeighborChange( xCoord + GT_Values.OFFX[tSide], yCoord + GT_Values.OFFY[tSide], - zCoord + GT_Values.OFFZ[tSide])) { - worldObj.notifyBlocksOfNeighborChange( - xCoord + GT_Values.OFFX[tSide], - yCoord + GT_Values.OFFY[tSide], - zCoord + GT_Values.OFFZ[tSide], - tBlock, - OPOS[tSide]); + zCoord + GT_Values.OFFZ[tSide], + tBlock, + OPOS[tSide]); } } needsBlockUpdate = false; @@ -315,7 +313,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu // TODO: check to an interface // if (getBlockAtSide(aSide) == Blocks.glass) return false; return tTileEntity instanceof IMultiTileEntity ? !((IMultiTileEntity) tTileEntity).isSurfaceOpaque(OPOS[aSide]) - : !getBlockAtSide(aSide).isOpaqueCube(); + : !getBlockAtSide(aSide).isOpaqueCube(); } @Override @@ -487,16 +485,16 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public AxisAlignedBB box(double[] aBox) { return AxisAlignedBB.getBoundingBox( - xCoord + aBox[0], - yCoord + aBox[1], - zCoord + aBox[2], - xCoord + aBox[3], - yCoord + aBox[4], - zCoord + aBox[5]); + xCoord + aBox[0], + yCoord + aBox[1], + zCoord + aBox[2], + xCoord + aBox[3], + yCoord + aBox[4], + zCoord + aBox[5]); } public boolean box(AxisAlignedBB aAABB, List<AxisAlignedBB> aList, double aMinX, double aMinY, double aMinZ, - double aMaxX, double aMaxY, double aMaxZ) { + double aMaxX, double aMaxY, double aMaxZ) { final AxisAlignedBB tBox = box(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ); return tBox.intersectsWith(aAABB) && aList.add(tBox); } @@ -508,12 +506,12 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public AxisAlignedBB box(double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, double aMaxZ) { return AxisAlignedBB.getBoundingBox( - xCoord + aMinX, - yCoord + aMinY, - zCoord + aMinZ, - xCoord + aMaxX, - yCoord + aMaxY, - zCoord + aMaxZ); + xCoord + aMinX, + yCoord + aMinY, + zCoord + aMinZ, + xCoord + aMaxX, + yCoord + aMaxY, + zCoord + aMaxZ); } @Override @@ -543,12 +541,12 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public AxisAlignedBB box(float[] aBox) { return AxisAlignedBB.getBoundingBox( - xCoord + aBox[0], - yCoord + aBox[1], - zCoord + aBox[2], - xCoord + aBox[3], - yCoord + aBox[4], - zCoord + aBox[5]); + xCoord + aBox[0], + yCoord + aBox[1], + zCoord + aBox[2], + xCoord + aBox[3], + yCoord + aBox[4], + zCoord + aBox[5]); } public boolean box(Block aBlock) { @@ -572,12 +570,12 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public boolean box(Block aBlock, double[] aBox) { aBlock.setBlockBounds( - (float) aBox[0], - (float) aBox[1], - (float) aBox[2], - (float) aBox[3], - (float) aBox[4], - (float) aBox[5]); + (float) aBox[0], + (float) aBox[1], + (float) aBox[2], + (float) aBox[3], + (float) aBox[4], + (float) aBox[5]); return true; } @@ -598,7 +596,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } public boolean box(Block aBlock, double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, - double aMaxZ) { + double aMaxZ) { aBlock.setBlockBounds((float) aMinX, (float) aMinY, (float) aMinZ, (float) aMaxX, (float) aMaxY, (float) aMaxZ); return true; } @@ -701,7 +699,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public boolean onPlaced(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, - float aHitX, float aHitY, float aHitZ) { + float aHitX, float aHitY, float aHitZ) { facing = getSideForPlayerPlacing(aPlayer, facing, getValidFacings()); onFacingChange(); return true; @@ -733,7 +731,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) - : aSide; + : aSide; return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; @@ -743,13 +741,13 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } if (isServerSide()) { if (!privateAccess() || aPlayer.getDisplayName() - .equalsIgnoreCase(getOwnerName())) { + .equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); final byte wrenchSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (tCurrentItem != null) { if (getColorization() >= 0 - && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { // TODO (Colorization) } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) @@ -770,18 +768,18 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) - && allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { + .isCoverPlaceable(coverSide, tCurrentItem, this) + && allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.IC2_TOOLS_WRENCH, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); issueClientUpdate(); } sendCoverDataIfNeeded(); @@ -791,13 +789,13 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers( - worldObj, - SoundResource.RANDOM_BREAK, - 1.0F, - -1, - xCoord, - yCoord, - zCoord); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); } sendCoverDataIfNeeded(); @@ -806,25 +804,24 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } } else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config if possible. aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) - : aSide; + : aSide; return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this, - aPlayer); - } - - if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick( aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, - aPlayer, - aX, - aY, - aZ)) - return true; + aPlayer); + } + + if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)) return true; if (!getCoverInfoAtSide(aSide).isGUIClickable()) return false; @@ -850,7 +847,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } public boolean onWrenchRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, - float aZ) { + float aZ) { if (setMainFacing(wrenchSide)) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); @@ -859,19 +856,19 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } public boolean onScrewdriverRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, - float aY, float aZ) { + float aY, float aZ) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { setCoverDataAtSide( + wrenchSide, + getCoverBehaviorAtSideNew(wrenchSide).onCoverScrewdriverClick( wrenchSide, - getCoverBehaviorAtSideNew(wrenchSide).onCoverScrewdriverClick( - wrenchSide, - getCoverIDAtSide(wrenchSide), - getComplexCoverDataAtSide(wrenchSide), - this, - aPlayer, - aX, - aY, - aZ)); + getCoverIDAtSide(wrenchSide), + getComplexCoverDataAtSide(wrenchSide), + this, + aPlayer, + aX, + aY, + aZ)); // TODO: Update connections! GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } @@ -879,25 +876,25 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu } public boolean onHammerRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, - float aZ) { + float aZ) { return true; } public boolean onMalletRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, - float aZ) { + float aZ) { return true; } public boolean onSolderingRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, - float aY, float aZ) { + float aY, float aZ) { return true; } public boolean onWireCutterRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, - float aY, float aZ) { + float aY, float aZ) { return true; } @@ -932,7 +929,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public boolean getSubItems(MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, - List<ItemStack> aList, short aID) { + List<ItemStack> aList, short aID) { return true; } @@ -957,9 +954,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); } else return !privateAccess() || aPlayer.getDisplayName() - .equals("Player") - || ownerName.equals("Player") - || ownerName.equals(aPlayer.getDisplayName()); + .equals("Player") || ownerName.equals("Player") || ownerName.equals(aPlayer.getDisplayName()); return true; } @@ -974,29 +969,29 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public GT_Packet_MultiTileEntity getClientDataPacket() { final GT_Packet_MultiTileEntity packet = new GT_Packet_MultiTileEntity( - 0, - xCoord, - (short) yCoord, - zCoord, - getMultiTileEntityRegistryID(), - getMultiTileEntityID(), - (byte) ((facing & 7) | (mRedstone ? 16 : 0)), - color); + 0, + xCoord, + (short) yCoord, + zCoord, + getMultiTileEntityRegistryID(), + getMultiTileEntityID(), + (byte) ((facing & 7) | (mRedstone ? 16 : 0)), + color); packet.setCoverData( - getCoverInfoAtSide((byte) 0).getCoverID(), - getCoverInfoAtSide((byte) 1).getCoverID(), - getCoverInfoAtSide((byte) 2).getCoverID(), - getCoverInfoAtSide((byte) 3).getCoverID(), - getCoverInfoAtSide((byte) 4).getCoverID(), - getCoverInfoAtSide((byte) 5).getCoverID()); + getCoverInfoAtSide((byte) 0).getCoverID(), + getCoverInfoAtSide((byte) 1).getCoverID(), + getCoverInfoAtSide((byte) 2).getCoverID(), + getCoverInfoAtSide((byte) 3).getCoverID(), + getCoverInfoAtSide((byte) 4).getCoverID(), + getCoverInfoAtSide((byte) 5).getCoverID()); packet.setRedstoneData( - (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) - | ((mSidedRedstone[2] > 0) ? 4 : 0) - | ((mSidedRedstone[3] > 0) ? 8 : 0) - | ((mSidedRedstone[4] > 0) ? 16 : 0) - | ((mSidedRedstone[5] > 0) ? 32 : 0))); + (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0))); return packet; } @@ -1068,18 +1063,18 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); currenttip.add( - String.format( - "Facing: %s", - ForgeDirection.getOrientation(getFrontFacing()) - .name())); + String.format( + "Facing: %s", + ForgeDirection.getOrientation(getFrontFacing()) + .name())); } @Override public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, - int z) { + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); } @@ -1093,13 +1088,13 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 2) { tList.add( - "MultiTileRegistry-ID: " + EnumChatFormatting.BLUE - + mteRegistry - + EnumChatFormatting.RESET - + " MultiTile-ID: " - + EnumChatFormatting.BLUE - + mteID - + EnumChatFormatting.RESET); + "MultiTileRegistry-ID: " + EnumChatFormatting.BLUE + + mteRegistry + + EnumChatFormatting.RESET + + " MultiTile-ID: " + + EnumChatFormatting.BLUE + + mteID + + EnumChatFormatting.RESET); } if (joinedIc2Enet) tList.add("Joined IC2 ENet"); @@ -1150,9 +1145,9 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (aFluid == null || aFluid.amount <= 0) return null; final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), aFluid); if (tTank == null || tTank.getFluid() == null - || tTank.getFluidAmount() == 0 - || !tTank.getFluid() - .isFluidEqual(aFluid)) + || tTank.getFluidAmount() == 0 + || !tTank.getFluid() + .isFluidEqual(aFluid)) return null; return tTank.drain(aFluid.amount, aDoDrain); } @@ -1170,8 +1165,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (aFluid == null) return false; final IFluidTank tTank = getFluidTankFillable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() == null || tTank.getFluid() - .getFluid() - == aFluid); + .getFluid() == aFluid); } @Override @@ -1179,8 +1173,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (aFluid == null) return false; final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() != null && tTank.getFluid() - .getFluid() - == aFluid); + .getFluid() == aFluid); } @Override diff --git a/src/main/java/gregtech/api/multitileentity/base/NonTickableMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/NonTickableMultiTileEntity.java index a4007ec85e..90c931239a 100644 --- a/src/main/java/gregtech/api/multitileentity/base/NonTickableMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/NonTickableMultiTileEntity.java @@ -50,7 +50,7 @@ public abstract class NonTickableMultiTileEntity extends MultiTileEntity { @Override public void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData, - EntityPlayerMP aPlayer) { + EntityPlayerMP aPlayer) { super.receiveCoverData(aCoverSide, aCoverID, aCoverData, aPlayer); // We don't get ticked so issue the texture update right away issueTextureUpdate(); diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java index 37a3749c8f..b42aa35195 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java @@ -29,8 +29,8 @@ import gregtech.api.multitileentity.MultiTileEntityRegistry; * Heavily inspired by GT6 */ public interface IMultiTileEntity - extends IHasWorldObjectAndCoords, ICoverable, ITurnable, IHasInventory, IEnergyConnected, IBasicEnergyContainer, - IFluidHandler, ITexturedTileEntity, IDebugableTileEntity, IColoredTileEntity { + extends IHasWorldObjectAndCoords, ICoverable, ITurnable, IHasInventory, IEnergyConnected, IBasicEnergyContainer, + IFluidHandler, ITexturedTileEntity, IDebugableTileEntity, IColoredTileEntity { /** * Those two IDs HAVE to be saved inside the NBT of the TileEntity itself. They get set by the Registry itself, when @@ -173,7 +173,7 @@ public interface IMultiTileEntity /** Adds to the Creative Tab. return false to prevent it from being added. */ boolean getSubItems(MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, List<ItemStack> aList, - short aID); + short aID); ItemStack getPickBlock(MovingObjectPosition aTarget); @@ -182,7 +182,7 @@ public interface IMultiTileEntity boolean isSurfaceOpaque(byte aSide); boolean onPlaced(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, - float aHitX, float aHitY, float aHitZ); + float aHitX, float aHitY, float aHitZ); // ItemStack getPickBlock(MovingObjectPosition aTarget); @@ -258,14 +258,14 @@ public interface IMultiTileEntity * pipes/wires. */ boolean ignoreEntityCollisionWhenPlacing(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, - int aZ, byte aSide, float aHitX, float aHitY, float aHitZ); + int aZ, byte aSide, float aHitX, float aHitY, float aHitZ); } interface IMTE_CanPlace extends IMultiTileEntity { /** Return false if this TileEntity cannot be placed at that Location. */ boolean canPlace(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, - float aHitX, float aHitY, float aHitZ); + float aHitX, float aHitY, float aHitZ); } interface IMTE_GetMaxStackSize extends IMultiTileEntity { diff --git a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java index 740496a8b6..680116e95a 100644 --- a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java +++ b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java @@ -218,7 +218,7 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl // `setCapacityMultiplier` for (int i = 0; i < inputTanks.length; i++) { inputTanks[i] = new FluidTankGT(capacity).setCapacityMultiplier(maxParallel * 2L) - .readFromNBT(nbt, NBT.TANK_IN + i); + .readFromNBT(nbt, NBT.TANK_IN + i); } for (int i = 0; i < outputTanks.length; i++) { outputTanks[i] = new FluidTankGT().readFromNBT(nbt, NBT.TANK_OUT + i); @@ -262,34 +262,33 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); textures = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/bottom"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/top"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/left"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/side") }; + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/top"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/left"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/front"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/right"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/side") }; texturesInactive = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/bottom"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/top"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/left"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/back") }; + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/bottom"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/top"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/left"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/front"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/right"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/back") }; texturesActive = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/bottom"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/top"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/left"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/back") }; + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/bottom"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/top"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/left"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/front"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/right"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/back") }; } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( - getMultiTileEntityRegistryID(), - getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiTileBasicMachine) { textures = ((MultiTileBasicMachine) tCanonicalTileEntity).textures; texturesInactive = ((MultiTileBasicMachine) tCanonicalTileEntity).texturesInactive; @@ -302,14 +301,13 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { if (aSide != facing) { - return new ITexture[] { TextureFactory.of( - textures[GT_Values.FACING_ROTATIONS[facing][aSide]], - GT_Util.getRGBaArray(rgba)) }; + return new ITexture[] { + TextureFactory.of(textures[GT_Values.FACING_ROTATIONS[facing][aSide]], GT_Util.getRGBaArray(rgba)) }; } return new ITexture[] { - TextureFactory.of(textures[GT_Values.FACING_ROTATIONS[facing][aSide]], GT_Util.getRGBaArray(rgba)), - TextureFactory.of( - (active ? texturesActive : texturesInactive)[GT_Values.FACING_ROTATIONS[facing][aSide]]) }; + TextureFactory.of(textures[GT_Values.FACING_ROTATIONS[facing][aSide]], GT_Util.getRGBaArray(rgba)), + TextureFactory + .of((active ? texturesActive : texturesInactive)[GT_Values.FACING_ROTATIONS[facing][aSide]]) }; } @Override @@ -353,9 +351,9 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { return playerOwnsThis(aPlayer, false) && mTickTimer > 40 - && getTileEntityOffset(0, 0, 0) == this - && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 - && allowInteraction(aPlayer); + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && allowInteraction(aPlayer); } @Override @@ -521,12 +519,12 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl ProcessingLogic logic = ((ProcessingLogicHost) this).getProcessingLogic(); logic.clear(); boolean result = logic.setInputItems( - inputInventory.getStacks() - .toArray(new ItemStack[0])) - .setCurrentOutputItems( - outputInventory.getStacks() - .toArray(new ItemStack[0])) - .process(); + inputInventory.getStacks() + .toArray(new ItemStack[0])) + .setCurrentOutputItems( + outputInventory.getStacks() + .toArray(new ItemStack[0])) + .process(); setDuration(logic.getDuration()); setEut(logic.getEut()); setItemOutputs(logic.getOutputItems()); @@ -573,13 +571,8 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl if (getProcessStartSound() != null) GT_Utility.doSoundAtClient(getProcessStartSound(), getTimeBetweenProcessSounds(), 1.0F, aX, aY, aZ); } - case INTERRUPT_SOUND_INDEX -> GT_Utility.doSoundAtClient( - SoundResource.IC2_MACHINES_INTERRUPT_ONE, - 100, - 1.0F, - aX, - aY, - aZ); + case INTERRUPT_SOUND_INDEX -> GT_Utility + .doSoundAtClient(SoundResource.IC2_MACHINES_INTERRUPT_ONE, 100, 1.0F, aX, aY, aZ); } } @@ -603,8 +596,8 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl if (activitySoundLoop == null) { activitySoundLoop = new GT_SoundLoop(activitySound, this, false, true); Minecraft.getMinecraft() - .getSoundHandler() - .playSound(activitySoundLoop); + .getSoundHandler() + .playSound(activitySoundLoop); } } else { if (activitySoundLoop != null) { @@ -765,10 +758,7 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl protected void addDebugInfo(EntityPlayer player, int logLevel, ArrayList<String> list) { if (isElectric()) { list.add( - "Energy: " + EnumChatFormatting.GOLD - + getUniversalEnergyStored() - + "/" - + getUniversalEnergyCapacity()); + "Energy: " + EnumChatFormatting.GOLD + getUniversalEnergyStored() + "/" + getUniversalEnergyCapacity()); } if (acceptsFuel()) { @@ -860,20 +850,20 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl switch (soundEventValue) { case PROCESS_START_SOUND_INDEX -> { if (getProcessStartSound() != null) GT_Utility.doSoundAtClient( - getProcessStartSound(), - getTimeBetweenProcessSounds(), - 1.0F, - getXCoord(), - getYCoord(), - getZCoord()); - } - case INTERRUPT_SOUND_INDEX -> GT_Utility.doSoundAtClient( - SoundResource.IC2_MACHINES_INTERRUPT_ONE, - 100, + getProcessStartSound(), + getTimeBetweenProcessSounds(), 1.0F, getXCoord(), getYCoord(), getZCoord()); + } + case INTERRUPT_SOUND_INDEX -> GT_Utility.doSoundAtClient( + SoundResource.IC2_MACHINES_INTERRUPT_ONE, + 100, + 1.0F, + getXCoord(), + getYCoord(), + getZCoord()); } } } diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java index b76dc1b4bc..088b640dbd 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java @@ -94,7 +94,7 @@ import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.casings.upgrade.InventoryUpgrade; public abstract class MultiBlockController<T extends MultiBlockController<T>> extends MultiTileBasicMachine implements - IAlignment, IConstructable, IMultiBlockController, IDescribable, IMTE_AddToolTips, ISurvivalConstructable { + IAlignment, IConstructable, IMultiBlockController, IDescribable, IMTE_AddToolTips, ISurvivalConstructable { private static final Map<Integer, GT_Multiblock_Tooltip_Builder> tooltip = new ConcurrentHashMap<>(); private final List<UpgradeCasing> upgradeCasings = new ArrayList<>(); @@ -125,12 +125,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex // A list of sides // Each side has a list of parts that have a cover that need to be ticked protected List<LinkedList<WeakReference<IMultiBlockPart>>> registeredCoveredParts = Arrays.asList( - new LinkedList<>(), - new LinkedList<>(), - new LinkedList<>(), - new LinkedList<>(), - new LinkedList<>(), - new LinkedList<>()); + new LinkedList<>(), + new LinkedList<>(), + new LinkedList<>(), + new LinkedList<>(), + new LinkedList<>(), + new LinkedList<>()); /** Registry ID of the required casing */ public abstract short getCasingRegistryID(); @@ -177,13 +177,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex nbt.setBoolean(NBT.STRUCTURE_OK, structureOkay); nbt.setByte( - NBT.ROTATION, - (byte) extendedFacing.getRotation() - .getIndex()); + NBT.ROTATION, + (byte) extendedFacing.getRotation() + .getIndex()); nbt.setByte( - NBT.FLIP, - (byte) extendedFacing.getFlip() - .getIndex()); + NBT.FLIP, + (byte) extendedFacing.getFlip() + .getIndex()); saveUpgradeInventoriesToNBT(nbt); } @@ -226,9 +226,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex structureOkay = nbt.getBoolean(NBT.STRUCTURE_OK); extendedFacing = ExtendedFacing.of( - ForgeDirection.getOrientation(getFrontFacing()), - Rotation.byIndex(nbt.getByte(NBT.ROTATION)), - Flip.byIndex(nbt.getByte(NBT.FLIP))); + ForgeDirection.getOrientation(getFrontFacing()), + Rotation.byIndex(nbt.getByte(NBT.ROTATION)), + Flip.byIndex(nbt.getByte(NBT.FLIP))); loadUpgradeInventoriesFromNBT(nbt); } @@ -322,17 +322,17 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex */ protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) { return getCastedStructureDefinition().check( - this, - piece, - getWorld(), - getExtendedFacing(), - getXCoord(), - getYCoord(), - getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - !structureOkay); + this, + piece, + getWorld(), + getExtendedFacing(), + getXCoord(), + getYCoord(), + getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + !structureOkay); } public final boolean buildPiece(String piece, ItemStack trigger, boolean hintsOnly, Vec3Impl offset) { @@ -340,52 +340,52 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset, - int verticalOffset, int depthOffset) { + int verticalOffset, int depthOffset) { return getCastedStructureDefinition().buildOrHints( - this, - trigger, - piece, - getWorld(), - getExtendedFacing(), - getXCoord(), - getYCoord(), - getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - hintOnly); + this, + trigger, + piece, + getWorld(), + getExtendedFacing(), + getXCoord(), + getYCoord(), + getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + hintOnly); } protected final int survivalBuildPiece(String piece, ItemStack trigger, Vec3Impl offset, int elementBudget, - ISurvivalBuildEnvironment env, boolean check) { + ISurvivalBuildEnvironment env, boolean check) { return survivalBuildPiece( - piece, - trigger, - offset.get0(), - offset.get1(), - offset.get2(), - elementBudget, - env, - check); + piece, + trigger, + offset.get0(), + offset.get1(), + offset.get2(), + elementBudget, + env, + check); } protected final Integer survivalBuildPiece(String piece, ItemStack trigger, int horizontalOffset, - int verticalOffset, int depthOffset, int elementBudget, ISurvivalBuildEnvironment env, boolean check) { + int verticalOffset, int depthOffset, int elementBudget, ISurvivalBuildEnvironment env, boolean check) { return getCastedStructureDefinition().survivalBuild( - this, - trigger, - piece, - getWorld(), - getExtendedFacing(), - getXCoord(), - getYCoord(), - getZCoord(), - horizontalOffset, - verticalOffset, - depthOffset, - elementBudget, - env, - check); + this, + trigger, + piece, + getWorld(), + getExtendedFacing(), + getXCoord(), + getYCoord(), + getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + elementBudget, + env, + check); } @SuppressWarnings("unchecked") @@ -407,13 +407,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex structureOkay = false; if (isServerSide()) { StructureLibAPI.sendAlignment( - this, - new NetworkRegistry.TargetPoint( - getWorld().provider.dimensionId, - getXCoord(), - getYCoord(), - getZCoord(), - 512)); + this, + new NetworkRegistry.TargetPoint( + getWorld().provider.dimensionId, + getXCoord(), + getYCoord(), + getZCoord(), + 512)); } else { issueTextureUpdate(); } @@ -422,7 +422,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public boolean onWrenchRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, - float aZ) { + float aZ) { if (wrenchSide != getFrontFacing()) return super.onWrenchRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); if (aPlayer.isSneaking()) { @@ -689,13 +689,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public boolean placeBlock(S t, World world, int x, int y, int z, ItemStack trigger) { final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(registryID); - final MultiTileEntityContainer tContainer = tRegistry.getNewTileEntityContainer( - world, - x, - y, - z, - meta, - null); + final MultiTileEntityContainer tContainer = tRegistry + .getNewTileEntityContainer(world, x, y, z, meta, null); if (tContainer == null) { GT_FML_LOGGER.error("NULL CONTAINER"); return false; @@ -760,9 +755,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (aFluid == null || aFluid.amount <= 0) return null; final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), aFluid); if (tTank == null || tTank.getFluid() == null - || tTank.getFluidAmount() == 0 - || !tTank.getFluid() - .isFluidEqual(aFluid)) + || tTank.getFluidAmount() == 0 + || !tTank.getFluid() + .isFluidEqual(aFluid)) return null; final FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain); if (rDrained != null && aDoDrain) markInventoryBeenModified(); @@ -784,8 +779,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (aFluid == null) return false; final IFluidTank tTank = getFluidTankFillable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() == null || tTank.getFluid() - .getFluid() - == aFluid); + .getFluid() == aFluid); } @Override @@ -793,8 +787,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (aFluid == null) return false; final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() != null && tTank.getFluid() - .getFluid() - == aFluid); + .getFluid() == aFluid); } @Override @@ -848,12 +841,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public void unregisterInventory(String aName, String aID, int aType) { if ((aType == InventoryUpgrade.INPUT || aType == InventoryUpgrade.BOTH) - && multiBlockInputInventory.containsKey(aID)) { + && multiBlockInputInventory.containsKey(aID)) { multiBlockInputInventory.remove(aID, multiBlockInputInventory.get(aID)); multiBlockInputInventoryNames.remove(aID, aName); } if ((aType == InventoryUpgrade.OUTPUT || aType == InventoryUpgrade.BOTH) - && multiBlockOutputInventory.containsKey(aID)) { + && multiBlockOutputInventory.containsKey(aID)) { multiBlockOutputInventory.remove(aID, multiBlockOutputInventory.get(aID)); multiBlockOutputInventoryNames.remove(aID, aName); } @@ -862,11 +855,11 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public void changeInventoryName(String aName, String aID, int aType) { if ((aType == InventoryUpgrade.INPUT || aType == InventoryUpgrade.BOTH) - && multiBlockInputInventoryNames.containsKey(aID)) { + && multiBlockInputInventoryNames.containsKey(aID)) { multiBlockInputInventoryNames.put(aID, aName); } if ((aType == InventoryUpgrade.OUTPUT || aType == InventoryUpgrade.BOTH) - && multiBlockOutputInventoryNames.containsKey(aID)) { + && multiBlockOutputInventoryNames.containsKey(aID)) { multiBlockOutputInventoryNames.put(aID, aName); } } @@ -1093,8 +1086,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final String lockedInventory = aPart.getLockedInventory(); if (lockedInventory != null && !lockedInventory.equals("")) { str.append(" [Locked: ") - .append(lockedInventory) - .append("]"); + .append(lockedInventory) + .append("]"); } return str.toString(); @@ -1145,24 +1138,24 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected ItemStack[] getAllItemInputs() { return getInventoriesForInput().getStacks() - .toArray(new ItemStack[0]); + .toArray(new ItemStack[0]); } protected ItemStack[] getAllOutputItems() { return getInventoriesForOutput().getStacks() - .toArray(new ItemStack[0]); + .toArray(new ItemStack[0]); } protected Iterable<Pair<ItemStack[], String>> getItemInputsForEachInventory() { return multiBlockInputInventory.entrySet() - .stream() - .map( - (entry) -> Pair.of( - entry.getValue() - .getStacks() - .toArray(new ItemStack[0]), - entry.getKey())) - .collect(Collectors.toList()); + .stream() + .map( + (entry) -> Pair.of( + entry.getValue() + .getStacks() + .toArray(new ItemStack[0]), + entry.getKey())) + .collect(Collectors.toList()); } protected void setItemOutputs(String inventory, ItemStack... itemOutputs) { @@ -1219,7 +1212,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex int index = 0; while (fluid != null && fluid.amount > 0 && index < tanks.size()) { int filled = tanks.get(index++) - .fill(fluid, true); + .fill(fluid, true); fluid.amount -= filled; } } @@ -1245,15 +1238,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex boolean result = false; if (isSeparateInputs()) { for (Pair<ItemStack[], String> inventory : getItemInputsForEachInventory()) { - IItemHandlerModifiable outputInventory = multiBlockOutputInventory.getOrDefault( - inventory.getLeft(), - null); + IItemHandlerModifiable outputInventory = multiBlockOutputInventory + .getOrDefault(inventory.getLeft(), null); result = logic.setInputItems(inventory.getLeft()) - .setCurrentOutputItems( - outputInventory != null ? outputInventory.getStacks() - .toArray(new ItemStack[0]) - : null) - .process(); + .setCurrentOutputItems( + outputInventory != null ? outputInventory.getStacks() + .toArray(new ItemStack[0]) : null) + .process(); if (result) { inventoryName = inventory.getRight(); break; @@ -1262,8 +1253,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } } else { result = logic.setInputItems(getAllItemInputs()) - .setCurrentOutputItems(getAllOutputItems()) - .process(); + .setCurrentOutputItems(getAllOutputItems()) + .process(); } setDuration(logic.getDuration()); setEut(logic.getEut()); @@ -1315,7 +1306,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected Widget getGregTechLogo() { return new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17); + .setSize(17, 17); } @Override @@ -1329,98 +1320,98 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex int page = 0; TabContainer tabs = new TabContainer().setButtonSize(20, 24); tabs.addTabButton( - new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) - .withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) - .withOffset(2, 4)) - .addTooltip(getLocalName()) - .setPos(20 * (page - 1), -20)) + new TabButton(page++) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) + .withOffset(2, 4)) + .addTooltip(getLocalName()) + .setPos(20 * (page - 1), -20)) .addPage(createMainPage().setSize(getGUIWidth(), getGUIHeight())); if (hasItemInput()) { tabs.addTabButton( - new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) - .withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) - .withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) + new TabButton(page++) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) .addPage( - new MultiChildWidget().addChild(getItemInventoryInputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + new MultiChildWidget().addChild(getItemInventoryInputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasItemOutput()) { tabs.addTabButton( - new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) - .withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) - .withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) + new TabButton(page++) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) .addPage( - new MultiChildWidget().addChild(getItemInventoryOutputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + new MultiChildWidget().addChild(getItemInventoryOutputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasFluidInput()) { tabs.addTabButton( - new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) - .withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) - .withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) + new TabButton(page++) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) .addPage( - new MultiChildWidget().addChild(getFluidInventoryInputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + new MultiChildWidget().addChild(getFluidInventoryInputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasFluidOutput()) { tabs.addTabButton( - new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) - .withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) - .withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) + new TabButton(page++) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) .addPage( - new MultiChildWidget().addChild(getFluidInventoryOutputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + new MultiChildWidget().addChild(getFluidInventoryOutputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } builder.widget(tabs); } @@ -1428,9 +1419,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected MultiChildWidget createMainPage() { MultiChildWidget page = new MultiChildWidget(); page.addChild( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 4) - .setSize(160, 75)) + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(160, 75)) .addChild(createButtons()); return page; } @@ -1438,20 +1429,20 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected MultiChildWidget createButtons() { MultiChildWidget buttons = new MultiChildWidget(); buttons.setSize(16, 167) - .setPos(7, 86); + .setPos(7, 86); buttons.addChild(createPowerSwitchButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(this::isAllowedToWork, val -> { - if (val) enableWorking(); - else disableWorking(); - })) - .addChild(createVoidExcessButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)) - .addChild(createInputSeparationButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> separateInputs, val -> separateInputs = val)) - .addChild(createBatchModeButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)) - .addChild(createLockToSingleRecipeButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> recipeLock, val -> recipeLock = val)); + .addChild(new FakeSyncWidget.BooleanSyncer(this::isAllowedToWork, val -> { + if (val) enableWorking(); + else disableWorking(); + })) + .addChild(createVoidExcessButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)) + .addChild(createInputSeparationButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> separateInputs, val -> separateInputs = val)) + .addChild(createBatchModeButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)) + .addChild(createLockToSingleRecipeButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> recipeLock, val -> recipeLock = val)); return buttons; } @@ -1463,12 +1454,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { scrollable.widget( - new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) - .setSize(18, 18)); + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 5) - .setPos(52, 7); + .setPos(52, 7); } protected Widget getItemInventoryOutputGUI() { @@ -1478,12 +1469,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { scrollable.widget( - new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) - .setSize(18, 18)); + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 5) - .setPos(52, 7); + .setPos(52, 7); } protected IItemHandlerModifiable getInventoriesForInput() { @@ -1502,12 +1493,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int column = 0; column < columnsToMake; column++) { final FluidSlotWidget fluidSlot = new FluidSlotWidget(tanks[rows * 4 + column]); scrollable.widget( - fluidSlot.setPos(column * 18, rows * 18) - .setSize(18, 18)); + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 7); + .setPos(52, 7); } protected Widget getFluidInventoryOutputGUI() { @@ -1519,12 +1510,12 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final FluidSlotWidget fluidSlot = new FluidSlotWidget(tanks[rows * 4 + column]); fluidSlot.setInteraction(true, false); scrollable.widget( - fluidSlot.setPos(column * 18, rows * 18) - .setSize(18, 18)); + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 5) - .setPos(52, 7); + .setPos(52, 7); } protected ButtonWidget createPowerSwitchButton() { @@ -1535,7 +1526,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex enableWorking(); } }) - .setPlayClickSound(true); + .setPlayClickSound(true); button.setBackground(() -> { List<UITexture> ret = new ArrayList<>(); ret.add(GT_UITextures.BUTTON_STANDARD); @@ -1546,10 +1537,10 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } return ret.toArray(new IDrawable[0]); }) - .setPos(144, 0) - .setSize(16, 16); + .setPos(144, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return button; } @@ -1559,7 +1550,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex voidExcess = !voidExcess; } }) - .setPlayClickSound(true); + .setPlayClickSound(true); button.setBackground(() -> { List<UITexture> ret = new ArrayList<>(); ret.add(GT_UITextures.BUTTON_STANDARD); @@ -1578,10 +1569,10 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } return ret.toArray(new IDrawable[0]); }) - .setPos(54, 0) - .setSize(16, 16); + .setPos(54, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.void_excess")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return button; } @@ -1599,31 +1590,29 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex separateInputs = !separateInputs; } }) - .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(36, 0) - .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(36, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1641,29 +1630,29 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex 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(18, 0) - .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(18, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1681,29 +1670,29 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex recipeLock = !recipeLock; } }) - .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(0, 0) - .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(0, 0) + .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/multitileentity/multiblock/base/MultiBlockPart.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java index 953fc42f56..936145daa8 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java @@ -64,13 +64,13 @@ import gregtech.api.util.GT_Utility; import gregtech.common.covers.CoverInfo; public abstract class MultiBlockPart extends NonTickableMultiTileEntity - implements IMultiBlockPart, IMTE_BreakBlock, IMTE_HasModes, PowerLogicHost { + implements IMultiBlockPart, IMTE_BreakBlock, IMTE_HasModes, PowerLogicHost { public static final int NOTHING = 0, ENERGY_IN = B[0], ENERGY_OUT = B[1], FLUID_IN = B[2], FLUID_OUT = B[3], - ITEM_IN = B[4], ITEM_OUT = B[5]; + ITEM_IN = B[4], ITEM_OUT = B[5]; protected final List<Integer> BASIC_MODES = new ArrayList<>( - Arrays.asList(NOTHING, ENERGY_IN, ENERGY_OUT, FLUID_IN, FLUID_OUT, ITEM_IN, ITEM_OUT)); + Arrays.asList(NOTHING, ENERGY_IN, ENERGY_OUT, FLUID_IN, FLUID_OUT, ITEM_IN, ITEM_OUT)); protected ChunkCoordinates mTargetPos = null; protected IMultiBlockController target = null; @@ -121,7 +121,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, - IWailaConfigHandler config) { + IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); currenttip.add(String.format("Mode: %s", getModeName(mMode))); } @@ -192,9 +192,9 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity if (aNBT.hasKey(NBT.MODE)) mMode = aNBT.getByte(NBT.MODE); if (aNBT.hasKey(NBT.TARGET)) { mTargetPos = new ChunkCoordinates( - aNBT.getInteger(NBT.TARGET_X), - aNBT.getShort(NBT.TARGET_Y), - aNBT.getInteger(NBT.TARGET_Z)); + aNBT.getInteger(NBT.TARGET_X), + aNBT.getShort(NBT.TARGET_Y), + aNBT.getInteger(NBT.TARGET_Z)); } if (aNBT.hasKey(NBT.LOCKED_INVENTORY)) { mLockedInventory = aNBT.getString(NBT.LOCKED_INVENTORY); @@ -322,22 +322,19 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); textures = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/top"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/side"), - new Textures.BlockIcons.CustomIcon( - "multitileentity/multiblockparts/" + textureName + "/overlay/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/top"), - new Textures.BlockIcons.CustomIcon( - "multitileentity/multiblockparts/" + textureName + "/overlay/side") }; + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/side"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/side") }; } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( - getMultiTileEntityRegistryID(), - getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiBlockPart) textures = ((MultiBlockPart) tCanonicalTileEntity).textures; } @@ -348,13 +345,13 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity final ITexture baseTexture = TextureFactory.of(super.getTexture(aBlock, aSide, isActive, aRenderPass)); if (mMode != 0 && aSide == facing) { if (mMode == getModeOrdinal(ITEM_IN)) return new ITexture[] { baseTexture, - TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) }; + TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) }; if (mMode == getModeOrdinal(ITEM_OUT)) return new ITexture[] { baseTexture, - TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) }; + TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) }; if (mMode == getModeOrdinal(FLUID_IN)) return new ITexture[] { baseTexture, - TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) }; + TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) }; if (mMode == getModeOrdinal(FLUID_OUT)) return new ITexture[] { baseTexture, - TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) }; + TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) }; if (mMode == getModeOrdinal(ENERGY_IN)) return new ITexture[] { baseTexture, TextureFactory.of(OVERLAY_ENERGY_IN_MULTI) }; if (mMode == getModeOrdinal(ENERGY_OUT)) @@ -399,7 +396,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity @Override public boolean onMalletRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, - float aZ) { + float aZ) { if (mAllowedModes == NOTHING) return true; mMode = getNextAllowedMode(BASIC_MODES); @@ -434,7 +431,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity if (!modeSelected(FLUID_IN)) return 0; final byte aSide = (byte) aDirection.ordinal(); if (aDirection != ForgeDirection.UNKNOWN - && (aSide != facing || !coverLetsFluidIn(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + && (aSide != facing || !coverLetsFluidIn(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return 0; final IMultiBlockController controller = getTarget(true); return controller == null ? 0 : controller.fill(this, aDirection, aFluidStack, aDoFill); @@ -445,7 +442,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity if (!modeSelected(FLUID_OUT)) return null; final byte aSide = (byte) aDirection.ordinal(); if (aDirection != ForgeDirection.UNKNOWN - && (aSide != facing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + && (aSide != facing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return null; final IMultiBlockController controller = getTarget(true); return controller == null ? null : controller.drain(this, aDirection, aFluidStack, aDoDrain); @@ -459,7 +456,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity if (controller == null) return null; final FluidStack aFluidStack = controller.getDrainableFluid(aSide); if (aDirection != ForgeDirection.UNKNOWN - && (aSide != facing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + && (aSide != facing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return null; return controller.drain(this, aDirection, aAmountToDrain, aDoDrain); } @@ -494,7 +491,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity final CoverInfo coverInfo = getCoverInfoAtSide(aSide); if ((controller.isLiquidInput(aSide) && coverInfo.letsFluidIn(null, controller)) - || (controller.isLiquidOutput(aSide) && coverInfo.letsFluidOut(null, controller))) + || (controller.isLiquidOutput(aSide) && coverInfo.letsFluidOut(null, controller))) return controller.getTankInfo(this, aDirection); return GT_Values.emptyFluidTankInfo; @@ -560,8 +557,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity @Override public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) { if (!modeSelected(ITEM_IN, ITEM_OUT) - || (facing != SIDE_UNKNOWN && (facing != aSide || !coverLetsItemsIn((byte) aSide, aSlot)))) - return false; + || (facing != SIDE_UNKNOWN && (facing != aSide || !coverLetsItemsIn((byte) aSide, aSlot)))) return false; final IMultiBlockController controller = getTarget(true); return (controller != null && controller.canInsertItem(this, aSlot, aStack, (byte) aSide)); } @@ -569,8 +565,7 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity @Override public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) { if (!modeSelected(ITEM_IN, ITEM_OUT) - || (facing != SIDE_UNKNOWN && (facing != aSide || !coverLetsItemsOut((byte) aSide, aSlot)))) - return false; + || (facing != SIDE_UNKNOWN && (facing != aSide || !coverLetsItemsOut((byte) aSide, aSlot)))) return false; final IMultiBlockController controller = getTarget(true); return (controller != null && controller.canExtractItem(this, aSlot, aStack, (byte) aSide)); } @@ -664,33 +659,33 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { scrollable.widget( - new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) - .setSize(18, 18)); + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } builder.widget( - scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 18)); + scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 18)); DropDownWidget dropDown = new DropDownWidget(); dropDown.addDropDownItemsSimple( - controller.getInventoryNames(this), - (buttonWidget, index, label, setSelected) -> buttonWidget.setOnClick((clickData, widget) -> { - if (getNameOfInventoryFromIndex(controller, index).equals("all")) { - mLockedInventory = GT_Values.E; - mLockedInventoryIndex = 0; - } else { - mLockedInventory = getNameOfInventoryFromIndex(controller, index); - mLockedInventoryIndex = index; - } - setSelected.run(); - }), - true); + controller.getInventoryNames(this), + (buttonWidget, index, label, setSelected) -> buttonWidget.setOnClick((clickData, widget) -> { + if (getNameOfInventoryFromIndex(controller, index).equals("all")) { + mLockedInventory = GT_Values.E; + mLockedInventoryIndex = 0; + } else { + mLockedInventory = getNameOfInventoryFromIndex(controller, index); + mLockedInventoryIndex = index; + } + setSelected.run(); + }), + true); builder.widget( - dropDown.setSelected(mLockedInventoryIndex) - .setExpandedMaxHeight(60) - .setDirection(DropDownWidget.Direction.DOWN) - .setPos(53, 5) - .setSize(70, 11)); + dropDown.setSelected(mLockedInventoryIndex) + .setExpandedMaxHeight(60) + .setDirection(DropDownWidget.Direction.DOWN) + .setPos(53, 5) + .setSize(70, 11)); } protected String getNameOfInventoryFromIndex(final IMultiBlockController controller, int index) { @@ -716,13 +711,13 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity fluidSlot.setInteraction(true, false); } scrollable.widget( - fluidSlot.setPos(column * 18, rows * 18) - .setSize(18, 18)); + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } builder.widget( - scrollable.setSize(18 * 4 + 4, 18 * 4) - .setPos(52, 7)); + scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 7)); } @Override @@ -756,9 +751,9 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity public void addGregTechLogo(Builder builder) { if (modeSelected(ITEM_IN, ITEM_OUT)) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 74)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 74)); } else { super.addGregTechLogo(builder); } diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPowerController.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPowerController.java index 0834c64b75..7f202ec5a4 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPowerController.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPowerController.java @@ -7,7 +7,7 @@ import gregtech.api.logic.PowerLogic; import gregtech.api.logic.interfaces.PowerLogicHost; public abstract class MultiBlockPowerController<T extends MultiBlockPowerController<T>> extends MultiBlockController<T> - implements PowerLogicHost { + implements PowerLogicHost { public MultiBlockPowerController() { super(); |