From 1922f34f1f8782f160e4808f4f6bb75a50703871 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 17 Mar 2020 19:12:19 +0100 Subject: Refactored Interfaces Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../api/interfaces/metatileentity/IConnectable.java | 21 +++++++++++---------- .../interfaces/metatileentity/IMetaTileEntity.java | 6 +++--- .../metatileentity/IMetaTileEntityCable.java | 4 ++-- .../metatileentity/IMetaTileEntityItemPipe.java | 15 ++++++++------- 4 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src/main/java/gregtech/api/interfaces/metatileentity') diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java index 96c03bbd6d..16fe07812f 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java @@ -4,15 +4,16 @@ package gregtech.api.interfaces.metatileentity; * For pipes, wires, and other MetaTiles which need to be decided whether they should connect to the block at each side. */ public interface IConnectable { - /** - * Try to connect to the Block at the specified side - * returns the connection state. Non-positive values for failed, others for succeeded. - */ - public int connect(byte aSide); - /** - * Try to disconnect to the Block at the specified side - */ - public void disconnect(byte aSide); + /** + * Try to connect to the Block at the specified side + * returns the connection state. Non-positive values for failed, others for succeeded. + */ + int connect(byte aSide); - public boolean isConnectedAtSide(int aSide); + /** + * Try to disconnect to the Block at the specified side + */ + void disconnect(byte aSide); + + boolean isConnectedAtSide(int aSide); } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index e973301395..a518b3baaf 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -389,7 +389,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand void onColorChangeClient(byte aColor); int getLightOpacity(); - + boolean allowGeneralRedstoneOutput(); void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider); @@ -402,9 +402,9 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * The onCreated Function of the Item Class redirects here */ void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer); - + boolean hasAlternativeModeText(); - + String getAlternativeModeText(); boolean shouldJoinIc2Enet(); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java index ead9c8bf8f..a7c1209d24 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java @@ -7,9 +7,9 @@ import java.util.HashSet; public interface IMetaTileEntityCable extends IMetaTileEntity { @Deprecated - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList aAlreadyPassedTileEntityList); + long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList aAlreadyPassedTileEntityList); - default public long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet aAlreadyPassedSet) { + default long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet aAlreadyPassedSet) { return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(aAlreadyPassedSet)); } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index 7187ccb04b..b61fe99904 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -10,12 +10,12 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { /** * @return if this Pipe can still be used. */ - public boolean pipeCapacityCheck(); + boolean pipeCapacityCheck(); /** * @return if this Pipe can still be used. */ - public boolean incrementTransferCounter(int aIncrement); + boolean incrementTransferCounter(int aIncrement); /** * Sends an ItemStack from aSender to the adjacent Blocks. @@ -23,7 +23,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { * @param aSender the BaseMetaTileEntity sending the Stack. * @return if it was able to send something */ - public boolean sendItemStack(Object aSender); + boolean sendItemStack(Object aSender); /** * Executes the Sending Code for inserting Stacks into the TileEntities. @@ -32,19 +32,19 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { * @param aSide the Side of the PIPE facing the TileEntity. * @return if this Side was allowed to Output into the Block. */ - public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); + boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); /** * Can be used to make flow control Pipes, like Redpowers Restriction Tubes. * Every normal Pipe returns a Value of 32768, so you can easily insert lower Numbers to set Routing priorities. * Negative Numbers to "suck" Items into a certain direction are also possible. */ - public int getStepSize(); + int getStepSize(); /** * Utility for the Item Network */ - public static class Util { + class Util { /** * @return a List of connected Item Pipes */ @@ -55,7 +55,8 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { IGregTechTileEntity aBaseMetaTileEntity = aMetaTileEntity.getBaseMetaTileEntity(); aMap.put(aMetaTileEntity, aStep); for (byte i = 0, j = 0; i < 6; i++) { - if (aMetaTileEntity instanceof IConnectable && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) continue; + if (aMetaTileEntity instanceof IConnectable && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) + continue; j = GT_Utility.getOppositeSide(i); if (aSuckItems) { if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { -- cgit