diff options
Diffstat (limited to 'src/main/java/gregtech/common')
169 files changed, 1866 insertions, 1766 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 4ae0204636..5951f95994 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -331,9 +331,9 @@ public class GT_Client extends GT_Proxy implements Runnable { byte tConnections = 0; if (tTile instanceof ICoverable) { if (showCoverConnections) { - for (byte tSide : ALL_VALID_SIDES) { + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { if (((ICoverable) tTile).getCoverIDAtSide(tSide) > 0) - tConnections = (byte) (tConnections + (1 << tSide)); + tConnections = (byte) (tConnections + (1 << tSide.ordinal())); } } else if (tTile instanceof BaseMetaPipeEntity) tConnections = ((BaseMetaPipeEntity) tTile).mConnections; } @@ -783,7 +783,7 @@ public class GT_Client extends GT_Proxy implements Runnable { || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSoftHammerList) && aTileEntity instanceof MultiBlockPart) && aEvent.player.isSneaking()) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, false, false, aEvent.player.isSneaking()); return; } @@ -791,21 +791,23 @@ public class GT_Client extends GT_Proxy implements Runnable { if ((aEvent.currentItem == null && aEvent.player.isSneaking()) || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList) || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) - for (byte tSide : ALL_VALID_SIDES) if (((ICoverable) aTileEntity).getCoverIDAtSide(tSide) > 0) { - drawGrid(aEvent, true, false, true); - return; + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { + if (((ICoverable) aTileEntity).getCoverIDAtSide(tSide) > 0) { + drawGrid(aEvent, true, false, true); + return; + } } return; } if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, true, false, aEvent.player.isSneaking()); } if (GT_Utility.areStacksEqual(ItemList.Tool_Cover_Copy_Paste.get(1), aEvent.currentItem, true)) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, true, false, aEvent.player.isSneaking()); } } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index de36c1f1c8..6d802a0789 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -63,6 +63,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.EnderTeleportEvent; @@ -2351,7 +2352,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler, IG if ((tTileEntity instanceof IGregTechTileEntity tile)) { if (GUI_ID_COVER_SIDE_BASE <= aID && aID < GUI_ID_COVER_SIDE_BASE + 6) { - final byte side = (byte) (aID - GT_Proxy.GUI_ID_COVER_SIDE_BASE); + final ForgeDirection side = ForgeDirection + .getOrientation((byte) (aID - GT_Proxy.GUI_ID_COVER_SIDE_BASE)); GT_CoverBehaviorBase<?> cover = tile.getCoverBehaviorAtSideNew(side); if (cover.hasCoverGUI() && !cover.useModularUI()) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java index ea5c569ac7..7610bfa769 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java @@ -62,7 +62,7 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { case 10 -> { @@ -84,10 +84,10 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getIcon(); } } - if (aSide == 0) { + if (ordinalSide == 0) { return Textures.BlockIcons.MACHINECASINGS_BOTTOM[aMeta].getIcon(); } - if (aSide == 1) { + if (ordinalSide == 1) { return Textures.BlockIcons.MACHINECASINGS_TOP[aMeta].getIcon(); } return Textures.BlockIcons.MACHINECASINGS_SIDE[aMeta].getIcon(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java index 14960eea10..c93d613936 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java @@ -67,7 +67,7 @@ public class GT_Block_Casings2 extends GT_Block_Casings_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0 -> Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); case 1 -> Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getIcon(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java index 92bb58aead..3d81a8de18 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java @@ -51,7 +51,7 @@ public class GT_Block_Casings3 extends GT_Block_Casings_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0 -> Textures.BlockIcons.MACHINE_CASING_STRIPES_A.getIcon(); case 1 -> Textures.BlockIcons.MACHINE_CASING_STRIPES_B.getIcon(); @@ -66,11 +66,11 @@ public class GT_Block_Casings3 extends GT_Block_Casings_Abstract { case 10 -> Textures.BlockIcons.MACHINE_CASING_GRATE.getIcon(); case 11 -> Textures.BlockIcons.MACHINE_CASING_VENT.getIcon(); case 12 -> Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); - case 13 -> aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon() + case 13 -> ordinalSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon() : Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); - case 14 -> aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon() + case 14 -> ordinalSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); - case 15 -> aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getIcon() + case 15 -> ordinalSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); default -> Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); }; diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 5b1972b59e..023f97d5b1 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -86,12 +86,12 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0, 12 -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); case 1, 10 -> Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon(); case 2, 11 -> Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); - case 3 -> aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() + case 3 -> ordinalSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); case 4 -> // Do not overwrite! @@ -142,11 +142,11 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { }; } - private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(tTileEntity instanceof IGregTechTileEntity tTile)) return 0; - if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine turbine - && tTile.getFrontFacing() == aSide) { + if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine turbine && tTile.getFrontFacing() + .ordinal() == ordinalSide) { if (turbine.isNewStyleRendering()) return 0; if (tTile.isActive()) return 1; return turbine.hasTurbine() ? 2 : 3; @@ -156,23 +156,27 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { + public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int ordinalSide) { aWorld = GT_RenderingWorld.getInstance(aWorld); int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); if (tMeta != 6 && tMeta != 8 && tMeta != 9 && tMeta != 10 && tMeta != 11 && tMeta != 12 || !mConnectedMachineTextures) { - return getIcon(aSide, tMeta); + return getIcon(ordinalSide, tMeta); } if (tMeta > 8 && tMeta < 13) { - int tInvertLeftRightMod = aSide % 2 * 2 - 1; - switch (aSide / 2) { + int tInvertLeftRightMod = ordinalSide % 2 * 2 - 1; + switch (ordinalSide / 2) { case 0 -> { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord + j, + yCoord, + zCoord + i, + ordinalSide)) != 0) { return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1, tState == 2); } } @@ -183,8 +187,12 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord + j, + yCoord + i, + zCoord, + ordinalSide)) != 0) { return getTurbineCasing( tMeta, 4 + i * 3 - j * tInvertLeftRightMod, @@ -199,8 +207,12 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord, + yCoord + i, + zCoord + j, + ordinalSide)) != 0) { return getTurbineCasing( tMeta, 4 + i * 3 + j * tInvertLeftRightMod, @@ -226,7 +238,7 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { if (isSameBlock(aWorld, xCoord, yCoord, zCoord + 1, tMeta)) tIndexIntoMapping |= 1 << 3; if (isSameBlock(aWorld, xCoord - 1, yCoord, zCoord, tMeta)) tIndexIntoMapping |= 1 << 4; if (isSameBlock(aWorld, xCoord, yCoord, zCoord - 1, tMeta)) tIndexIntoMapping |= 1 << 5; - return Textures.BlockIcons.CONNECTED_HULLS[tStartIndex + mapping[aSide][tIndexIntoMapping]].getIcon(); + return Textures.BlockIcons.CONNECTED_HULLS[tStartIndex + mapping[ordinalSide][tIndexIntoMapping]].getIcon(); } private boolean isSameBlock(IBlockAccess aWorld, int aX, int aY, int aZ, int aMeta) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java index 50101dae49..d5746b4360 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java @@ -57,7 +57,7 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0 -> Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon(); case 1 -> Textures.BlockIcons.MACHINE_COIL_KANTHAL.getIcon(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java index cde7a8b5fa..d359a30df0 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java @@ -55,11 +55,11 @@ public class GT_Block_Casings6 extends GT_Block_Casings_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) { - if (aSide == 0) { + public IIcon getIcon(int ordinalSide, int aMeta) { + if (ordinalSide == 0) { return Textures.BlockIcons.MACHINECASINGS_BOTTOM[aMeta].getIcon(); } - if (aSide == 1) { + if (ordinalSide == 1) { return Textures.BlockIcons.MACHINECASINGS_TOP[aMeta].getIcon(); } return switch (aMeta) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java index b4778ec12e..a864132549 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java @@ -74,7 +74,7 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0 -> Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon(); case 1 -> Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon(); @@ -117,11 +117,11 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { }; } - private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(tTileEntity instanceof IGregTechTileEntity tTile)) return 0; - if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine turbine - && tTile.getFrontFacing() == aSide) { + if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine turbine && tTile.getFrontFacing() + .ordinal() == ordinalSide) { if (turbine.isNewStyleRendering()) return 0; if (tTile.isActive()) return 1; return turbine.hasTurbine() ? 2 : 3; @@ -131,22 +131,26 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { + public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int ordinalSide) { aWorld = GT_RenderingWorld.getInstance(aWorld); - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); if (tMeta != 9 || !mConnectedMachineTextures) { - return getIcon(aSide, tMeta); + return getIcon(ordinalSide, tMeta); } if (tMeta == 9) { - int tInvertLeftRightMod = aSide % 2 * 2 - 1; - switch (aSide / 2) { + int tInvertLeftRightMod = ordinalSide % 2 * 2 - 1; + switch (ordinalSide / 2) { case 0 -> { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord + j, + yCoord, + zCoord + i, + ordinalSide)) != 0) { return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1, tState == 2); } } @@ -157,8 +161,12 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord + j, + yCoord + i, + zCoord, + ordinalSide)) != 0) { return getTurbineCasing( tMeta, 4 + i * 3 - j * tInvertLeftRightMod, @@ -173,8 +181,12 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) - != 0) { + if ((tState = isTurbineControllerWithSide( + aWorld, + xCoord, + yCoord + i, + zCoord + j, + ordinalSide)) != 0) { return getTurbineCasing( tMeta, 4 + i * 3 + j * tInvertLeftRightMod, diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings9.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings9.java index 0aa9ca916f..3aa1756d0c 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings9.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings9.java @@ -29,7 +29,7 @@ public class GT_Block_Casings9 extends GT_Block_Casings_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return switch (aMeta) { case 0 -> Textures.BlockIcons.MACHINE_CASING_PIPE_POLYBENZIMIDAZOLE.getIcon(); case 1 -> Textures.BlockIcons.MACHINE_CASING_VENT_T2.getIcon(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java index ae3588cfa3..c7b7e2bb04 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java @@ -63,7 +63,7 @@ public class GT_Block_Concretes extends GT_Block_Stones_Abstract implements IBlo } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { return gregtech.api.enums.Textures.BlockIcons.CONCRETES[aMeta].getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Granites.java b/src/main/java/gregtech/common/blocks/GT_Block_Granites.java index df50c5223f..69ebc2e733 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Granites.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Granites.java @@ -63,7 +63,7 @@ public class GT_Block_Granites extends GT_Block_Stones_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index c9a93ecaec..78044ed44b 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -1,8 +1,6 @@ package gregtech.common.blocks; import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; -import static gregtech.api.enums.GT_Values.SIDE_UP; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import java.util.ArrayList; @@ -41,6 +39,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IDebugableBlock; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IColoredTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IDebugableTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -160,7 +159,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public boolean canConnectRedstone(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + public boolean canConnectRedstone(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { return true; } @@ -211,13 +210,13 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { + public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int ordinalSide) { return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon(); } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon(); } @@ -343,7 +342,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, + public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int ordinalSide, float aOffsetX, float aOffsetY, float aOffsetZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity == null) { @@ -356,15 +355,15 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) return false; } - if ((tTileEntity instanceof IGregTechTileEntity)) { - if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + if (gtTE.getTimer() < 50L) { return false; } - if ((!aWorld.isRemote) && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer)) { + if ((!aWorld.isRemote) && !gtTE.isUseableByPlayer(aPlayer)) { return true; } return ((IGregTechTileEntity) tTileEntity) - .onRightclick(aPlayer, (byte) aSide, aOffsetX, aOffsetY, aOffsetZ); + .onRightclick(aPlayer, ForgeDirection.getOrientation(ordinalSide), aOffsetX, aOffsetY, aOffsetZ); } return false; } @@ -372,16 +371,16 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + gtTE.onLeftclick(aPlayer); } } @Override public int getDamageValue(World aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return ((IGregTechTileEntity) tTileEntity).getMetaTileID(); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + return gtTE.getMetaTileID(); } return 0; } @@ -389,14 +388,14 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof BaseMetaTileEntity) { + if (tTileEntity instanceof BaseMetaTileEntity baseTE) { GT_Log.exp.printf( "Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", aX, aY, aZ, aWorld.provider.dimensionId); - ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + baseTE.doEnergyExplosion(); } super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); } @@ -405,15 +404,13 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetadata) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity tGregTechTileEntity) { - tGregTechTileEntity.onBlockDestroyed(); - mTemporaryTileEntity.set(tGregTechTileEntity); - if (!(tGregTechTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest)) { - for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) { - final ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); - if ((tItem != null) && (tItem.stackSize > 0) - && (tGregTechTileEntity.isValidSlot(i)) - && tGregTechTileEntity.shouldDropItemAt(i)) { + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + gtTE.onBlockDestroyed(); + mTemporaryTileEntity.set(gtTE); + if (!(gtTE.getMetaTileEntity() instanceof GT_MetaTileEntity_QuantumChest)) { + for (int i = 0; i < gtTE.getSizeInventory(); i++) { + final ItemStack tItem = gtTE.getStackInSlot(i); + if ((tItem != null) && (tItem.stackSize > 0) && (gtTE.isValidSlot(i)) && gtTE.shouldDropItemAt(i)) { final EntityItem tItemEntity = new EntityItem( aWorld, aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, @@ -431,7 +428,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo tItemEntity.motionZ = (XSTR_INSTANCE.nextGaussian() * 0.05D); aWorld.spawnEntityInWorld(tItemEntity); tItem.stackSize = 0; - tGregTechTileEntity.setInventorySlotContents(i, null); + gtTE.setInventorySlotContents(i, null); } } } @@ -443,8 +440,8 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo @Override public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity instanceof IGregTechTileEntity)) { - return ((IGregTechTileEntity) tTileEntity).getDrops(); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + return gtTE.getDrops(); } final IGregTechTileEntity tGregTechTileEntity = mTemporaryTileEntity.get(); final ArrayList<ItemStack> tDrops; @@ -470,34 +467,38 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { + public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int ordinalSide) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + return gtTE.getComparatorValue(ForgeDirection.getOrientation(ordinalSide)); } return 0; } @Override - public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { - if (aSide < 0 || aSide > 5) { + public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { + if (ordinalSide < 0 || ordinalSide > 5) { return 0; } final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + return gtTE.getOutputRedstoneSignal( + ForgeDirection.getOrientation(ordinalSide) + .getOpposite()); } return 0; } @Override - public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { - if (aSide < 0 || aSide > 5) { + public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { + if (ordinalSide < 0 || ordinalSide > 5) { return 0; } final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); + if (tTileEntity instanceof IGregTechTileEntity gtTE) { + return gtTE.getStrongOutputRedstoneSignal( + ForgeDirection.getOrientation(ordinalSide) + .getOpposite()); } return 0; } @@ -508,14 +509,14 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo if (!aWorld.isRemote) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity != null && (chance < 1.0F)) { - if (tTileEntity instanceof BaseMetaTileEntity && (GregTech_API.sMachineNonWrenchExplosions)) { + if (tTileEntity instanceof BaseMetaTileEntity bmte && (GregTech_API.sMachineNonWrenchExplosions)) { GT_Log.exp.printf( "Explosion at : %d | %d | %d DIMID: %s NonWrench picking/Rain!%n", aX, aY, aZ, aWorld.provider.dimensionId); - ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + bmte.doEnergyExplosion(); } } else { super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, aMetadata, chance, aFortune); @@ -524,7 +525,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { + public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection side) { if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { return true; } @@ -537,8 +538,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo && (((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0) { return true; } - return tTileEntity instanceof ICoverable - && ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0; + return tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverIDAtSide(side) != 0; } return false; } @@ -597,7 +597,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo double explosionY, double explosionZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof IGregTechTileEntity) { - return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); + return ((IGregTechTileEntity) tTileEntity).getBlastResistance(ForgeDirection.UNKNOWN); } return 10.0F; } @@ -617,7 +617,7 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(tTileEntity instanceof IGregTechTileEntity iGregTechTileEntity)) return; iGregTechTileEntity.setFrontFacing( - BaseTileEntity.getSideForPlayerPlacing(aPlayer, SIDE_UP, iGregTechTileEntity.getValidFacings())); + BaseTileEntity.getSideForPlayerPlacing(aPlayer, ForgeDirection.UP, iGregTechTileEntity.getValidFacings())); } @Override @@ -630,31 +630,31 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { + public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection side, int aColor) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((~aColor) & 0xF)) { + if (tTileEntity instanceof IColoredTileEntity coloredTE) { + if (coloredTE.getColorization() == (byte) ((~aColor) & 0xF)) { return false; } - ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((~aColor) & 0xF)); + coloredTE.setColorization((byte) ((~aColor) & 0xF)); return true; } return false; } @Override - public Block getFacade(IBlockAccess aWorld, int aX, int aY, int aZ, int side) { + public Block getFacade(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof CoverableTileEntity tile) { - final byte aSide = (byte) side; - if (side != -1) { - final Block facadeBlock = tile.getCoverInfoAtSide(aSide) + final ForgeDirection dir = ForgeDirection.getOrientation(ordinalSide); + if (dir != ForgeDirection.UNKNOWN) { + final Block facadeBlock = tile.getCoverInfoAtSide(dir) .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) { + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { final Block facadeBlock = tile.getCoverInfoAtSide(tSide) .getFacadeBlock(); if (facadeBlock != null) { @@ -667,19 +667,19 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo } @Override - public int getFacadeMetadata(IBlockAccess aWorld, int aX, int aY, int aZ, int side) { + public int getFacadeMetadata(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof CoverableTileEntity tile) { - final byte aSide = (byte) side; - if (side != -1) { - final CoverInfo coverInfo = tile.getCoverInfoAtSide(aSide); + final ForgeDirection dir = ForgeDirection.getOrientation(ordinalSide); + if (ordinalSide != -1) { + final CoverInfo coverInfo = tile.getCoverInfoAtSide(dir); final Block facadeBlock = coverInfo.getFacadeBlock(); if (facadeBlock != null) return coverInfo.getFacadeMeta(); } 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 CoverInfo coverInfo = tile.getCoverInfoAtSide(tSide); + for (final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { + final CoverInfo coverInfo = tile.getCoverInfoAtSide(d); final Block facadeBlock = coverInfo.getFacadeBlock(); if (facadeBlock != null) { return coverInfo.getFacadeMeta(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java index b8aa8b0e00..753c590e51 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java @@ -44,7 +44,7 @@ public class GT_Block_Metal extends GT_Block_Storage { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16) && aMeta < mMats.length) { return mBlockIcons[aMeta].getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java index 11768763a8..1bfd24f75c 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java @@ -47,16 +47,16 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { + public IIcon getIcon(int ordinalSide, int meta) { int index = ((meta / 1000) % 16); return switch (index) { - case 1 -> Blocks.netherrack.getIcon(side, 0); - case 2 -> Blocks.end_stone.getIcon(side, 0); + case 1 -> Blocks.netherrack.getIcon(ordinalSide, 0); + case 2 -> Blocks.end_stone.getIcon(ordinalSide, 0); case 3 -> GRANITE_BLACK_STONE.getIcon(); case 4 -> GRANITE_RED_STONE.getIcon(); case 5 -> MARBLE_STONE.getIcon(); case 6 -> BASALT_STONE.getIcon(); - default -> Blocks.stone.getIcon(side, 0); + default -> Blocks.stone.getIcon(ordinalSide, 0); }; } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java index 2a37aefa64..8e68c5c39a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java @@ -140,7 +140,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements } @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, + public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int ordinalSide, float aOffsetX, float aOffsetY, float aOffsetZ) { if (!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode) { return false; @@ -233,13 +233,13 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { + public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int ordinalSide) { return Blocks.stone.getIcon(0, 0); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { return Blocks.stone.getIcon(0, 0); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 18f17fb336..1849994e02 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -159,7 +159,7 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { case 0 -> { @@ -379,15 +379,15 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOffset, - float yOffset, float zOffset) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int ordinalSide, + float xOffset, float yOffset, float zOffset) { if ((player.getCurrentEquippedItem() != null) && (player.getCurrentEquippedItem() .getItem() == Items.flint_and_steel) && world.getBlockMetadata(x, y, z) == 5) { removedByPlayer(world, player, x, y, z); return true; } - return super.onBlockActivated(world, x, y, z, player, side, xOffset, yOffset, zOffset); + return super.onBlockActivated(world, x, y, z, player, ordinalSide, xOffset, yOffset, zOffset); } @Override diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones.java index 253d9d2163..4ca52aee56 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Stones.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones.java @@ -53,7 +53,7 @@ public class GT_Block_Stones extends GT_Block_Stones_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { return gregtech.api.enums.Textures.BlockIcons.STONES[aMeta].getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java index 45c0e38c30..138d7a6e8a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java @@ -222,7 +222,7 @@ public class GT_Block_Stones_Abstract extends GT_Generic_Block implements IOreRe } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon(); } diff --git a/src/main/java/gregtech/common/blocks/GT_Cyclotron_Coils.java b/src/main/java/gregtech/common/blocks/GT_Cyclotron_Coils.java index 4e5768f199..1a544f027f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Cyclotron_Coils.java +++ b/src/main/java/gregtech/common/blocks/GT_Cyclotron_Coils.java @@ -44,71 +44,71 @@ public class GT_Cyclotron_Coils extends GT_Block_Casings_Abstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { + public IIcon getIcon(int ordinalSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { case 0 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.MV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.MV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 1 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.HV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.HV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 2 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.EV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.EV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 3 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.IV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.IV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 4 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.LuV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.LuV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 5 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.ZPM_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.ZPM_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 6 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.UV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.UV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 7 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.UHV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.UHV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 8 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.UEV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.UEV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 9 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.UIV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.UIV_SIDE_CYCLOTRON_SOLENOID.getIcon(); } case 10 -> { - if (aSide == 0 || aSide == 1) { + if (ordinalSide == 0 || ordinalSide == 1) { return Textures.BlockIcons.UMV_TOP_CYCLOTRON_SOLENOID.getIcon(); } return Textures.BlockIcons.UMV_SIDE_CYCLOTRON_SOLENOID.getIcon(); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 2e275bc7b3..5bd6d0b62f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -17,6 +17,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; @@ -219,8 +220,8 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, + int ordinalSide, float hitX, float hitY, float hitZ) { return false; } @@ -270,8 +271,9 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ, int aMeta) { + public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, + int ordinalSide, float hitX, float hitY, float hitZ, int aMeta) { + final ForgeDirection side = ForgeDirection.getOrientation(ordinalSide); final short tDamage = (short) getDamage(aStack); if (tDamage > 0) { if (GregTech_API.METATILEENTITIES[tDamage] == null) { @@ -298,15 +300,15 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } tTileEntity.getMetaTileEntity() .initDefaultModes(aStack.getTagCompound()); - final byte aSide = GT_Utility.getOppositeSide(side); - if (tTileEntity.getMetaTileEntity() instanceof IConnectable) { + final ForgeDirection oppositeSide = side.getOpposite(); + if (tTileEntity.getMetaTileEntity() instanceof IConnectable connectable) { // If we're connectable, try connecting to whatever we're up against - ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide); + connectable.connect(oppositeSide); } else if (aPlayer != null && aPlayer.isSneaking()) { // If we're being placed against something that is connectable, try telling it to connect to us - final IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide); - if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) { - ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte) side); + final IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(oppositeSide); + if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable connectable) { + connectable.connect(side); } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java index 03a2591542..2ba78572b3 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java @@ -24,8 +24,8 @@ public class GT_Item_Ores extends ItemBlock { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, + int ordinalSide, float hitX, float hitY, float hitZ) { return false; } @@ -44,8 +44,8 @@ public class GT_Item_Ores extends ItemBlock { } @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ, int aMeta) { + public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, + int ordinalSide, float hitX, float hitY, float hitZ, int aMeta) { short tDamage = (short) getDamage(aStack); if (tDamage > 0) { if (!aWorld.setBlock( diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 4add136ab5..318cfcabd1 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -12,6 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -387,7 +388,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } @Override - public ITexture[] getTexture(Block aBlock, byte aSide) { + public ITexture[] getTexture(Block aBlock, ForgeDirection side) { Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)]; if ((aMaterial != null) && (this.mMetaData < 32000)) { ITexture iTexture = TextureFactory.builder() diff --git a/src/main/java/gregtech/common/covers/CoverInfo.java b/src/main/java/gregtech/common/covers/CoverInfo.java index 0c3cf6986f..e63fe6e176 100644 --- a/src/main/java/gregtech/common/covers/CoverInfo.java +++ b/src/main/java/gregtech/common/covers/CoverInfo.java @@ -1,13 +1,12 @@ package gregtech.common.covers; -import static gregtech.api.enums.GT_Values.SIDE_UNKNOWN; - import java.lang.ref.WeakReference; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -23,21 +22,21 @@ public final class CoverInfo { private static final String NBT_SIDE = "s", NBT_ID = "id", NBT_DATA = "d"; - public static final CoverInfo EMPTY_INFO = new CoverInfo(SIDE_UNKNOWN, null); - private byte coverSide; + public static final CoverInfo EMPTY_INFO = new CoverInfo(ForgeDirection.UNKNOWN, null); + private final ForgeDirection coverSide; private int coverID = 0; private GT_CoverBehaviorBase<?> coverBehavior = null; private ISerializableObject coverData = null; private final WeakReference<ICoverable> coveredTile; private boolean needsUpdate = false; - public CoverInfo(byte aSide, ICoverable aTile) { - coverSide = aSide; + public CoverInfo(ForgeDirection side, ICoverable aTile) { + coverSide = side; coveredTile = new WeakReference<>(aTile); } - public CoverInfo(byte aSide, int aID, ICoverable aTile, ISerializableObject aCoverData) { - coverSide = aSide; + public CoverInfo(ForgeDirection side, int aID, ICoverable aTile, ISerializableObject aCoverData) { + coverSide = side; coverID = aID; coverBehavior = GregTech_API.getCoverBehaviorNew(aID); coverData = aCoverData == null ? coverBehavior.createDataObject() : aCoverData; @@ -45,7 +44,7 @@ public final class CoverInfo { } public CoverInfo(ICoverable aTile, NBTTagCompound aNBT) { - coverSide = aNBT.getByte(NBT_SIDE); + coverSide = ForgeDirection.getOrientation(aNBT.getByte(NBT_SIDE)); coverID = aNBT.getInteger(NBT_ID); coverBehavior = GregTech_API.getCoverBehaviorNew(coverID); coverData = aNBT.hasKey(NBT_DATA) ? coverBehavior.createDataObject(aNBT.getTag(NBT_DATA)) @@ -54,11 +53,11 @@ public final class CoverInfo { } public boolean isValid() { - return coverID != 0 && coverSide != SIDE_UNKNOWN; + return coverID != 0 && coverSide != ForgeDirection.UNKNOWN; } public NBTTagCompound writeToNBT(NBTTagCompound aNBT) { - aNBT.setByte(NBT_SIDE, coverSide); + aNBT.setByte(NBT_SIDE, (byte) coverSide.ordinal()); aNBT.setInteger(NBT_ID, coverID); if (coverData != null) aNBT.setTag(NBT_DATA, coverData.saveDataToNBT()); @@ -123,7 +122,7 @@ public final class CoverInfo { return getCoverBehavior().getTickRate(coverSide, coverID, coverData, coveredTile.get()); } - public byte getSide() { + public ForgeDirection getSide() { return coverSide; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java index f2c2a65f3a..6bd41e1a25 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java @@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.math.MathExpression; @@ -51,14 +52,14 @@ public class GT_Cover_Arm extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if ((((aTileEntity instanceof IMachineProgress)) && (!((IMachineProgress) aTileEntity).isAllowedToWork()))) { return aCoverVariable; } @@ -70,41 +71,44 @@ public class GT_Cover_Arm extends GT_CoverBehavior { aCoverVariable = CONVERTED_BIT | Math.min(Math.abs(aCoverVariable - 1), SLOT_ID_MASK); } - TileEntity toTile, fromTile; - int toSlot, fromSlot; + final TileEntity toTile; + final TileEntity fromTile; + final int toSlot; + final int fromSlot; if ((aCoverVariable & EXPORT_MASK) > 0) { fromTile = (TileEntity) aTileEntity; - toTile = aTileEntity.getTileEntityAtSide(aSide); + toTile = aTileEntity.getTileEntityAtSide(side); fromSlot = aCoverVariable & SLOT_ID_MASK; toSlot = (aCoverVariable >> 14) & SLOT_ID_MASK; } else { - fromTile = aTileEntity.getTileEntityAtSide(aSide); + fromTile = aTileEntity.getTileEntityAtSide(side); toTile = (TileEntity) aTileEntity; fromSlot = (aCoverVariable >> 14) & SLOT_ID_MASK; toSlot = aCoverVariable & SLOT_ID_MASK; } if (fromSlot > 0 && toSlot > 0) { - if (fromTile instanceof IInventory && toTile instanceof IInventory) GT_Utility.moveFromSlotToSlot( - (IInventory) fromTile, - (IInventory) toTile, - fromSlot - 1, - toSlot - 1, - null, - false, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); + if (fromTile instanceof IInventory fromInventory && toTile instanceof IInventory toInventory) + GT_Utility.moveFromSlotToSlot( + fromInventory, + toInventory, + fromSlot - 1, + toSlot - 1, + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); } else if (toSlot > 0) { - byte side; - if ((aCoverVariable & EXPORT_MASK) > 0) side = aSide; - else side = GT_Utility.getOppositeSide(aSide); + final ForgeDirection toSide; + if ((aCoverVariable & EXPORT_MASK) > 0) toSide = side; + else toSide = side.getOpposite(); GT_Utility.moveOneItemStackIntoSlot( fromTile, toTile, - side, + toSide, toSlot - 1, null, false, @@ -113,9 +117,9 @@ public class GT_Cover_Arm extends GT_CoverBehavior { (byte) 64, (byte) 1); } else if (fromSlot > 0) { - byte toSide; - if ((aCoverVariable & EXPORT_MASK) > 0) toSide = aSide; - else toSide = GT_Utility.getOppositeSide(aSide); + final ForgeDirection toSide; + if ((aCoverVariable & EXPORT_MASK) > 0) toSide = side; + else toSide = side.getOpposite(); if (fromTile instanceof IInventory) GT_Utility.moveFromSlotToSide( (IInventory) fromTile, toTile, @@ -128,13 +132,14 @@ public class GT_Cover_Arm extends GT_CoverBehavior { (byte) 64, (byte) 1); } else { - byte fromSide, toSide; + final ForgeDirection fromSide; + final ForgeDirection toSide; if ((aCoverVariable & EXPORT_MASK) > 0) { - fromSide = aSide; - toSide = GT_Utility.getOppositeSide(aSide); + fromSide = side; + toSide = side.getOpposite(); } else { - fromSide = GT_Utility.getOppositeSide(aSide); - toSide = aSide; + fromSide = side.getOpposite(); + toSide = side; } GT_Utility.moveOneItemStack( fromTile, @@ -153,10 +158,10 @@ public class GT_Cover_Arm extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { int step = 0; - if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) { + if (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) { step += aPlayer.isSneaking() ? 256 : 16; } else { step -= aPlayer.isSneaking() ? 256 : 16; @@ -167,10 +172,10 @@ public class GT_Cover_Arm extends GT_CoverBehavior { } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - int step = (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) ? 1 : -1; + int step = (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) ? 1 : -1; int tCoverVariable = getNewVar(aCoverVariable.get(), step); sendMessageToPlayer(aPlayer, tCoverVariable); aCoverVariable.set(tCoverVariable); @@ -179,12 +184,12 @@ public class GT_Cover_Arm extends GT_CoverBehavior { @Override @SuppressWarnings("deprecation") - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - int step = (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) ? 1 : -1; + final int step = (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) ? 1 : -1; aCoverVariable = getNewVar(aCoverVariable, step); sendMessageToPlayer(aPlayer, aCoverVariable); - aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); + aTileEntity.setCoverDataAtSide(side, aCoverVariable); return true; } @@ -217,52 +222,56 @@ public class GT_Cover_Arm extends GT_CoverBehavior { } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return this.mTickRate; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java index 872371a355..5145777f06 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java @@ -1,9 +1,8 @@ package gregtech.common.covers; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -36,9 +35,9 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - if (!makeSureOnlyOne(aSide, aTileEntity)) return 0; + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { + if (!makeSureOnlyOne(side, aTileEntity)) return 0; if (aTileEntity instanceof IMachineProgress machine) { if (aCoverVariable < 2) { if ((aInputRedstone > 0) == (aCoverVariable == 0)) { @@ -64,7 +63,7 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls } return 2; } else { - return 3 + doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable - 3, aTileEntity, aTimer); + return 3 + doCoverThings(side, aInputRedstone, aCoverID, aCoverVariable - 3, aTileEntity, aTimer); } } } @@ -72,7 +71,7 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable.get() != 2; // always off, so no redstone needed either } @@ -83,42 +82,46 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls * * @return true if the cover is the first (side) one **/ - private boolean makeSureOnlyOne(byte aSide, ICoverable aTileEntity) { - return IControlsWorkCover.makeSureOnlyOne(aSide, aTileEntity); + private boolean makeSureOnlyOne(ForgeDirection side, ICoverable aTileEntity) { + return IControlsWorkCover.makeSureOnlyOne(side, aTileEntity); } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRemoval(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { if ((aTileEntity instanceof IMachineProgress)) { ((IMachineProgress) aTileEntity).enableWorking(); @@ -128,7 +131,7 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 5; if (aCoverVariable < 0) { @@ -154,14 +157,14 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior implements IControls } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } @Override - public boolean isCoverPlaceable(byte aSide, ItemStack aStack, ICoverable aTileEntity) { - if (!super.isCoverPlaceable(aSide, aStack, aTileEntity)) return false; - for (byte tSide : ALL_VALID_SIDES) { + public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverable aTileEntity) { + if (!super.isCoverPlaceable(side, aStack, aTileEntity)) return false; + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { if (aTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof IControlsWorkCover) { return false; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java index 80d7dff6ae..bbea07b450 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java @@ -4,6 +4,7 @@ import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -48,24 +49,24 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) { if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) { return aCoverVariable; } } - final TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide); + final TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(side); final Object fromEntity = aCoverVariable % 2 == 0 ? aTileEntity : tTileEntity; final Object toEntity = aCoverVariable % 2 != 0 ? aTileEntity : tTileEntity; - final byte fromSide = aCoverVariable % 2 != 0 ? GT_Utility.getOppositeSide(aSide) : aSide; - final byte toSide = aCoverVariable % 2 == 0 ? GT_Utility.getOppositeSide(aSide) : aSide; + final ForgeDirection fromSide = aCoverVariable % 2 != 0 ? side.getOpposite() : side; + final ForgeDirection toSide = aCoverVariable % 2 == 0 ? side.getOpposite() : side; moveMultipleItemStacks( fromEntity, @@ -84,7 +85,7 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 12; if (aCoverVariable < 0) { @@ -111,52 +112,56 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return (aCoverVariable >= 6) || (aCoverVariable % 2 != 0); } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return (aCoverVariable >= 6) || (aCoverVariable % 2 == 0); } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return this.mTickRate; } @@ -285,11 +290,11 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { } private boolean getClickable(int id, int coverVariable) { - if (coverVariable < 0 | 11 < coverVariable) return false; + if (coverVariable < 0 || 11 < coverVariable) return false; return switch (id) { case 0, 1 -> (0x1 & coverVariable) != id; case 2 -> (coverVariable % 6) >= 2; - case 3 -> (coverVariable % 6) < 2 | 4 <= (coverVariable % 6); + case 3 -> (coverVariable % 6) < 2 || 4 <= (coverVariable % 6); case 4 -> (coverVariable % 6) < 4; case 5 -> coverVariable < 6; case 6 -> coverVariable >= 6; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java b/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java index 139317110b..d985aed767 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Crafting.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.network.play.server.S2DPacketOpenWindow; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -24,13 +25,13 @@ public class GT_Cover_Crafting extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if ((aPlayer instanceof EntityPlayerMP)) { ((EntityPlayerMP) aPlayer).getNextWindowId(); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java index 367f070848..2e60c8cad2 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -32,39 +33,39 @@ public class GT_Cover_DoesWork extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if ((aTileEntity instanceof IMachineProgress)) { if (aCoverVariable < 2) { int tScale = ((IMachineProgress) aTileEntity).getMaxProgress() / 15; if ((tScale > 0) && (((IMachineProgress) aTileEntity).hasThingsToDo())) { aTileEntity.setOutputRedstoneSignal( - aSide, + side, aCoverVariable % 2 == 0 ? (byte) (((IMachineProgress) aTileEntity).getProgress() / tScale) : (byte) (15 - ((IMachineProgress) aTileEntity).getProgress() / tScale)); } else { - aTileEntity.setOutputRedstoneSignal(aSide, (byte) (aCoverVariable % 2 == 0 ? 0 : 15)); + aTileEntity.setOutputRedstoneSignal(side, (byte) (aCoverVariable % 2 == 0 ? 0 : 15)); } } else { aTileEntity.setOutputRedstoneSignal( - aSide, + side, (byte) ((aCoverVariable % 2 == 0 ? 1 : 0) != (((IMachineProgress) aTileEntity).getMaxProgress() == 0 ? 1 : 0) ? 0 : 15)); } } else { - aTileEntity.setOutputRedstoneSignal(aSide, (byte) 0); + aTileEntity.setOutputRedstoneSignal(side, (byte) 0); } return aCoverVariable; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 4; if (aCoverVariable < 0) { @@ -84,43 +85,47 @@ public class GT_Cover_DoesWork extends GT_CoverBehavior { } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 5; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Drain.java b/src/main/java/gregtech/common/covers/GT_Cover_Drain.java index 82c6e78c57..14b25e4777 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Drain.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Drain.java @@ -31,23 +31,23 @@ public class GT_Cover_Drain extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if ((aCoverVariable % 3 > 1) && ((aTileEntity instanceof IMachineProgress))) { if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 3 < 2) { return aCoverVariable; } } - if (aSide != 6) { - Block tBlock = aTileEntity.getBlockAtSide(aSide); + if (side != ForgeDirection.UNKNOWN) { + final Block tBlock = aTileEntity.getBlockAtSide(side); if ((aCoverVariable < 3) && ((aTileEntity instanceof IFluidHandler))) { - if ((aSide == 1) && (aTileEntity.getWorld() + if ((side == ForgeDirection.UP) && (aTileEntity.getWorld() .isRaining()) && (aTileEntity.getWorld() .getPrecipitationHeight(aTileEntity.getXCoord(), aTileEntity.getZCoord()) - 2 @@ -55,7 +55,7 @@ public class GT_Cover_Drain extends GT_CoverBehavior { int tAmount = (int) (aTileEntity.getBiome().rainfall * 10.0F); if (tAmount > 0) { ((IFluidHandler) aTileEntity).fill( - ForgeDirection.getOrientation(aSide), + side, Materials.Water.getFluid( aTileEntity.getWorld() .isThundering() ? tAmount * 2 : tAmount), @@ -65,32 +65,31 @@ public class GT_Cover_Drain extends GT_CoverBehavior { FluidStack tLiquid = null; if (tBlock != null) { if (((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water)) - && (aTileEntity.getMetaIDAtSide(aSide) == 0)) { + && (aTileEntity.getMetaIDAtSide(side) == 0)) { tLiquid = Materials.Water.getFluid(1000L); } else if (((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) - && (aTileEntity.getMetaIDAtSide(aSide) == 0)) { + && (aTileEntity.getMetaIDAtSide(side) == 0)) { tLiquid = Materials.Lava.getFluid(1000L); } else if ((tBlock instanceof IFluidBlock)) { tLiquid = ((IFluidBlock) tBlock).drain( aTileEntity.getWorld(), - aTileEntity.getOffsetX(aSide, 1), - aTileEntity.getOffsetY(aSide, 1), - aTileEntity.getOffsetZ(aSide, 1), + aTileEntity.getOffsetX(side, 1), + aTileEntity.getOffsetY(side, 1), + aTileEntity.getOffsetZ(side, 1), false); } if ((tLiquid != null) && (tLiquid.getFluid() != null) - && ((aSide > 1) || ((aSide == 0) && (tLiquid.getFluid() + && ((side.ordinal() > 1) || ((side == ForgeDirection.DOWN) && (tLiquid.getFluid() .getDensity() <= 0)) - || ((aSide == 1) && (tLiquid.getFluid() + || ((side == ForgeDirection.UP) && (tLiquid.getFluid() .getDensity() >= 0))) - && (((IFluidHandler) aTileEntity).fill(ForgeDirection.getOrientation(aSide), tLiquid, false) - == tLiquid.amount)) { - ((IFluidHandler) aTileEntity).fill(ForgeDirection.getOrientation(aSide), tLiquid, true); + && (((IFluidHandler) aTileEntity).fill(side, tLiquid, false) == tLiquid.amount)) { + ((IFluidHandler) aTileEntity).fill(side, tLiquid, true); aTileEntity.getWorld() .setBlockToAir( - aTileEntity.getXCoord() + ForgeDirection.getOrientation(aSide).offsetX, - aTileEntity.getYCoord() + ForgeDirection.getOrientation(aSide).offsetY, - aTileEntity.getZCoord() + ForgeDirection.getOrientation(aSide).offsetZ); + aTileEntity.getXCoord() + side.offsetX, + aTileEntity.getYCoord() + side.offsetY, + aTileEntity.getZCoord() + side.offsetZ); } } } @@ -101,9 +100,9 @@ public class GT_Cover_Drain extends GT_CoverBehavior { || ((tBlock instanceof IFluidBlock)))) { aTileEntity.getWorld() .setBlock( - aTileEntity.getOffsetX(aSide, 1), - aTileEntity.getOffsetY(aSide, 1), - aTileEntity.getOffsetZ(aSide, 1), + aTileEntity.getOffsetX(side, 1), + aTileEntity.getOffsetY(side, 1), + aTileEntity.getOffsetZ(side, 1), Blocks.air, 0, 0); @@ -113,7 +112,7 @@ public class GT_Cover_Drain extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 6; if (aCoverVariable < 0) { @@ -131,17 +130,18 @@ public class GT_Cover_Drain extends GT_CoverBehavior { } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return ((IMachineProgress) aTileEntity).isAllowedToWork() == aCoverVariable < 2; } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return aCoverVariable < 3 ? 50 : 1; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java index 613e1e546d..d91e62a687 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.google.common.io.ByteArrayDataInput; @@ -57,8 +58,8 @@ public class GT_Cover_EUMeter extends GT_CoverBehaviorBase<GT_Cover_EUMeter.EUMe } @Override - protected EUMeterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, EUMeterData aCoverVariable, - ICoverable aTileEntity, long aTimer) { + protected EUMeterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, + EUMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { final long stored = aCoverVariable.type.getTileEntityStoredEnergy(aTileEntity); final long capacity = aCoverVariable.type.getTileEntityEnergyCapacity(aTileEntity); @@ -87,12 +88,12 @@ public class GT_Cover_EUMeter extends GT_CoverBehaviorBase<GT_Cover_EUMeter.EUMe } } - aTileEntity.setOutputRedstoneSignal(aSide, redstoneSignal); + aTileEntity.setOutputRedstoneSignal(side, redstoneSignal); return aCoverVariable; } @Override - protected EUMeterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, + protected EUMeterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { int num = (aCoverVariable.getNum() + (aPlayer.isSneaking() ? -1 : 1) + EnergyType.values().length * 2) % (EnergyType.values().length * 2); @@ -119,53 +120,56 @@ public class GT_Cover_EUMeter extends GT_CoverBehaviorBase<GT_Cover_EUMeter.EUMe // region Static Result Methods @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, int aSlot, + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, int aSlot, + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, EUMeterData aCoverVariable, + ICoverable aTileEntity) { return 20; } // endregion diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java b/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java index 87ceb05204..a8d853dc1b 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java @@ -1,7 +1,5 @@ package gregtech.common.covers; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; - import javax.annotation.Nonnull; import net.minecraft.block.Block; @@ -57,7 +55,7 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected FacadeData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected FacadeData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable.mFlags = ((aCoverVariable.mFlags + 1) & 15); GT_Utility.sendChatToPlayer( @@ -70,55 +68,57 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 1) != 0; } @Override - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 1) != 0; } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { return (aCoverVariable.mFlags & 2) != 0; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { return (aCoverVariable.mFlags & 2) != 0; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 4) != 0; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 4) != 0; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, int aSlot, + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, int aSlot, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 8) != 0; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, int aSlot, + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, int aSlot, ICoverable aTileEntity) { return (aCoverVariable.mFlags & 8) != 0; } @Override - public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) { + public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEntity) { aTileEntity.setCoverIdAndDataAtSide( - aSide, + side, GT_Utility.stackToInt(aCover), new FacadeData(GT_Utility.copyAmount(1, aCover), 0)); @@ -132,18 +132,19 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected ItemStack getDropImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected ItemStack getDropImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { return aCoverVariable.mStack; } @Override - protected ITexture getSpecialCoverFGTextureImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected ITexture getSpecialCoverFGTextureImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { - return getSpecialCoverTextureImpl(aSide, aCoverID, aCoverVariable, aTileEntity); + return getSpecialCoverTextureImpl(side, aCoverID, aCoverVariable, aTileEntity); } @Override - protected ITexture getSpecialCoverTextureImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected ITexture getSpecialCoverTextureImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { if (GT_Utility.isStackInvalid(aCoverVariable.mStack)) return Textures.BlockIcons.ERROR_RENDERING[0]; Block block = getTargetBlock(aCoverVariable.mStack); @@ -153,18 +154,20 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ return TextureFactory.builder() .setFromBlock(block, getTargetMeta(aCoverVariable.mStack)) .useWorldCoord() - .setFromSide(ForgeDirection.getOrientation(aSide)) + .setFromSide(side) .build(); } @Override - protected Block getFacadeBlockImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected Block getFacadeBlockImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { if (GT_Utility.isStackInvalid(aCoverVariable.mStack)) return null; return getTargetBlock(aCoverVariable.mStack); } @Override - protected int getFacadeMetaImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected int getFacadeMetaImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { if (GT_Utility.isStackInvalid(aCoverVariable.mStack)) return 0; return getTargetMeta(aCoverVariable.mStack); } @@ -174,13 +177,14 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ protected abstract int getTargetMeta(ItemStack aFacadeStack); @Override - protected boolean isDataNeededOnClientImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, + protected boolean isDataNeededOnClientImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected void onDataChangedImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected void onDataChangedImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity) { if (aTileEntity.isClientSide()) GT_RenderingWorld.getInstance() .register( aTileEntity.getXCoord(), @@ -191,12 +195,12 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected void onDroppedImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { + protected void onDroppedImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { if (aTileEntity.isClientSide()) { - for (byte i : ALL_VALID_SIDES) { - if (i == aSide) continue; + for (final ForgeDirection iSide : ForgeDirection.VALID_DIRECTIONS) { + if (iSide == side) continue; // since we do not allow multiple type of facade per block, this check would be enough. - if (aTileEntity.getCoverBehaviorAtSideNew(i) instanceof GT_Cover_FacadeBase) return; + if (aTileEntity.getCoverBehaviorAtSideNew(iSide) instanceof GT_Cover_FacadeBase) return; } if (aCoverVariable.mStack != null) // mStack == null -> cover removed before data reach client @@ -211,28 +215,28 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, FacadeData aCoverVariable, + ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { // in case cover data didn't hit client somehow. maybe he had a ridiculous view distance - aTileEntity.issueCoverUpdate(aSide); - return super.onCoverRightClickImpl(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); + aTileEntity.issueCoverUpdate(side); + return super.onCoverRightClickImpl(side, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); } @Override - public boolean isCoverPlaceable(byte aSide, ItemStack aStack, ICoverable aTileEntity) { + public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverable aTileEntity) { // blocks that are not rendered in pass 0 are now accepted but rendered awkwardly // to render it correctly require changing GT_Block_Machine to render in both pass, which is not really a good // idea... - if (!super.isCoverPlaceable(aSide, aStack, aTileEntity)) return false; + if (!super.isCoverPlaceable(side, aStack, aTileEntity)) return false; final Block targetBlock = getTargetBlock(aStack); if (targetBlock == null) return false; // we allow one single type of facade on the same block for now // otherwise it's not clear which block this block should impersonate // this restriction can be lifted later by specifying a certain facade as dominate one as an extension to this // class - for (byte i : ALL_VALID_SIDES) { - if (i == aSide) continue; - final CoverInfo coverInfo = aTileEntity.getCoverInfoAtSide(i); + for (final ForgeDirection iSide : ForgeDirection.VALID_DIRECTIONS) { + if (iSide == side) continue; + final CoverInfo coverInfo = aTileEntity.getCoverInfoAtSide(iSide); if (!coverInfo.isValid()) continue; final Block facadeBlock = coverInfo.getFacadeBlock(); if (facadeBlock == null) continue; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java index 199d22407a..e1832d5a54 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java @@ -45,8 +45,8 @@ public class GT_Cover_FluidLimiter extends GT_CoverBehaviorBase<GT_Cover_FluidLi } @Override - protected FluidLimiterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, FluidLimiterData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected FluidLimiterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + FluidLimiterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aTileEntity instanceof IFluidHandler) { adjustThreshold(aCoverVariable, !aPlayer.isSneaking()); GT_Utility.sendChatToPlayer(aPlayer, String.format("Threshold: %f", aCoverVariable.threshold)); @@ -55,13 +55,13 @@ public class GT_Cover_FluidLimiter extends GT_CoverBehaviorBase<GT_Cover_FluidLi } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, FluidLimiterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, FluidLimiterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return allowsFluidIn(aCoverVariable, aTileEntity); } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, FluidLimiterData aCoverVariable, + protected boolean alwaysLookConnectedImpl(ForgeDirection side, int aCoverID, FluidLimiterData aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java index 6af664b594..13796e0915 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java @@ -87,34 +87,32 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable.condition.isRedstoneSensitive(); } @Override - protected FluidRegulatorData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected FluidRegulatorData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity, long aTimer) { - if (aCoverVariable.speed == 0 || !aCoverVariable.condition.isAllowedToWork(aSide, aCoverID, aTileEntity)) { + if (aCoverVariable.speed == 0 || !aCoverVariable.condition.isAllowedToWork(side, aCoverID, aTileEntity)) { return aCoverVariable; } if ((aTileEntity instanceof IFluidHandler)) { - IFluidHandler tTank1; - IFluidHandler tTank2; - ForgeDirection directionFrom; - ForgeDirection directionTo; + final IFluidHandler tTank1; + final IFluidHandler tTank2; + final ForgeDirection directionFrom; + final ForgeDirection directionTo; if (aCoverVariable.speed > 0) { - tTank2 = aTileEntity.getITankContainerAtSide(aSide); + tTank2 = aTileEntity.getITankContainerAtSide(side); tTank1 = (IFluidHandler) aTileEntity; - directionFrom = ForgeDirection.getOrientation(aSide); - directionTo = ForgeDirection.getOrientation(aSide) - .getOpposite(); + directionFrom = side; + directionTo = side.getOpposite(); } else { - tTank1 = aTileEntity.getITankContainerAtSide(aSide); + tTank1 = aTileEntity.getITankContainerAtSide(side); tTank2 = (IFluidHandler) aTileEntity; - directionFrom = ForgeDirection.getOrientation(aSide) - .getOpposite(); - directionTo = ForgeDirection.getOrientation(aSide); + directionFrom = side.getOpposite(); + directionTo = side; } if (tTank1 != null && tTank2 != null) { allowFluid = true; @@ -159,9 +157,9 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid } @Override - public FluidRegulatorData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) { + public FluidRegulatorData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + FluidRegulatorData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) { adjustSpeed(aPlayer, aCoverVariable, aPlayer.isSneaking() ? 256 : 16); } else { adjustSpeed(aPlayer, aCoverVariable, aPlayer.isSneaking() ? -256 : -16); @@ -170,9 +168,9 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) { + if (GT_Utility.getClickedFacingCoords(side, aX, aY, aZ)[0] >= 0.5F) { adjustSpeed(aPlayer, aCoverVariable, 1); } else { adjustSpeed(aPlayer, aCoverVariable, -1); @@ -185,61 +183,62 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid } @Override - public boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + public boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + public boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyInImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + public boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOutImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + public boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsInImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, int aSlot, + public boolean letsItemsInImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOutImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, int aSlot, + public boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidInImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, Fluid aFluid, + public boolean letsFluidInImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return allowFluid; } @Override - public boolean letsFluidOutImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, Fluid aFluid, + public boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return allowFluid; } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, + protected boolean alwaysLookConnectedImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, FluidRegulatorData aCoverVariable, + ICoverable aTileEntity) { return aCoverVariable.tickRate; } @@ -412,21 +411,21 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid Always(false) { @Override - boolean isAllowedToWork(byte aSide, int aCoverID, ICoverable aTileEntity) { + boolean isAllowedToWork(ForgeDirection side, int aCoverID, ICoverable aTileEntity) { return true; } }, Conditional(true) { @Override - boolean isAllowedToWork(byte aSide, int aCoverID, ICoverable aTileEntity) { + boolean isAllowedToWork(ForgeDirection side, int aCoverID, ICoverable aTileEntity) { return !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork(); } }, Inverted(true) { @Override - boolean isAllowedToWork(byte aSide, int aCoverID, ICoverable aTileEntity) { + boolean isAllowedToWork(ForgeDirection side, int aCoverID, ICoverable aTileEntity) { return !(aTileEntity instanceof IMachineProgress) || !((IMachineProgress) aTileEntity).isAllowedToWork(); } @@ -439,7 +438,7 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid this.redstoneSensitive = redstoneSensitive; } - abstract boolean isAllowedToWork(byte aSide, int aCoverID, ICoverable aTileEntity); + abstract boolean isAllowedToWork(ForgeDirection side, int aCoverID, ICoverable aTileEntity); boolean isRedstoneSensitive() { return redstoneSensitive; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidStorageMonitor.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidStorageMonitor.java index 81c41bf59a..27bab9cc55 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidStorageMonitor.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidStorageMonitor.java @@ -51,7 +51,7 @@ import io.netty.buffer.ByteBuf; /** * TODO: Implement overlay rendering only with - * {@link GT_CoverBehaviorBase#getSpecialCoverFGTextureImpl(byte, int, ISerializableObject, ICoverable)} + * {@link GT_CoverBehaviorBase#getSpecialCoverFGTextureImpl(ForgeDirection, int, ISerializableObject, ICoverable)} */ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_FluidStorageMonitor.FluidStorageData> { @@ -77,12 +77,12 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected FluidStorageData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected FluidStorageData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity, long aTimer) { final FluidTankInfo[] tanks = getValidFluidTankInfos(aTileEntity, aCoverVariable.side); if (tanks == null) { return aCoverVariable.disable() - .issueCoverUpdateIfNeeded(aTileEntity, aSide); + .issueCoverUpdateIfNeeded(aTileEntity, side); } assert 0 < tanks.length; @@ -93,22 +93,22 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ final FluidTankInfo tank = tanks[aCoverVariable.slot]; if (tank == null) { return aCoverVariable.setNullTank() - .issueCoverUpdateIfNeeded(aTileEntity, aSide); + .issueCoverUpdateIfNeeded(aTileEntity, side); } return aCoverVariable.setFluid(tank.fluid) .setScale(getTankScale(tank)) - .issueCoverUpdateIfNeeded(aTileEntity, aSide); + .issueCoverUpdateIfNeeded(aTileEntity, side); } @Override - protected ITexture getSpecialCoverFGTextureImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, + protected ITexture getSpecialCoverFGTextureImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity) { - return getSpecialCoverTextureImpl(aSide, aCoverID, aCoverVariable, aTileEntity); + return getSpecialCoverTextureImpl(side, aCoverID, aCoverVariable, aTileEntity); } @Override - protected ITexture getSpecialCoverTextureImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, + protected ITexture getSpecialCoverTextureImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity) { if (aCoverVariable.slot == -1 || aCoverVariable.fluid == null || aCoverVariable.scale == 0) { return TextureFactory.of(OVERLAY_FLUID_STORAGE_MONITOR0); @@ -140,7 +140,7 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer == null || aPlayer.worldObj == null || aPlayer.worldObj.isRemote) { return false; @@ -266,8 +266,8 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected FluidStorageData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected FluidStorageData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + FluidStorageData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { aCoverVariable .setSide(ForgeDirection.values()[(aCoverVariable.side.ordinal() + 1) % ForgeDirection.values().length]) @@ -291,25 +291,26 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ } @Override - protected boolean isDataNeededOnClientImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, + protected boolean isDataNeededOnClientImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, FluidStorageData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, FluidStorageData aCoverVariable, + ICoverable aTileEntity) { return 10; } @@ -408,7 +409,7 @@ public class GT_Cover_FluidStorageMonitor extends GT_CoverBehaviorBase<GT_Cover_ .setScale(0); } - public FluidStorageData issueCoverUpdateIfNeeded(ICoverable tileEntity, byte side) { + public FluidStorageData issueCoverUpdateIfNeeded(ICoverable tileEntity, ForgeDirection side) { if (this.dirty) { tileEntity.issueCoverUpdate(side); this.dirty = false; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java index 22db900f18..79f94f8d5b 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.Constants.NBT; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -67,7 +68,7 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected String getDescriptionImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, + protected String getDescriptionImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { final Fluid fluid = FluidRegistry.getFluid(aCoverVariable.mFluidID); if (fluid == null) return E; @@ -78,13 +79,13 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - protected FluidFilterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected FluidFilterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable; } @@ -104,8 +105,8 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected FluidFilterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected FluidFilterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + FluidFilterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable.mFilterMode = (aCoverVariable.mFilterMode + (aPlayer.isSneaking() ? -1 : 1)) % 8; if (aCoverVariable.mFilterMode < 0) { aCoverVariable.mFilterMode = 7; @@ -117,21 +118,20 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (((aX > 0.375D) && (aX < 0.625D)) || ((aSide > 3) && ((aY > 0.375D) && (aY < 0.625D))) - || ((aSide < 2) && ((aZ > 0.375D) && (aZ < 0.625D))) - || (aSide == 2) - || (aSide == 3)) { - ItemStack tStack = aPlayer.inventory.getCurrentItem(); + if (((aX > 0.375D) && (aX < 0.625D)) || ((side.offsetX != 0) && ((aY > 0.375D) && (aY < 0.625D))) + || ((side.offsetY != 0) && ((aZ > 0.375D) && (aZ < 0.625D))) + || (side.offsetZ != 0)) { + final ItemStack tStack = aPlayer.inventory.getCurrentItem(); if (tStack == null) return true; - FluidStack tFluid = GT_Utility.getFluidForFilledItem(tStack, true); + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tStack, true); if (tFluid != null) { - int aFluid = tFluid.getFluidID(); + final int aFluid = tFluid.getFluidID(); aCoverVariable.mFluidID = aFluid; - aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); - FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aFluid), 1000); + aTileEntity.setCoverDataAtSide(side, aCoverVariable); + final FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aFluid), 1000); GT_Utility .sendChatToPlayer(aPlayer, GT_Utility.trans("047", "Filter Fluid: ") + sFluid.getLocalizedName()); } @@ -141,43 +141,43 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, - GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, - GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsInImpl(byte aSide, int aCoverID, GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, - int aSlot, ICoverable aTileEntity) { + public boolean letsItemsInImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOutImpl(byte aSide, int aCoverID, GT_Cover_Fluidfilter.FluidFilterData aCoverVariable, - int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { if (aFluid == null) return true; @@ -192,7 +192,7 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { if (aFluid == null) return true; @@ -207,13 +207,14 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, + protected boolean alwaysLookConnectedImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, FluidFilterData aCoverVariable, + ICoverable aTileEntity) { return 0; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java index 0e5f57ad6d..c0cdee78a3 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java @@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.google.common.io.ByteArrayDataInput; @@ -63,27 +64,28 @@ public class GT_Cover_ItemFilter extends GT_CoverBehaviorBase<GT_Cover_ItemFilte } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - protected ItemFilterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected ItemFilterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity, long aTimer) { - TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide); - Object fromEntity = mExport ? aTileEntity : tTileEntity, toEntity = !mExport ? aTileEntity : tTileEntity; - byte fromSide = !mExport ? GT_Utility.getOppositeSide(aSide) : aSide, - toSide = mExport ? GT_Utility.getOppositeSide(aSide) : aSide; + final TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(side); + final Object fromEntity = mExport ? aTileEntity : tTileEntity; + final Object toEntity = !mExport ? aTileEntity : tTileEntity; + final ForgeDirection fromSide = !mExport ? side.getOpposite() : side; + final ForgeDirection toSide = mExport ? side.getOpposite() : side; - List<ItemStack> Filter = Collections.singletonList(aCoverVariable.mFilter); + final List<ItemStack> filter = Collections.singletonList(aCoverVariable.mFilter); moveMultipleItemStacks( fromEntity, toEntity, fromSide, toSide, - Filter, + filter, aCoverVariable.mWhitelist, (byte) 64, (byte) 1, @@ -95,9 +97,9 @@ public class GT_Cover_ItemFilter extends GT_CoverBehaviorBase<GT_Cover_ItemFilte } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - ItemStack tStack = aPlayer.inventory.getCurrentItem(); + final ItemStack tStack = aPlayer.inventory.getCurrentItem(); if (tStack != null) { aCoverVariable.mFilter = tStack; GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("299", "Item Filter: ") + tStack.getDisplayName()); @@ -109,8 +111,8 @@ public class GT_Cover_ItemFilter extends GT_CoverBehaviorBase<GT_Cover_ItemFilte } @Override - protected ItemFilterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected ItemFilterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + ItemFilterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable.mWhitelist = !aCoverVariable.mWhitelist; GT_Utility.sendChatToPlayer( aPlayer, @@ -120,61 +122,62 @@ public class GT_Cover_ItemFilter extends GT_CoverBehaviorBase<GT_Cover_ItemFilte } @Override - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, int aSlot, + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, int aSlot, + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, + protected boolean alwaysLookConnectedImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, ItemFilterData aCoverVariable, + ICoverable aTileEntity) { return 1; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java index 99241731fc..86c0f4c4dc 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.google.common.io.ByteArrayDataInput; @@ -71,16 +72,16 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } public static byte computeSignalBasedOnItems(ICoverable tileEntity, boolean inverted, int threshold, int slot, - int side) { + int ordinalSide) { long max = 0; long used = 0; - IMetaTileEntity mte = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + final IMetaTileEntity mte = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); if (mte instanceof GT_MetaTileEntity_DigitalChestBase dc) { max = dc.getMaxItemCount(); used = dc.getProgresstime(); @@ -90,12 +91,12 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. used = 64; } } else { - int[] slots = slot >= 0 ? new int[] { slot } : tileEntity.getAccessibleSlotsFromSide(side); + final int[] slots = slot >= 0 ? new int[] { slot } : tileEntity.getAccessibleSlotsFromSide(ordinalSide); for (int i : slots) { if (i >= 0 && i < tileEntity.getSizeInventory()) { max += 64; - ItemStack stack = tileEntity.getStackInSlot(i); + final ItemStack stack = tileEntity.getStackInSlot(i); if (stack != null) used += ((long) stack.stackSize << 6) / stack.getMaxStackSize(); } } @@ -105,21 +106,21 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. } @Override - protected ItemMeterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected ItemMeterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { byte signal = computeSignalBasedOnItems( aTileEntity, aCoverVariable.inverted, aCoverVariable.threshold, aCoverVariable.slot, - aSide); - aTileEntity.setOutputRedstoneSignal(aSide, signal); + side.ordinal()); + aTileEntity.setOutputRedstoneSignal(side, signal); return aCoverVariable; } @Override - protected ItemMeterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, + protected ItemMeterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { if (aCoverVariable.inverted) { @@ -142,48 +143,50 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, int aSlot, + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, int aSlot, + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, - ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, + ItemMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable, + ICoverable aTileEntity) { return 5; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Lens.java b/src/main/java/gregtech/common/covers/GT_Cover_Lens.java index 092973767a..9e531e552c 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Lens.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Lens.java @@ -1,5 +1,7 @@ package gregtech.common.covers; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; @@ -22,13 +24,13 @@ public class GT_Cover_Lens extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public byte getLensColor(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public byte getLensColor(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return this.mColor; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java index af97e190ce..ef60efb01a 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java @@ -34,7 +34,7 @@ import io.netty.buffer.ByteBuf; /** * TODO: Implement overlay rendering only with - * {@link GT_CoverBehaviorBase#getSpecialCoverFGTextureImpl(byte, int, ISerializableObject, ICoverable)} + * {@link GT_CoverBehaviorBase#getSpecialCoverFGTextureImpl(ForgeDirection, int, ISerializableObject, ICoverable)} */ public class GT_Cover_LiquidMeter extends GT_CoverBehaviorBase<GT_Cover_LiquidMeter.LiquidMeterData> { @@ -53,7 +53,7 @@ public class GT_Cover_LiquidMeter extends GT_CoverBehaviorBase<GT_Cover_LiquidMe } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @@ -86,21 +86,21 @@ public class GT_Cover_LiquidMeter extends GT_CoverBehaviorBase<GT_Cover_LiquidMe } @Override - protected LiquidMeterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + protected LiquidMeterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity, long aTimer) { byte signal = computeSignalBasedOnFluid(aTileEntity, aCoverVariable.inverted, aCoverVariable.threshold); if (aCoverVariable.strong) { - aTileEntity.setStrongOutputRedstoneSignal(aSide, signal); + aTileEntity.setStrongOutputRedstoneSignal(side, signal); } else { - aTileEntity.setOutputRedstoneSignal(aSide, signal); + aTileEntity.setOutputRedstoneSignal(side, signal); } return aCoverVariable; } @Override - protected LiquidMeterData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, - ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected LiquidMeterData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, + LiquidMeterData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aCoverVariable.inverted) { aCoverVariable.inverted = false; GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("055", "Normal")); @@ -112,49 +112,50 @@ public class GT_Cover_LiquidMeter extends GT_CoverBehaviorBase<GT_Cover_LiquidMe } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, int aSlot, + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, int aSlot, + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, - ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, + LiquidMeterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable, + ICoverable aTileEntity) { return 5; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java index 5fc9354c18..712c3a94bb 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java @@ -2,6 +2,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -41,22 +42,22 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { boolean needsRepair = false; if (aTileEntity instanceof IGregTechTileEntity tTileEntity) { - IMetaTileEntity mTileEntity = tTileEntity.getMetaTileEntity(); + final IMetaTileEntity mTileEntity = tTileEntity.getMetaTileEntity(); if (mTileEntity instanceof GT_MetaTileEntity_MultiBlockBase multi) { - int ideal = multi.getIdealStatus(); - int real = multi.getRepairStatus(); - ItemStack tRotor = multi.getRealInventory()[1]; - int coverVar = aCoverVariable >>> 1; + final int ideal = multi.getIdealStatus(); + final int real = multi.getRepairStatus(); + final ItemStack tRotor = multi.getRealInventory()[1]; + final int coverVar = aCoverVariable >>> 1; if (coverVar < 5) { if (ideal - real > coverVar) needsRepair = true; } else if (coverVar == 5 || coverVar == 6) { @@ -82,13 +83,13 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { needsRepair = !needsRepair; } - aTileEntity.setOutputRedstoneSignal(aSide, (byte) (needsRepair ? 0 : 15)); - aTileEntity.setOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide), (byte) (needsRepair ? 0 : 15)); + aTileEntity.setOutputRedstoneSignal(side, (byte) (needsRepair ? 0 : 15)); + aTileEntity.setOutputRedstoneSignal(side.getOpposite(), (byte) (needsRepair ? 0 : 15)); return aCoverVariable; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 14; if (aCoverVariable < 0) { @@ -126,43 +127,47 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 60; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java index 13054bccf6..8d0b7d46b5 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java @@ -2,6 +2,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -35,14 +36,14 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { boolean playerDetected = false; if (aTileEntity instanceof IGregTechTileEntity) { @@ -81,12 +82,12 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior { } } - aTileEntity.setOutputRedstoneSignal(aSide, (byte) (playerDetected ? 15 : 0)); + aTileEntity.setOutputRedstoneSignal(side, (byte) (playerDetected ? 15 : 0)); return aCoverVariable; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 3; if (aCoverVariable < 0) { @@ -101,43 +102,47 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior { } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 20; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java index 045eec872c..278bf488e3 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java @@ -38,59 +38,40 @@ public class GT_Cover_Pump extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) { if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) { return aCoverVariable; } } if ((aTileEntity instanceof IFluidHandler)) { - IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(aSide); + final IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(side); if (tTank2 != null) { // aTileEntity.decreaseStoredEnergyUnits(GT_Utility.getTier(this.mTransferRate), true); - IFluidHandler tTank1 = (IFluidHandler) aTileEntity; + final IFluidHandler tTank1 = (IFluidHandler) aTileEntity; if (aCoverVariable % 2 == 0) { - FluidStack tLiquid = tTank1.drain(ForgeDirection.getOrientation(aSide), this.mTransferRate, false); + FluidStack tLiquid = tTank1.drain(side, this.mTransferRate, false); if (tLiquid != null) { tLiquid = tLiquid.copy(); - tLiquid.amount = tTank2.fill( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - tLiquid, - false); + tLiquid.amount = tTank2.fill(side.getOpposite(), tLiquid, false); if (tLiquid.amount > 0 && canTransferFluid(tLiquid)) { - tTank2.fill( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), - true); + tTank2.fill(side.getOpposite(), tTank1.drain(side, tLiquid.amount, true), true); } } } else { - FluidStack tLiquid = tTank2.drain( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - this.mTransferRate, - false); + FluidStack tLiquid = tTank2.drain(side.getOpposite(), this.mTransferRate, false); if (tLiquid != null) { tLiquid = tLiquid.copy(); - tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false); + tLiquid.amount = tTank1.fill(side, tLiquid, false); if (tLiquid.amount > 0 && canTransferFluid(tLiquid)) { - tTank1.fill( - ForgeDirection.getOrientation(aSide), - tTank2.drain( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - tLiquid.amount, - true), - true); + tTank1.fill(side, tTank2.drain(side.getOpposite(), tLiquid.amount, true), true); } } } @@ -104,7 +85,7 @@ public class GT_Cover_Pump extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 12; if (aCoverVariable < 0) { @@ -131,37 +112,40 @@ public class GT_Cover_Pump extends GT_CoverBehavior { } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) { if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) { return false; @@ -171,7 +155,8 @@ public class GT_Cover_Pump extends GT_CoverBehavior { } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) { if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) { return false; @@ -181,12 +166,12 @@ public class GT_Cover_Pump extends GT_CoverBehavior { } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java index 7205876fca..edaec13a81 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneConductor.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import gregtech.api.interfaces.ITexture; @@ -16,26 +17,26 @@ public class GT_Cover_RedstoneConductor extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if (aCoverVariable == 0) { - aTileEntity.setOutputRedstoneSignal(aSide, aTileEntity.getStrongestRedstone()); + aTileEntity.setOutputRedstoneSignal(side, aTileEntity.getStrongestRedstone()); } else if (aCoverVariable < 7) { aTileEntity.setOutputRedstoneSignal( - aSide, - aTileEntity.getInternalInputRedstoneSignal((byte) (aCoverVariable - 1))); + side, + aTileEntity.getInternalInputRedstoneSignal(ForgeDirection.getOrientation((aCoverVariable - 1)))); } return aCoverVariable; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 7; if (aCoverVariable < 0) { @@ -54,43 +55,47 @@ public class GT_Cover_RedstoneConductor extends GT_CoverBehavior { } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java index 00890541bc..963ef4cbbf 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverExternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -19,29 +21,29 @@ public class GT_Cover_RedstoneReceiverExternal extends GT_Cover_RedstoneWireless } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { aTileEntity.setOutputRedstoneSignal( - aSide, + side, GregTech_API.sWirelessRedstone.get(aCoverVariable) == null ? 0 : GregTech_API.sWirelessRedstone.get(aCoverVariable)); return aCoverVariable; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java index 899db734af..8b94861730 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -21,10 +23,10 @@ public class GT_Cover_RedstoneReceiverInternal extends GT_Cover_RedstoneWireless } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { if (aTileEntity instanceof IMachineProgress) { - if (getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity) > 0) + if (getRedstoneInput(side, aInputRedstone, aCoverID, aCoverVariable, aTileEntity) > 0) ((IMachineProgress) aTileEntity).enableWorking(); else((IMachineProgress) aTileEntity).disableWorking(); ((IMachineProgress) aTileEntity).setWorkDataValue(aInputRedstone); @@ -33,20 +35,20 @@ public class GT_Cover_RedstoneReceiverInternal extends GT_Cover_RedstoneWireless } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } @Override - public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, + public byte getRedstoneInput(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return GregTech_API.sWirelessRedstone.get(aCoverVariable) == null ? 0 : GregTech_API.sWirelessRedstone.get(aCoverVariable); } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java index d8ace5b4d2..4eead134c8 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneSignalizer.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import gregtech.api.interfaces.ITexture; @@ -17,13 +18,13 @@ public class GT_Cover_RedstoneSignalizer extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + 1) % 48; switch (aCoverVariable / 16) { @@ -39,42 +40,46 @@ public class GT_Cover_RedstoneSignalizer extends GT_CoverBehavior { } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, + public byte getRedstoneInput(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { if (aCoverVariable < 16) { return (byte) (aCoverVariable & 0xF); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterExternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterExternal.java index 05374fb096..e2efbc3d87 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterExternal.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterExternal.java @@ -1,8 +1,7 @@ package gregtech.common.covers; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; - import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -25,34 +24,34 @@ public class GT_Cover_RedstoneTransmitterExternal extends GT_Cover_RedstoneWirel } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { // TODO remove next line after 2.3.0 - if (!IControlsWorkCover.makeSureOnlyOne(aSide, aTileEntity)) return aCoverVariable; + if (!IControlsWorkCover.makeSureOnlyOne(side, aTileEntity)) return aCoverVariable; GregTech_API.sWirelessRedstone.put(aCoverVariable, aInputRedstone); return aCoverVariable; } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } @Override - public boolean isCoverPlaceable(byte aSide, ItemStack aStack, ICoverable aTileEntity) { - if (!super.isCoverPlaceable(aSide, aStack, aTileEntity)) return false; - for (byte tSide : ALL_VALID_SIDES) { + public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverable aTileEntity) { + if (!super.isCoverPlaceable(side, aStack, aTileEntity)) return false; + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { if (aTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof IControlsWorkCover) { return false; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java index 43dbfea1de..a7f39fccf0 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneTransmitterInternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -19,30 +21,30 @@ public class GT_Cover_RedstoneTransmitterInternal extends GT_Cover_RedstoneWirel } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - GregTech_API.sWirelessRedstone.put(aCoverVariable, aTileEntity.getOutputRedstoneSignal(aSide)); + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { + GregTech_API.sWirelessRedstone.put(aCoverVariable, aTileEntity.getOutputRedstoneSignal(side)); return aCoverVariable; } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java index f41250ad15..19bb3b7ef2 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.math.MathExpression; @@ -38,17 +39,17 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { } @Override - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRemoval(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { GregTech_API.sWirelessRedstone.put(aCoverVariable, (byte) 0); return true; } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (((aX > 0.375D) && (aX < 0.625D)) || ((aSide > 3) && ((aY > 0.375D) && (aY < 0.625D)))) { + if (((aX > 0.375D) && (aX < 0.625D)) || ((side.offsetX != 0) && ((aY > 0.375D) && (aY < 0.625D)))) { GregTech_API.sWirelessRedstone.put(aCoverVariable.get(), (byte) 0); aCoverVariable.set( (aCoverVariable.get() & (PRIVATE_MASK | CHECKBOX_MASK)) @@ -61,9 +62,9 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { @Override @SuppressWarnings("deprecation") - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (((aX > 0.375D) && (aX < 0.625D)) || ((aSide > 3) && ((aY > 0.375D) && (aY < 0.625D)))) { + if (((aX > 0.375D) && (aX < 0.625D)) || ((side.offsetX != 0) && ((aY > 0.375D) && (aY < 0.625D)))) { GregTech_API.sWirelessRedstone.put(aCoverVariable, (byte) 0); int val = GT_Utility.stackToInt(aPlayer.inventory.getCurrentItem()) @@ -72,7 +73,7 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { aCoverVariable = (aCoverVariable & (PRIVATE_MASK | CHECKBOX_MASK)) | (val & PUBLIC_MASK); - aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); + aTileEntity.setCoverDataAtSide(side, aCoverVariable); GT_Utility .sendChatToPlayer(aPlayer, GT_Utility.trans("081", "Frequency: ") + (aCoverVariable & PUBLIC_MASK)); return true; @@ -81,14 +82,14 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (((aX > 0.375D) && (aX < 0.625D)) - || ((aSide <= 3) || (((aY > 0.375D) && (aY < 0.625D)) || ((((aZ <= 0.375D) || (aZ >= 0.625D))))))) { + || ((side.offsetX == 0) || (((aY > 0.375D) && (aY < 0.625D)) || ((((aZ <= 0.375D) || (aZ >= 0.625D))))))) { GregTech_API.sWirelessRedstone.put(aCoverVariable, (byte) 0); - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + final float[] tCoords = GT_Utility.getClickedFacingCoords(side, aX, aY, aZ); - short tAdjustVal = switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + final short tAdjustVal = switch ((byte) ((byte) (int) (tCoords[0] * 2.0F) + 2 * (byte) (int) (tCoords[1] * 2.0F))) { case 0 -> -32; case 1 -> 32; @@ -97,7 +98,7 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { default -> 0; }; - int tPublicChannel = (aCoverVariable & PUBLIC_MASK) + tAdjustVal; + final int tPublicChannel = (aCoverVariable & PUBLIC_MASK) + tAdjustVal; if (tPublicChannel < 0) { aCoverVariable = aCoverVariable & ~PUBLIC_MASK; @@ -112,42 +113,46 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public String getDescription(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return GT_Utility.trans("081", "Frequency: ") + aCoverVariable; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Screen.java b/src/main/java/gregtech/common/covers/GT_Cover_Screen.java index 77d75aa6b9..fcf33093c5 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Screen.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Screen.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import gregtech.api.interfaces.ITexture; @@ -22,82 +23,86 @@ public class GT_Cover_Screen extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public float getBlastProofLevel(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 20.0F; } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return false; } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return false; } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return false; } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return false; } @Override - public boolean isGUIClickable(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean isGUIClickable(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, + public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } @Override - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRemoval(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { return true; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { return 0; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java index b846fd3b72..90904cba65 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java @@ -1,6 +1,7 @@ package gregtech.common.covers; import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -32,19 +33,19 @@ public class GT_Cover_Shutter extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { return aCoverVariable; } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public int onCoverScrewdriverclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking() ? -1 : 1)) % 4; if (aCoverVariable < 0) { @@ -63,68 +64,72 @@ public class GT_Cover_Shutter extends GT_CoverBehavior { } @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 3 : !(aTileEntity instanceof IMachineProgress) || (((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0)); } @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 2 : !(aTileEntity instanceof IMachineProgress) || (((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0)); } @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 3 : !(aTileEntity instanceof IMachineProgress) || (((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0)); } @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 2 : !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0); } @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidIn(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 3 : !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0); } @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOut(ForgeDirection side, int aCoverID, int aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 2 : !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0); } @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsIn(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 3 : !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0); } @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOut(ForgeDirection side, int aCoverID, int aCoverVariable, int aSlot, + ICoverable aTileEntity) { return aCoverVariable >= 2 ? aCoverVariable == 2 : !(aTileEntity instanceof IMachineProgress) || ((IMachineProgress) aTileEntity).isAllowedToWork() == (aCoverVariable % 2 == 0); } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 0; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java b/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java index 702291db78..20ce5101f4 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_SolarPanel.java @@ -5,6 +5,7 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; @@ -20,27 +21,27 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - if (aSide != 1) return 0; + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { + if (side != ForgeDirection.UP) return 0; int coverState = aCoverVariable & 0x3; int coverNum = aCoverVariable >> 2; if (aTimer % 100L == 0L) { if (aTileEntity.getWorld() .isThundering()) { - return aTileEntity.getBiome().rainfall > 0.0F && aTileEntity.getSkyAtSide(aSide) + return aTileEntity.getBiome().rainfall > 0.0F && aTileEntity.getSkyAtSide(side) ? Math.min(20, coverNum) << 2 : coverNum << 2; } else { if (aTileEntity.getWorld() .isRaining() && aTileEntity.getBiome().rainfall > 0.0F) { // really rains - if (aTileEntity.getSkyAtSide(aSide)) coverNum = Math.min(30, coverNum); + if (aTileEntity.getSkyAtSide(side)) coverNum = Math.min(30, coverNum); if (aTileEntity.getWorld().skylightSubtracted >= 4) { if (aTileEntity.getWorld() .isDaytime()) { @@ -60,14 +61,17 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior { } } if (coverState == 1) { - aTileEntity.injectEnergyUnits((byte) 6, ((100L - (long) coverNum) * ((long) this.mVoltage)) / 100L, 1L); + aTileEntity.injectEnergyUnits( + ForgeDirection.UNKNOWN, + ((100L - (long) coverNum) * ((long) this.mVoltage)) / 100L, + 1L); } if (aTimer % 28800L == 0L && coverNum < 100 && (coverNum > 10 || XSTR_INSTANCE.nextInt(3) == 2)) coverNum++; return coverState + (coverNum << 2); } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.capabilities.isCreativeMode) { @@ -94,11 +98,11 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior { @Override @SuppressWarnings("deprecation") - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.capabilities.isCreativeMode) { GT_Utility.sendChatToPlayer(aPlayer, "Cleaned solar panel from " + (aCoverVariable >> 2) + "% dirt"); - aTileEntity.setCoverDataAtSide(aSide, (aCoverVariable & 0x3)); + aTileEntity.setCoverDataAtSide(side, (aCoverVariable & 0x3)); return true; } for (int i = 0; i < aPlayer.inventory.mainInventory.length; i++) { @@ -109,7 +113,7 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior { aPlayer.inventory.mainInventory[i] = new ItemStack(Items.bucket); if (aPlayer.inventoryContainer != null) aPlayer.inventoryContainer.detectAndSendChanges(); GT_Utility.sendChatToPlayer(aPlayer, "Cleaned solar panel from " + (aCoverVariable >> 2) + "% dirt"); - aTileEntity.setCoverDataAtSide(aSide, (aCoverVariable & 0x3)); + aTileEntity.setCoverDataAtSide(side, (aCoverVariable & 0x3)); return true; } } @@ -118,12 +122,12 @@ public class GT_Cover_SolarPanel extends GT_CoverBehavior { } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java index 21c2fa6f63..ea463acf45 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java @@ -1,5 +1,6 @@ package gregtech.common.covers; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.api.interfaces.ITexture; @@ -21,7 +22,7 @@ public class GT_Cover_SteamValve extends GT_Cover_Pump { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Vent.java b/src/main/java/gregtech/common/covers/GT_Cover_Vent.java index c179f5843b..e2be64b475 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Vent.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Vent.java @@ -1,6 +1,5 @@ package gregtech.common.covers; -import static gregtech.api.enums.GT_Values.SIDE_UNKNOWN; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import net.minecraft.block.Block; @@ -28,39 +27,40 @@ public class GT_Cover_Vent extends GT_CoverBehavior { } @Override - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - if (aSide == SIDE_UNKNOWN) return 0; + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { + if (side == ForgeDirection.UNKNOWN) return 0; int ret = 0; if (aTileEntity instanceof IFluidHandler) { - ret = doCoolFluid(aSide, aTileEntity); + ret = doCoolFluid(side, aTileEntity); } if ((aTileEntity instanceof IMachineProgress)) { - ret = doProgressEfficiency(aSide, (IMachineProgress) aTileEntity, aCoverID); + ret = doProgressEfficiency(side, (IMachineProgress) aTileEntity, aCoverID); } return ret; } @Override - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 100; } - protected int doProgressEfficiency(final byte aSide, final IMachineProgress aTileEntity, final int aCoverVariable) { - final int offsetX = aTileEntity.getOffsetX(aSide, 1); - final int offsetY = aTileEntity.getOffsetY(aSide, 1); - final int offsetZ = aTileEntity.getOffsetZ(aSide, 1); + protected int doProgressEfficiency(final ForgeDirection side, final IMachineProgress aTileEntity, + final int aCoverVariable) { + final int offsetX = aTileEntity.getOffsetX(side, 1); + final int offsetY = aTileEntity.getOffsetY(side, 1); + final int offsetZ = aTileEntity.getOffsetZ(side, 1); final World world = aTileEntity.getWorld(); if (aTileEntity.hasThingsToDo() && aCoverVariable != aTileEntity.getProgress() && !GT_Utility.hasBlockHitBox(world, offsetX, offsetY, offsetZ)) { @@ -69,17 +69,17 @@ public class GT_Cover_Vent extends GT_CoverBehavior { return aTileEntity.getProgress(); } - protected int doCoolFluid(final byte aSide, final ICoverable aTileEntity) { - final int offsetX = aTileEntity.getOffsetX(aSide, 1); - final int offsetY = aTileEntity.getOffsetY(aSide, 1); - final int offsetZ = aTileEntity.getOffsetZ(aSide, 1); + protected int doCoolFluid(final ForgeDirection side, final ICoverable aTileEntity) { + final int offsetX = aTileEntity.getOffsetX(side, 1); + final int offsetY = aTileEntity.getOffsetY(side, 1); + final int offsetZ = aTileEntity.getOffsetZ(side, 1); final World world = aTileEntity.getWorld(); final IFluidHandler fluidHandler = (IFluidHandler) aTileEntity; if (!fluidHandler.canDrain(ForgeDirection.UNKNOWN, IC2_HOT_COOLANT)) { return 0; } final int chances; // 10000 = 100% - final Block blockAtSide = aTileEntity.getBlockAtSide(aSide); + final Block blockAtSide = aTileEntity.getBlockAtSide(side); if (blockAtSide == null) { return 0; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverExternal.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverExternal.java index 1e1c992bb1..a8a30de9b1 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverExternal.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverExternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers.redstone; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -10,23 +12,23 @@ public class GT_Cover_AdvancedRedstoneReceiverExternal extends GT_Cover_Advanced } @Override - public ReceiverData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, ReceiverData aCoverVariable, - ICoverable aTileEntity, long aTimer) { + public ReceiverData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, + ReceiverData aCoverVariable, ICoverable aTileEntity, long aTimer) { aTileEntity.setOutputRedstoneSignal( - aSide, + side, getSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), aCoverVariable.getGateMode())); return aCoverVariable; } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ReceiverData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ReceiverData aCoverVariable, ICoverable aTileEntity, long aTimer) { return false; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, ReceiverData aCoverVariable, + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, ReceiverData aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverInternal.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverInternal.java index 899a97dca7..5553cb7c9c 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverInternal.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneReceiverInternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers.redstone; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IMachineProgress; @@ -11,10 +13,10 @@ public class GT_Cover_AdvancedRedstoneReceiverInternal extends GT_Cover_Advanced } @Override - public ReceiverData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, ReceiverData aCoverVariable, - ICoverable aTileEntity, long aTimer) { + public ReceiverData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, + ReceiverData aCoverVariable, ICoverable aTileEntity, long aTimer) { if (aTileEntity instanceof IMachineProgress machine) { - if (getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity) > 0) { + if (getRedstoneInput(side, aInputRedstone, aCoverID, aCoverVariable, aTileEntity) > 0) { machine.enableWorking(); } else { machine.disableWorking(); @@ -27,13 +29,13 @@ public class GT_Cover_AdvancedRedstoneReceiverInternal extends GT_Cover_Advanced } @Override - protected byte getRedstoneInputImpl(byte aSide, byte aInputRedstone, int aCoverID, ReceiverData aCoverVariable, - ICoverable aTileEntity) { + protected byte getRedstoneInputImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, + ReceiverData aCoverVariable, ICoverable aTileEntity) { return getSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), aCoverVariable.getGateMode()); } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ReceiverData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, ReceiverData aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterBase.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterBase.java index 237635eb7f..3417542bec 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterBase.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterBase.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -30,26 +31,26 @@ public abstract class GT_Cover_AdvancedRedstoneTransmitterBase<T extends GT_Cove super(typeToken, coverTexture); } - private static void unregisterSignal(byte aSide, TransmitterData aCoverVariable, ICoverable aTileEntity) { - long hash = hashCoverCoords(aTileEntity, aSide); + private static void unregisterSignal(ForgeDirection side, TransmitterData aCoverVariable, ICoverable aTileEntity) { + final long hash = hashCoverCoords(aTileEntity, side); removeSignalAt(aCoverVariable.uuid, aCoverVariable.frequency, hash); } @Override - public boolean onCoverRemovalImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity, - boolean aForced) { - unregisterSignal(aSide, aCoverVariable, aTileEntity); + public boolean onCoverRemovalImpl(ForgeDirection side, int aCoverID, TransmitterData aCoverVariable, + ICoverable aTileEntity, boolean aForced) { + unregisterSignal(side, aCoverVariable, aTileEntity); return true; } @Override - protected void onBaseTEDestroyedImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, + protected void onBaseTEDestroyedImpl(ForgeDirection side, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity) { - unregisterSignal(aSide, aCoverVariable, aTileEntity); + unregisterSignal(side, aCoverVariable, aTileEntity); } @Override - protected T onCoverScrewdriverClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, + protected T onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable.invert = !aCoverVariable.invert; GT_Utility.sendChatToPlayer( @@ -60,11 +61,11 @@ public abstract class GT_Cover_AdvancedRedstoneTransmitterBase<T extends GT_Cove } @Override - protected void preDataChangedImpl(byte aSide, int aCoverID, int aNewCoverId, T aCoverVariable, T aNewCoverVariable, - ICoverable aTileEntity) { + protected void preDataChangedImpl(ForgeDirection side, int aCoverID, int aNewCoverId, T aCoverVariable, + T aNewCoverVariable, ICoverable aTileEntity) { if (aCoverVariable.frequency != aNewCoverVariable.frequency || !Objects.equals(aCoverVariable.uuid, aNewCoverVariable.uuid)) { - unregisterSignal(aSide, aCoverVariable, aTileEntity); + unregisterSignal(side, aCoverVariable, aTileEntity); } } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterExternal.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterExternal.java index c693610318..139ec64843 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterExternal.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterExternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers.redstone; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -21,7 +23,7 @@ public class GT_Cover_AdvancedRedstoneTransmitterExternal } @Override - public TransmitterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + public TransmitterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { byte outputRedstone = aInputRedstone; if (aCoverVariable.isInvert()) { @@ -29,20 +31,20 @@ public class GT_Cover_AdvancedRedstoneTransmitterExternal else outputRedstone = 15; } - long hash = hashCoverCoords(aTileEntity, aSide); + final long hash = hashCoverCoords(aTileEntity, side); setSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), hash, outputRedstone); return aCoverVariable; } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } @Override - public boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, + public boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterInternal.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterInternal.java index 353a579680..01a46fcc86 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterInternal.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedRedstoneTransmitterInternal.java @@ -1,5 +1,7 @@ package gregtech.common.covers.redstone; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -21,28 +23,28 @@ public class GT_Cover_AdvancedRedstoneTransmitterInternal } @Override - public TransmitterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + public TransmitterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { - byte outputRedstone = aTileEntity.getOutputRedstoneSignal(aSide); + byte outputRedstone = aTileEntity.getOutputRedstoneSignal(side); if (aCoverVariable.isInvert()) { if (outputRedstone > 0) outputRedstone = 0; else outputRedstone = 15; } - long hash = hashCoverCoords(aTileEntity, aSide); + final long hash = hashCoverCoords(aTileEntity, side); setSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), hash, outputRedstone); return aCoverVariable; } @Override - public boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, + public boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, TransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, TransmitterData aCoverVariable, - ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, + TransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedWirelessRedstoneBase.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedWirelessRedstoneBase.java index 843c7ab5e2..e04a6664ac 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedWirelessRedstoneBase.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_AdvancedWirelessRedstoneBase.java @@ -9,6 +9,7 @@ import javax.annotation.Nonnull; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import com.google.common.io.ByteArrayDataInput; @@ -102,50 +103,54 @@ public abstract class GT_Cover_AdvancedWirelessRedstoneBase<T extends GT_Cover_A * x hashed into first 20 bytes y hashed into second 20 bytes z hashed into fifth 10 bytes dim hashed into sixth 10 * bytes side hashed into last 4 bytes */ - public static long hashCoverCoords(ICoverable tile, byte side) { + public static long hashCoverCoords(ICoverable tile, ForgeDirection side) { return (((((long) tile.getXCoord() << 20) + tile.getZCoord() << 10) + tile.getYCoord() << 10) - + tile.getWorld().provider.dimensionId << 4) + side; + + tile.getWorld().provider.dimensionId << 4) + side.ordinal(); } @Override - public boolean letsEnergyInImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsEnergyOutImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + public boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidInImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsFluidOutImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsInImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public boolean letsItemsOutImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { + public boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, int aSlot, + ICoverable aTileEntity) { return true; } @Override - public String getDescriptionImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + public String getDescriptionImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return GT_Utility.trans("081", "Frequency: ") + aCoverVariable.frequency + ", Transmission: " + (aCoverVariable.uuid == null ? "Public" : "Private"); } @Override - public int getTickRateImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + public int getTickRateImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return 5; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessFluidDetector.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessFluidDetector.java index f580877dea..ab5d26356f 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessFluidDetector.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessFluidDetector.java @@ -7,6 +7,7 @@ import javax.annotation.Nonnull; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; import com.gtnewhorizons.modularui.api.math.MathExpression; @@ -41,25 +42,25 @@ public class GT_Cover_WirelessFluidDetector } @Override - public FluidTransmitterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + public FluidTransmitterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, FluidTransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { - byte signal = GT_Cover_LiquidMeter + final byte signal = GT_Cover_LiquidMeter .computeSignalBasedOnFluid(aTileEntity, aCoverVariable.invert, aCoverVariable.threshold); - long hash = hashCoverCoords(aTileEntity, aSide); + final long hash = hashCoverCoords(aTileEntity, side); setSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), hash, signal); return aCoverVariable; } @Override - public boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, FluidTransmitterData aCoverVariable, + public boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, FluidTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, FluidTransmitterData aCoverVariable, - ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, + FluidTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessItemDetector.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessItemDetector.java index 8b8d047214..9f5200b6fc 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessItemDetector.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessItemDetector.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; import com.gtnewhorizons.modularui.api.math.MathExpression; @@ -47,29 +48,29 @@ public class GT_Cover_WirelessItemDetector } @Override - public ItemTransmitterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + public ItemTransmitterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, ItemTransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { byte signal = GT_Cover_ItemMeter.computeSignalBasedOnItems( aTileEntity, aCoverVariable.invert, aCoverVariable.threshold, aCoverVariable.slot, - aSide); - long hash = hashCoverCoords(aTileEntity, aSide); + side.ordinal()); + final long hash = hashCoverCoords(aTileEntity, side); setSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), hash, signal); return aCoverVariable; } @Override - public boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, ItemTransmitterData aCoverVariable, + public boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, ItemTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, ItemTransmitterData aCoverVariable, - ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, + ItemTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } diff --git a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessMaintenanceDetector.java b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessMaintenanceDetector.java index 6179b8084c..d9cc765ef8 100644 --- a/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessMaintenanceDetector.java +++ b/src/main/java/gregtech/common/covers/redstone/GT_Cover_WirelessMaintenanceDetector.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -89,29 +90,29 @@ public class GT_Cover_WirelessMaintenanceDetector } @Override - public MaintenanceTransmitterData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, + public MaintenanceTransmitterData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, MaintenanceTransmitterData aCoverVariable, ICoverable aTileEntity, long aTimer) { - byte signal = computeSignalBasedOnMaintenance(aCoverVariable, aTileEntity); - long hash = hashCoverCoords(aTileEntity, aSide); + final byte signal = computeSignalBasedOnMaintenance(aCoverVariable, aTileEntity); + final long hash = hashCoverCoords(aTileEntity, side); setSignalAt(aCoverVariable.getUuid(), aCoverVariable.getFrequency(), hash, signal); return aCoverVariable; } @Override - public boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, MaintenanceTransmitterData aCoverVariable, + public boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, MaintenanceTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, MaintenanceTransmitterData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - public int getTickRateImpl(byte aSide, int aCoverID, MaintenanceTransmitterData aCoverVariable, + public int getTickRateImpl(ForgeDirection side, int aCoverID, MaintenanceTransmitterData aCoverVariable, ICoverable aTileEntity) { return 60; } diff --git a/src/main/java/gregtech/common/items/GT_VolumetricFlask.java b/src/main/java/gregtech/common/items/GT_VolumetricFlask.java index 7776af8d69..fc19daff83 100644 --- a/src/main/java/gregtech/common/items/GT_VolumetricFlask.java +++ b/src/main/java/gregtech/common/items/GT_VolumetricFlask.java @@ -76,13 +76,13 @@ public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContain } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int ordinalSide, float xOffset, float yOffset, float zOffset) { if (player instanceof FakePlayer) { return false; } if (world.isRemote) return false; - if (interactWithTank(stack, player, world, x, y, z, side)) { + if (interactWithTank(stack, player, world, x, y, z, ordinalSide)) { return true; } MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true); @@ -239,7 +239,8 @@ public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContain } } - private boolean interactWithTank(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) { + private boolean interactWithTank(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, + int ordinalSide) { if (world.isRemote) { return false; } @@ -247,7 +248,7 @@ public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContain if (!(te instanceof IFluidHandler handler)) { return false; } - ForgeDirection dir = ForgeDirection.getOrientation(side); + ForgeDirection dir = ForgeDirection.getOrientation(ordinalSide); FluidStack fs = this.getFluid(stack); int capacity = getCapacity(stack); if (fs != null && (!player.isSneaking() || fs.amount >= capacity)) { diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Cover_Tool.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Cover_Tool.java index d0f5582549..305993c0d0 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Cover_Tool.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Cover_Tool.java @@ -31,23 +31,23 @@ public class Behaviour_Cover_Tool extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } - NBTTagCompound tNBT = aStack.getTagCompound(); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - boolean isCopyMode = aPlayer.isSneaking(); + final NBTTagCompound tNBT = aStack.getTagCompound(); + final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + final boolean isCopyMode = aPlayer.isSneaking(); initDataFromNBT(tNBT); if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 100.0D))) { if (isCopyMode) { ArrayList<String> tList = new ArrayList<>(); - doCopy(tTileEntity, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ, tList); + doCopy(tTileEntity, aWorld, aX, aY, aZ, side, hitX, hitY, hitZ, tList); aItem.discharge(aStack, 100.0D, Integer.MAX_VALUE, true, false, false); writeListToNBT(tList, tNBT, aPlayer); saveDataToNBT(tNBT); } else { - doPaste(tTileEntity, aSide, hitX, hitY, hitZ, aPlayer); + doPaste(tTileEntity, side, hitX, hitY, hitZ, aPlayer); aItem.discharge(aStack, 25.0D, Integer.MAX_VALUE, true, false, false); } } @@ -84,8 +84,8 @@ public class Behaviour_Cover_Tool extends Behaviour_None { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void doCopy(TileEntity aTileEntity, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, - float hitZ, List aList) { + private void doCopy(TileEntity aTileEntity, World aWorld, int aX, int aY, int aZ, ForgeDirection side, float hitX, + float hitY, float hitZ, List aList) { aList.add( "----- X: " + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(aX) @@ -104,20 +104,17 @@ public class Behaviour_Cover_Tool extends Behaviour_None { + EnumChatFormatting.RESET + " -----"); if (aTileEntity instanceof ICoverable tCoverable) { - int tSide = tCoverable.getCoverItemAtSide((byte) aSide) != null ? aSide - : tCoverable.getCoverItemAtSide(GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ)) - != null ? GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ) : -1; - if (tSide != -1) { - mStoredData = tCoverable.getComplexCoverDataAtSide((byte) tSide); - mCoverType = tCoverable.getCoverIDAtSide((byte) tSide); - aList.add( - "Block Side: " + EnumChatFormatting.AQUA - + ForgeDirection.getOrientation(tSide) - .name() - + EnumChatFormatting.RESET); + final ForgeDirection tSide = tCoverable.getCoverItemAtSide(side) != null ? side + : tCoverable.getCoverItemAtSide(GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ)) != null + ? GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ) + : ForgeDirection.UNKNOWN; + if (tSide != ForgeDirection.UNKNOWN) { + mStoredData = tCoverable.getComplexCoverDataAtSide(tSide); + mCoverType = tCoverable.getCoverIDAtSide(tSide); + aList.add("Block Side: " + EnumChatFormatting.AQUA + tSide.name() + EnumChatFormatting.RESET); aList.add( "Cover Type: " + EnumChatFormatting.GREEN - + tCoverable.getCoverItemAtSide((byte) tSide) + + tCoverable.getCoverItemAtSide(tSide) .getDisplayName() + EnumChatFormatting.RESET); } else { @@ -132,19 +129,21 @@ public class Behaviour_Cover_Tool extends Behaviour_None { } } - private void doPaste(TileEntity aTileEntity, int aSide, float hitX, float hitY, float hitZ, EntityPlayer aPlayer) { + private void doPaste(TileEntity aTileEntity, ForgeDirection side, float hitX, float hitY, float hitZ, + EntityPlayer aPlayer) { if (aTileEntity instanceof ICoverable tCoverable) { if (mCoverType == 0 || mStoredData == null) { GT_Utility.sendChatToPlayer(aPlayer, "Please Copy a Valid Cover First."); return; } - int tSide = tCoverable.getCoverItemAtSide((byte) aSide) != null ? aSide - : tCoverable.getCoverItemAtSide(GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ)) - != null ? GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ) : -1; - if (tSide != -1) { - int tCoverID = tCoverable.getCoverIDAtSide((byte) tSide); + final ForgeDirection tSide = tCoverable.getCoverItemAtSide(side) != null ? side + : tCoverable.getCoverItemAtSide(GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ)) != null + ? GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ) + : ForgeDirection.UNKNOWN; + if (tSide != ForgeDirection.UNKNOWN) { + int tCoverID = tCoverable.getCoverIDAtSide(tSide); if (tCoverID == mCoverType) { - tCoverable.setCoverDataAtSide((byte) tSide, mStoredData); + tCoverable.setCoverDataAtSide(tSide, mStoredData); GT_Utility.sendChatToPlayer(aPlayer, "Cover Data Pasted."); } else { GT_Utility.sendChatToPlayer(aPlayer, "Not Matched Cover."); @@ -158,8 +157,8 @@ public class Behaviour_Cover_Tool extends Behaviour_None { @Override public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { try { - NBTTagCompound tNBT = aStack.getTagCompound(); - int tSize = tNBT.getInteger("dataLinesCount"); + final NBTTagCompound tNBT = aStack.getTagCompound(); + final int tSize = tNBT.getInteger("dataLinesCount"); if (tSize < 1) throw new Exception(); aList.add(EnumChatFormatting.BLUE + "Stored Cover Data:"); for (int i = 0; i < tSize; i++) { diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java index 76bc0615c1..97d3da4ca3 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.items.GT_MetaBase_Item; @@ -25,7 +26,7 @@ public class Behaviour_Crowbar extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java index 0d8e26ac66..167eccdf49 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -28,8 +28,8 @@ public class Behaviour_Hoe extends Behaviour_None { @Override public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { + if (!aPlayer.canPlayerEdit(aX, aY, aZ, ordinalSide, aStack)) { return false; } UseHoeEvent event = new UseHoeEvent(aPlayer, aStack, aWorld, aX, aY, aZ); @@ -43,7 +43,7 @@ public class Behaviour_Hoe extends Behaviour_None { return true; } Block aBlock = aWorld.getBlock(aX, aY, aZ); - if ((aSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) + if ((ordinalSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt))) { new WorldSpawnedEventBuilder.SoundEventBuilder() .setVolume((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F) diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java index d348f3eed4..a4c26e2254 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java @@ -73,23 +73,23 @@ public class Behaviour_Lighter extends Behaviour_None { @Override public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { return false; } @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if ((aWorld.isRemote) || (aStack.stackSize != 1)) { return false; } boolean rOutput = false; - ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); - aX += tDirection.offsetX; - aY += tDirection.offsetY; - aZ += tDirection.offsetZ; - if ((!GT_Utility.isBlockAir(aWorld, aX, aY, aZ)) || (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) { + aX += side.offsetX; + aY += side.offsetY; + aZ += side.offsetZ; + if ((!GT_Utility.isBlockAir(aWorld, aX, aY, aZ)) + || (!aPlayer.canPlayerEdit(aX, aY, aZ, side.ordinal(), aStack))) { return false; } prepare(aStack); diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java index 6928222af1..4ce7f60da0 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java @@ -13,6 +13,7 @@ import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IItemBehaviour; @@ -28,13 +29,13 @@ public class Behaviour_None implements IItemBehaviour<GT_MetaBase_Item> { @Override public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { return false; } @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java index 16c1f1dec1..a3c46ea991 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java @@ -27,7 +27,7 @@ public class Behaviour_Plunger_Essentia extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java index 95e895ba91..c62cb5c4e5 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java @@ -30,7 +30,7 @@ public class Behaviour_Plunger_Fluid extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java index 41df9d6e95..a5fa868a00 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -30,13 +31,13 @@ public class Behaviour_Plunger_Item extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((aTileEntity instanceof IGregTechTileEntity)) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aTileEntity).getMetaTileEntity(); + if (aTileEntity instanceof IGregTechTileEntity gtTE) { + IMetaTileEntity tMetaTileEntity = gtTE.getMetaTileEntity(); if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) { for (IMetaTileEntityItemPipe tTileEntity : GT_Utility .sortMapByValuesAcending( @@ -48,13 +49,13 @@ public class Behaviour_Plunger_Item extends Behaviour_None { if (tTileEntity.isValidSlot(i)) { if ((tTileEntity.getStackInSlot(i) != null) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - ItemStack tStack = tTileEntity.decrStackSize(i, 64); + final ItemStack tStack = tTileEntity.decrStackSize(i, 64); if (tStack != null) { - EntityItem tEntity = new EntityItem( + final EntityItem tEntity = new EntityItem( aWorld, - ((IGregTechTileEntity) aTileEntity).getOffsetX((byte) aSide, 1) + 0.5D, - ((IGregTechTileEntity) aTileEntity).getOffsetY((byte) aSide, 1) + 0.5D, - ((IGregTechTileEntity) aTileEntity).getOffsetZ((byte) aSide, 1) + 0.5D, + gtTE.getOffsetX(side, 1) + 0.5D, + gtTE.getOffsetY(side, 1) + 0.5D, + gtTE.getOffsetZ(side, 1) + 0.5D, tStack); tEntity.motionX = 0.0D; tEntity.motionY = 0.0D; diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java index 43a35cff05..e64722fb87 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java @@ -41,7 +41,7 @@ public class Behaviour_Prospecting extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } @@ -80,9 +80,9 @@ public class Behaviour_Prospecting extends Behaviour_None { int tX = aX, tY = aY, tZ = aZ; Block tBlock; for (int i = 0, j = 6 + tQuality; i < j; i++) { - tX -= ForgeDirection.getOrientation(aSide).offsetX; - tY -= ForgeDirection.getOrientation(aSide).offsetY; - tZ -= ForgeDirection.getOrientation(aSide).offsetZ; + tX -= side.offsetX; + tY -= side.offsetY; + tZ -= side.offsetZ; tBlock = aWorld.getBlock(tX, tY, tZ); if (tBlock == Blocks.lava || tBlock == Blocks.flowing_lava) { @@ -109,16 +109,16 @@ public class Behaviour_Prospecting extends Behaviour_None { } } - Random tRandom = new XSTR(aX ^ aY ^ aZ ^ aSide); + final Random tRandom = new XSTR(aX ^ aY ^ aZ ^ side.ordinal()); for (int i = 0, j = 9 + 2 * tQuality; i < j; i++) { tX = aX - 4 - tQuality + tRandom.nextInt(j); tY = aY - 4 - tQuality + tRandom.nextInt(j); tZ = aZ - 4 - tQuality + tRandom.nextInt(j); tBlock = aWorld.getBlock(tX, tY, tZ); if (tBlock instanceof GT_Block_Ores_Abstract) { - TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); + final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); if (tTileEntity instanceof GT_TileEntity_Ores) { - Materials tMaterial = GregTech_API.sGeneratedMaterials[((GT_TileEntity_Ores) tTileEntity).mMetaData + final Materials tMaterial = GregTech_API.sGeneratedMaterials[((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000]; if (tMaterial != null && tMaterial != Materials._NULL) { GT_Utility.sendChatToPlayer( diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java index c041e02881..22b708e384 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.IItemBehaviour; @@ -24,15 +25,15 @@ public class Behaviour_Scanner extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - NBTTagCompound tNBT = aStack.getTagCompound(); + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { + final NBTTagCompound tNBT = aStack.getTagCompound(); if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) { - ArrayList<String> tList = new ArrayList<>(); + final ArrayList<String> tList = new ArrayList<>(); if (aItem.use( aStack, - GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), + GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, side, hitX, hitY, hitZ), aPlayer)) { - int tList_sS = tList.size(); + final int tList_sS = tList.size(); tNBT.setInteger("dataLinesCount", tList_sS); for (int i = 0; i < tList_sS; i++) { tNBT.setString("dataLines" + i, tList.get(i)); diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java index 3e15849e3f..d940226b84 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java @@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.items.GT_MetaBase_Item; @@ -23,7 +24,7 @@ public class Behaviour_Screwdriver extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java index 8adcc8a59d..b2ab0031ad 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java @@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -24,7 +25,7 @@ public class Behaviour_Sense extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java index 7362621df9..b12159d058 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; @@ -24,7 +25,7 @@ public class Behaviour_SensorKit extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if ((aPlayer instanceof EntityPlayerMP)) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (((tTileEntity instanceof IInventory)) && (!((IInventory) tTileEntity).isUseableByPlayer(aPlayer))) { diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java index 7f529282dd..159a0c4b27 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.items.GT_MetaBase_Item; @@ -26,7 +27,7 @@ public class Behaviour_SoftHammer extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java index 02413bf143..dbab764507 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.IItemBehaviour; @@ -99,7 +100,7 @@ public class Behaviour_Sonictron extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { setCurrentIndex(aStack, -1); return false; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java index f9621a8da4..cab8e9a7a0 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java @@ -65,12 +65,12 @@ public class Behaviour_Spray_Color extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if ((aWorld.isRemote) || (aStack.stackSize != 1)) { return false; } boolean rOutput = false; - if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + if (!aPlayer.canPlayerEdit(aX, aY, aZ, side.ordinal(), aStack)) { return false; } NBTTagCompound tNBT = aStack.getTagCompound(); @@ -97,7 +97,7 @@ public class Behaviour_Spray_Color extends Behaviour_None { } else { lookSide = look.zCoord > 0 ? ForgeDirection.SOUTH : ForgeDirection.NORTH; } - while ((GT_Utility.areStacksEqual(aStack, this.mUsed, true)) && (colorize(aWorld, aX, aY, aZ, aSide))) { + while ((GT_Utility.areStacksEqual(aStack, this.mUsed, true)) && (colorize(aWorld, aX, aY, aZ, side))) { GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, 1.0F, aX, aY, aZ); if (!aPlayer.capabilities.isCreativeMode) { tUses -= 1L; @@ -136,8 +136,8 @@ public class Behaviour_Spray_Color extends Behaviour_None { return rOutput; } - private boolean colorize(World aWorld, int aX, int aY, int aZ, int aSide) { - Block aBlock = aWorld.getBlock(aX, aY, aZ); + private boolean colorize(World aWorld, int aX, int aY, int aZ, ForgeDirection side) { + final Block aBlock = aWorld.getBlock(aX, aY, aZ); if ((aBlock != Blocks.air) && ((this.mAllowedVanillaBlocks.contains(aBlock)) || ((aBlock instanceof BlockColored)))) { if (aBlock == Blocks.hardened_clay) { @@ -158,7 +158,7 @@ public class Behaviour_Spray_Color extends Behaviour_None { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (~this.mColor) & 0xF, 3); return true; } - return aBlock.recolourBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aSide), (~this.mColor) & 0xF); + return aBlock.recolourBlock(aWorld, aX, aY, aZ, side, (~this.mColor) & 0xF); } @Override diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Switch_Metadata.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Switch_Metadata.java index 20bc59a171..03cf29b9dd 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Switch_Metadata.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Switch_Metadata.java @@ -8,6 +8,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.items.GT_Generic_Block; import gregtech.api.items.GT_MetaBase_Item; @@ -41,7 +42,7 @@ public class Behaviour_Switch_Metadata extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float aHitX, float aHitY, float aHitZ) { + int aY, int aZ, ForgeDirection side, float aHitX, float aHitY, float aHitZ) { if (aStack != null && (aPlayer == null || aPlayer.isSneaking()) && !aWorld.isRemote) { if (mCheckTarget) { Block aBlock = aWorld.blockExists(aX, aY, aZ) ? aWorld.getBlock(aX, aY, aZ) : Blocks.air; diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java index 2e4d682dcf..4eb1009ebc 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java @@ -32,33 +32,34 @@ public class Behaviour_Wrench extends Behaviour_None { @Override public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, ForgeDirection side, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } - Block aBlock = aWorld.getBlock(aX, aY, aZ); + final Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) { return false; } - byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); - TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); + final short targetSideOrdinal = (short) GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ) + .ordinal(); + final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { - if (((aTileEntity instanceof IWrenchable))) { - if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { + if (aTileEntity instanceof IWrenchable wrenchable) { + if (wrenchable.wrenchCanSetFacing(aPlayer, targetSideOrdinal)) { if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - ((IWrenchable) aTileEntity).setFacing(aTargetSide); + wrenchable.setFacing(targetSideOrdinal); GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1.0F, aX, aY, aZ); } return true; } - if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { - int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; + if (wrenchable.wrenchCanRemove(aPlayer)) { + final int tDamage = wrenchable.getWrenchDropRate() < 1.0F ? 10 : 3; if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, (long) tDamage * this.mCosts))) { - ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); - for (ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { + ItemStack tOutput = wrenchable.getWrenchDrop(aPlayer); + for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { if (tOutput == null) { aWorld.spawnEntityInWorld( new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); @@ -110,7 +111,7 @@ public class Behaviour_Wrench extends Behaviour_None { } return true; } - if (aMeta == aTargetSide) { + if (aMeta == targetSideOrdinal) { if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) @@ -137,7 +138,7 @@ public class Behaviour_Wrench extends Behaviour_None { || (aBlock == Blocks.dropper)) { if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, targetSideOrdinal, 3); GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1.0F, aX, aY, aZ); } return true; @@ -148,27 +149,27 @@ public class Behaviour_Wrench extends Behaviour_None { || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { - if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) + if ((targetSideOrdinal > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, targetSideOrdinal, 3); GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1.0F, aX, aY, aZ); } return true; } if (aBlock == Blocks.hopper) { - if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) + if ((targetSideOrdinal != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, targetSideOrdinal, 3); GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1.0F, aX, aY, aZ); } return true; } } if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)) - .contains(ForgeDirection.getOrientation(aTargetSide))) + .contains(ForgeDirection.getOrientation(targetSideOrdinal))) && ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) - && (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { + && (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(targetSideOrdinal)))) { if (!aPlayer.capabilities.isCreativeMode) { ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java index c62cfedf2a..0f645a93a9 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java @@ -19,7 +19,7 @@ public class Behaviour_WrittenBook extends Behaviour_None { @Override @SideOnly(Side.CLIENT) public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, - int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + int aY, int aZ, int ordinalSide, float hitX, float hitY, float hitZ) { if ((GT_Utility.isStringValid(GT_Utility.ItemNBT.getBookTitle(aStack))) && ((aPlayer instanceof EntityPlayerSP))) { Minecraft.getMinecraft() diff --git a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java index 421d2f648b..937c1a994f 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java @@ -14,10 +14,10 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I private final Block mBlock; private final byte mSide, mMeta; - protected GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + protected GT_CopiedBlockTexture(Block aBlock, int ordinalSide, int aMeta, short[] aRGBa, boolean allowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); mBlock = aBlock; - mSide = (byte) aSide; + mSide = (byte) ordinalSide; mMeta = (byte) aMeta; } @@ -26,8 +26,8 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I return false; } - private IIcon getIcon(int aSide) { - if (mSide == 6) return mBlock.getIcon(aSide, mMeta); + private IIcon getIcon(int ordinalSide) { + if (mSide == 6) return mBlock.getIcon(ordinalSide, mMeta); return mBlock.getIcon(mSide, mMeta); } @@ -37,7 +37,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I aRenderer.field_152631_f = true; startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer).setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + .setupColor(ForgeDirection.EAST, 0xffffff); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; @@ -48,7 +48,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal()); new LightingHelper(aRenderer).setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + .setupColor(ForgeDirection.WEST, 0xffffff); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -58,7 +58,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.UP.ordinal()); new LightingHelper(aRenderer).setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + .setupColor(ForgeDirection.UP, 0xffffff); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -68,7 +68,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal()); new LightingHelper(aRenderer).setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + .setupColor(ForgeDirection.DOWN, 0xffffff); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -78,7 +78,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); final IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal()); new LightingHelper(aRenderer).setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + .setupColor(ForgeDirection.SOUTH, 0xffffff); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -89,7 +89,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I final IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal()); aRenderer.field_152631_f = true; new LightingHelper(aRenderer).setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + .setupColor(ForgeDirection.NORTH, 0xffffff); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; diff --git a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java index e4304af15d..17fa9ac8ff 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java @@ -15,11 +15,11 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc private final Block mBlock; private final byte mSide, mMeta; - GT_CopiedCTMBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + GT_CopiedCTMBlockTexture(Block aBlock, int ordinalSide, int aMeta, short[] aRGBa, boolean allowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedCTMBlockTexture"); mBlock = aBlock; - mSide = (byte) aSide; + mSide = (byte) ordinalSide; mMeta = (byte) aMeta; } @@ -28,8 +28,8 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc return false; } - private IIcon getIcon(int aSide, int aX, int aY, int aZ, RenderBlocks aRenderer) { - final int tSide = mSide == 6 ? aSide : mSide; + private IIcon getIcon(int ordinalSide, int aX, int aY, int aZ, RenderBlocks aRenderer) { + final int tSide = mSide == 6 ? ordinalSide : mSide; return mBlock.getIcon(getBlockAccess(aRenderer), aX, aY, aZ, tSide); } @@ -43,7 +43,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc aRenderer.field_152631_f = true; startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer).setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.EAST, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; @@ -54,7 +54,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.WEST, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -64,7 +64,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.UP.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.UP, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -74,7 +74,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.DOWN, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -84,7 +84,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); final IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.SOUTH, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -95,7 +95,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc final IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal(), aX, aY, aZ, aRenderer); aRenderer.field_152631_f = true; new LightingHelper(aRenderer).setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.NORTH, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; diff --git a/src/main/java/gregtech/common/render/GT_RenderUtil.java b/src/main/java/gregtech/common/render/GT_RenderUtil.java index 6cba823a66..e98f573b94 100644 --- a/src/main/java/gregtech/common/render/GT_RenderUtil.java +++ b/src/main/java/gregtech/common/render/GT_RenderUtil.java @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -23,31 +24,25 @@ public class GT_RenderUtil { } public static void renderBlockIcon(RenderBlocks aRenderer, Block aBlock, double aX, double aY, double aZ, - IIcon aIcon, byte aSide) { - switch (aSide) { - case 0 -> { + IIcon aIcon, ForgeDirection side) { + switch (side) { + case DOWN -> { aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 1 -> { + case UP -> { aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); - return; } - case 2 -> { + case NORTH -> { aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 3 -> { + case SOUTH -> { aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); - return; } - case 4 -> { + case WEST -> { aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 5 -> { + case EAST -> { aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); - return; } } } diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java index 34b8c879ae..afaf3b290c 100644 --- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java +++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java @@ -64,11 +64,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), mRGBa); + .setupColor(ForgeDirection.EAST, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.EAST, 0xffffff); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -90,11 +90,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), mRGBa); + .setupColor(ForgeDirection.WEST, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.WEST, 0xffffff); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -116,11 +116,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), mRGBa); + .setupColor(ForgeDirection.UP, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.UP, 0xffffff); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -142,7 +142,7 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + .setupColor(ForgeDirection.DOWN, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { @@ -168,11 +168,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); + .setupColor(ForgeDirection.SOUTH, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.SOUTH, 0xffffff); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -194,11 +194,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); + .setupColor(ForgeDirection.NORTH, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.NORTH, 0xffffff); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -383,9 +383,8 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol alignment = ((IAlignmentProvider) meta).getAlignment(); } else if (meta != null) { return ExtendedFacing.of( - ForgeDirection.getOrientation( - meta.getBaseMetaTileEntity() - .getFrontFacing())); + meta.getBaseMetaTileEntity() + .getFrontFacing()); } } else if (te instanceof IAlignmentProvider) { alignment = ((IAlignmentProvider) te).getAlignment(); diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index 012115efa3..7ed875aa00 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -1,5 +1,11 @@ package gregtech.common.render; +import static gregtech.api.enums.GT_Values.SIDE_DOWN; +import static gregtech.api.enums.GT_Values.SIDE_EAST; +import static gregtech.api.enums.GT_Values.SIDE_NORTH; +import static gregtech.api.enums.GT_Values.SIDE_SOUTH; +import static gregtech.api.enums.GT_Values.SIDE_UP; +import static gregtech.api.enums.GT_Values.SIDE_WEST; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_DOWN; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_EAST; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_NORTH; @@ -26,6 +32,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -40,6 +47,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.XSTR; import gregtech.common.blocks.GT_Block_Machines; import gregtech.common.blocks.GT_Block_Ores_Abstract; @@ -72,12 +80,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aZ, aBlock, aRenderer, - new ITexture[][] { ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) DOWN.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) UP.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) NORTH.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) SOUTH.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) WEST.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) EAST.ordinal()) }); + new ITexture[][] { ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(DOWN), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(UP), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(NORTH), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(SOUTH), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(WEST), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(EAST) }); } if ((tTileEntity instanceof ITexturedTileEntity)) { return renderStandardBlock( @@ -87,12 +95,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aZ, aBlock, aRenderer, - new ITexture[][] { ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) DOWN.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) UP.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) NORTH.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) SOUTH.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) WEST.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) EAST.ordinal()) }); + new ITexture[][] { ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, DOWN), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, UP), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, NORTH), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, SOUTH), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, WEST), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, EAST) }); } return false; } @@ -102,12 +110,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[DOWN.ordinal()], true); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[UP.ordinal()], true); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[NORTH.ordinal()], true); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SOUTH.ordinal()], true); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[WEST.ordinal()], true); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[EAST.ordinal()], true); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_DOWN], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_UP], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_NORTH], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_SOUTH], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_WEST], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_EAST], true); return true; } @@ -126,65 +134,66 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { final float pipeMax = blockMax - pipeMin; final boolean[] tIsCovered = new boolean[VALID_DIRECTIONS.length]; for (int i = 0; i < VALID_DIRECTIONS.length; i++) { - tIsCovered[i] = (aTileEntity.getCoverIDAtSide((byte) i) != 0); + tIsCovered[i] = (aTileEntity.getCoverIDAtSide(ForgeDirection.getOrientation(i)) != 0); } final ITexture[][] tIcons = new ITexture[VALID_DIRECTIONS.length][]; final ITexture[][] tCovers = new ITexture[VALID_DIRECTIONS.length][]; - for (int i = 0; i < VALID_DIRECTIONS.length; i++) { - tCovers[i] = aTileEntity.getTexture(aBlock, (byte) i); - tIcons[i] = aTileEntity.getTextureUncovered((byte) i); + for (final ForgeDirection iSide : ForgeDirection.VALID_DIRECTIONS) { + final int iOrdinalSide = iSide.ordinal(); + tCovers[iOrdinalSide] = aTileEntity.getTexture(aBlock, iSide); + tIcons[iOrdinalSide] = aTileEntity.getTextureUncovered(iSide); } switch (aConnections) { case NO_CONNECTION -> { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } case CONNECTED_EAST | CONNECTED_WEST -> { // EAST - WEST Pipe Sides aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); // EAST - WEST Pipe Ends - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } case CONNECTED_DOWN | CONNECTED_UP -> { // UP - DOWN Pipe Sides aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, blockMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); // UP - DOWN Pipe Ends - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); } case CONNECTED_NORTH | CONNECTED_SOUTH -> { // NORTH - SOUTH Pipe Sides aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); // NORTH - SOUTH Pipe Ends - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } default -> { if ((aConnections & CONNECTED_WEST) == 0) { @@ -193,273 +202,273 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } else { aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, pipeMin, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); if ((aConnections & CONNECTED_EAST) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMax, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); if ((aConnections & CONNECTED_DOWN) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, pipeMin, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); if ((aConnections & CONNECTED_UP) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMax, pipeMin, pipeMax, blockMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); if ((aConnections & CONNECTED_NORTH) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, pipeMin); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); if ((aConnections & CONNECTED_SOUTH) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMax, pipeMax, pipeMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } } // Render covers on pipes - if (tIsCovered[DOWN.ordinal()]) { + if (tIsCovered[SIDE_DOWN]) { aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, coverInnerMin, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[NORTH.ordinal()]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + if (!tIsCovered[SIDE_NORTH]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); } - if (!tIsCovered[SOUTH.ordinal()]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + if (!tIsCovered[SIDE_SOUTH]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); } - if (!tIsCovered[WEST.ordinal()]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + if (!tIsCovered[SIDE_WEST]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); } - if (!tIsCovered[EAST.ordinal()]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + if (!tIsCovered[SIDE_EAST]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); } - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); if ((aConnections & CONNECTED_DOWN) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMax, blockMin, pipeMin); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); // Upper panel aRenderer.setRenderBounds(blockMin, blockMin, pipeMax, blockMax, blockMin, blockMax); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); // Middle left panel aRenderer.setRenderBounds(blockMin, blockMin, pipeMin, pipeMin, blockMin, pipeMax); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); // Middle right panel aRenderer.setRenderBounds(pipeMax, blockMin, pipeMin, blockMax, blockMin, pipeMax); } - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_DOWN], false); } - if (tIsCovered[UP.ordinal()]) { + if (tIsCovered[SIDE_UP]) { aBlock.setBlockBounds(blockMin, coverInnerMax, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[NORTH.ordinal()]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + if (!tIsCovered[SIDE_NORTH]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); } - if (!tIsCovered[SOUTH.ordinal()]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + if (!tIsCovered[SIDE_SOUTH]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); } - if (!tIsCovered[WEST.ordinal()]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + if (!tIsCovered[SIDE_WEST]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); } - if (!tIsCovered[EAST.ordinal()]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + if (!tIsCovered[SIDE_EAST]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); } - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); if ((aConnections & CONNECTED_UP) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMin, blockMax, blockMin, blockMax, blockMax, pipeMin); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); // Upper panel aRenderer.setRenderBounds(blockMin, blockMax, pipeMax, blockMax, blockMax, blockMax); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); // Middle left panel aRenderer.setRenderBounds(blockMin, blockMax, pipeMin, pipeMin, blockMax, pipeMax); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); // Middle right panel aRenderer.setRenderBounds(pipeMax, blockMax, pipeMin, blockMax, blockMax, pipeMax); } - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_UP], false); } - if (tIsCovered[NORTH.ordinal()]) { + if (tIsCovered[SIDE_NORTH]) { aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, coverInnerMin); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[DOWN.ordinal()]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + if (!tIsCovered[SIDE_DOWN]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); } - if (!tIsCovered[UP.ordinal()]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + if (!tIsCovered[SIDE_UP]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); } - if (!tIsCovered[WEST.ordinal()]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + if (!tIsCovered[SIDE_WEST]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); } - if (!tIsCovered[EAST.ordinal()]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + if (!tIsCovered[SIDE_EAST]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); } - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); if ((aConnections & CONNECTED_NORTH) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMax, pipeMin, blockMin); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); // Upper panel aRenderer.setRenderBounds(blockMin, pipeMax, blockMin, blockMax, blockMax, blockMin); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); // Middle left panel aRenderer.setRenderBounds(blockMin, pipeMin, blockMin, pipeMin, pipeMax, blockMin); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); // Middle right panel aRenderer.setRenderBounds(pipeMax, pipeMin, blockMin, blockMax, pipeMax, blockMin); } - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_NORTH], false); } - if (tIsCovered[SOUTH.ordinal()]) { + if (tIsCovered[SIDE_SOUTH]) { aBlock.setBlockBounds(blockMin, blockMin, coverInnerMax, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[DOWN.ordinal()]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + if (!tIsCovered[SIDE_DOWN]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); } - if (!tIsCovered[UP.ordinal()]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + if (!tIsCovered[SIDE_UP]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); } - if (!tIsCovered[WEST.ordinal()]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + if (!tIsCovered[SIDE_WEST]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); } - if (!tIsCovered[EAST.ordinal()]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + if (!tIsCovered[SIDE_EAST]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); } - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); if ((aConnections & CONNECTED_SOUTH) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMin, blockMin, blockMax, blockMax, pipeMin, blockMax); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); // Upper panel aRenderer.setRenderBounds(blockMin, pipeMax, blockMax, blockMax, blockMax, blockMax); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); // Middle left panel aRenderer.setRenderBounds(blockMin, pipeMin, blockMax, pipeMin, pipeMax, blockMax); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); // Middle right panel aRenderer.setRenderBounds(pipeMax, pipeMin, blockMax, blockMax, pipeMax, blockMax); } - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_SOUTH], false); } - if (tIsCovered[WEST.ordinal()]) { + if (tIsCovered[SIDE_WEST]) { aBlock.setBlockBounds(blockMin, blockMin, blockMin, coverInnerMin, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[DOWN.ordinal()]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + if (!tIsCovered[SIDE_DOWN]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); } - if (!tIsCovered[UP.ordinal()]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + if (!tIsCovered[SIDE_UP]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); } - if (!tIsCovered[NORTH.ordinal()]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + if (!tIsCovered[SIDE_NORTH]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); } - if (!tIsCovered[SOUTH.ordinal()]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + if (!tIsCovered[SIDE_SOUTH]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); } - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); if ((aConnections & CONNECTED_WEST) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMin, pipeMin, blockMax); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); // Upper panel aRenderer.setRenderBounds(blockMin, pipeMax, blockMin, blockMin, blockMax, blockMax); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); // Middle left panel aRenderer.setRenderBounds(blockMin, pipeMin, blockMin, blockMin, pipeMax, pipeMin); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); // Middle right panel aRenderer.setRenderBounds(blockMin, pipeMin, pipeMax, blockMin, pipeMax, blockMax); } - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_WEST], false); } - if (tIsCovered[EAST.ordinal()]) { + if (tIsCovered[SIDE_EAST]) { aBlock.setBlockBounds(coverInnerMax, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - if (!tIsCovered[DOWN.ordinal()]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + if (!tIsCovered[SIDE_DOWN]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); } - if (!tIsCovered[UP.ordinal()]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + if (!tIsCovered[SIDE_UP]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); } - if (!tIsCovered[NORTH.ordinal()]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + if (!tIsCovered[SIDE_NORTH]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); } - if (!tIsCovered[SOUTH.ordinal()]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + if (!tIsCovered[SIDE_SOUTH]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); } - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); if ((aConnections & CONNECTED_EAST) != 0) { // Split outer face to leave hole for pipe // Lower panel aRenderer.setRenderBounds(blockMax, blockMin, blockMin, blockMax, pipeMin, blockMax); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); // Upper panel aRenderer.setRenderBounds(blockMax, pipeMax, blockMin, blockMax, blockMax, blockMax); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); // Middle left panel aRenderer.setRenderBounds(blockMax, pipeMin, blockMin, blockMax, pipeMax, pipeMin); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); // Middle right panel aRenderer.setRenderBounds(blockMax, pipeMin, pipeMax, blockMax, pipeMax, blockMax); } - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SIDE_EAST], false); } aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -469,28 +478,37 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { @SideOnly(Side.CLIENT) public static void addHitEffects(EffectRenderer effectRenderer, Block block, World world, int x, int y, int z, - int side) { + int ordinalSide) { double rX = x + XSTR.XSTR_INSTANCE.nextDouble() * 0.8 + 0.1; double rY = y + XSTR.XSTR_INSTANCE.nextDouble() * 0.8 + 0.1; double rZ = z + XSTR.XSTR_INSTANCE.nextDouble() * 0.8 + 0.1; - if (side == 0) { + if (ordinalSide == 0) { rY = y - 0.1; - } else if (side == 1) { + } else if (ordinalSide == 1) { rY = y + 1.1; - } else if (side == 2) { + } else if (ordinalSide == 2) { rZ = z - 0.1; - } else if (side == 3) { + } else if (ordinalSide == 3) { rZ = z + 1.1; - } else if (side == 4) { + } else if (ordinalSide == 4) { rX = x - 0.1; - } else if (side == 5) { + } else if (ordinalSide == 5) { rX = x + 1.1; } effectRenderer.addEffect( - (new EntityDiggingFX(world, rX, rY, rZ, 0.0, 0.0, 0.0, block, block.getDamageValue(world, x, y, z), side)) - .applyColourMultiplier(x, y, z) - .multiplyVelocity(0.2F) - .multipleParticleScaleBy(0.6F)); + (new EntityDiggingFX( + world, + rX, + rY, + rZ, + 0.0, + 0.0, + 0.0, + block, + block.getDamageValue(world, x, y, z), + ordinalSide)).applyColourMultiplier(x, y, z) + .multiplyVelocity(0.2F) + .multipleParticleScaleBy(0.6F)); } @SideOnly(Side.CLIENT) @@ -537,7 +555,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) DOWN.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.DOWN), true); renderPositiveYFacing( null, @@ -546,7 +564,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) UP.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.UP), true); renderNegativeZFacing( null, @@ -555,7 +573,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) NORTH.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.NORTH), true); renderPositiveZFacing( null, @@ -564,7 +582,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) SOUTH.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.SOUTH), true); renderNegativeXFacing( null, @@ -573,7 +591,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) WEST.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.WEST), true); renderPositiveXFacing( null, @@ -582,7 +600,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tTileEntity.getTexture(aBlock, (byte) EAST.ordinal()), + tTileEntity.getTexture(aBlock, ForgeDirection.EAST), true); } else if (aMeta > 0 && (aMeta < GregTech_API.METATILEENTITIES.length) && aBlock instanceof GT_Block_Machines @@ -611,8 +629,9 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { final IGregTechTileEntity iGregTechTileEntity = tMetaTileEntity.getBaseMetaTileEntity(); - if ((iGregTechTileEntity instanceof IPipeRenderedTileEntity)) { - final float tThickness = ((IPipeRenderedTileEntity) iGregTechTileEntity).getThickNess(); + if ((iGregTechTileEntity instanceof IPipeRenderedTileEntity renderedPipe) + && (tMetaTileEntity instanceof MetaPipeEntity pipeEntity)) { + final float tThickness = renderedPipe.getThickNess(); final float pipeMin = (blockMax - tThickness) / 2.0F; final float pipeMax = blockMax - pipeMin; @@ -625,13 +644,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) DOWN.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - false, - false), + pipeEntity.getTexture(iGregTechTileEntity, DOWN, (CONNECTED_WEST | CONNECTED_EAST), -1, false, false), true); renderPositiveYFacing( null, @@ -640,13 +653,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) UP.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - false, - false), + pipeEntity.getTexture(iGregTechTileEntity, UP, (CONNECTED_WEST | CONNECTED_EAST), -1, false, false), true); renderNegativeZFacing( null, @@ -655,13 +662,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) NORTH.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - false, - false), + pipeEntity.getTexture(iGregTechTileEntity, NORTH, (CONNECTED_WEST | CONNECTED_EAST), -1, false, false), true); renderPositiveZFacing( null, @@ -670,13 +671,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) SOUTH.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - false, - false), + pipeEntity.getTexture(iGregTechTileEntity, SOUTH, (CONNECTED_WEST | CONNECTED_EAST), -1, false, false), true); renderNegativeXFacing( null, @@ -685,13 +680,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) WEST.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - true, - false), + pipeEntity.getTexture(iGregTechTileEntity, WEST, (CONNECTED_WEST | CONNECTED_EAST), -1, true, false), true); renderPositiveXFacing( null, @@ -700,13 +689,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) EAST.ordinal(), - (byte) (CONNECTED_WEST | CONNECTED_EAST), - (byte) -1, - true, - false), + pipeEntity.getTexture(iGregTechTileEntity, EAST, (CONNECTED_WEST | CONNECTED_EAST), -1, true, false), true); } else { renderNegativeYFacing( @@ -716,13 +699,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) DOWN.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, DOWN, WEST, -1, true, false), true); renderPositiveYFacing( null, @@ -731,13 +708,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) UP.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, UP, WEST, -1, true, false), true); renderNegativeZFacing( null, @@ -746,13 +717,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) NORTH.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, NORTH, WEST, -1, true, false), true); renderPositiveZFacing( null, @@ -761,13 +726,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) SOUTH.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, SOUTH, WEST, -1, true, false), true); renderNegativeXFacing( null, @@ -776,13 +735,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) WEST.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, WEST, WEST, -1, true, false), true); renderPositiveXFacing( null, @@ -791,13 +744,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 0, 0, 0, - tMetaTileEntity.getTexture( - iGregTechTileEntity, - (byte) EAST.ordinal(), - (byte) WEST.ordinal(), - (byte) -1, - true, - false), + tMetaTileEntity.getTexture(iGregTechTileEntity, EAST, WEST, -1, true, false), true); } } @@ -810,7 +757,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); } @@ -825,7 +772,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); } @@ -840,7 +787,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); } @@ -855,7 +802,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); } @@ -870,7 +817,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); } @@ -885,7 +832,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); } if (aIcon == null) return; - for (ITexture iTexture : aIcon) { + for (final ITexture iTexture : aIcon) { if (iTexture != null) { iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); } diff --git a/src/main/java/gregtech/common/render/IRenderedBlock.java b/src/main/java/gregtech/common/render/IRenderedBlock.java index 0f3a472e53..16268de750 100644 --- a/src/main/java/gregtech/common/render/IRenderedBlock.java +++ b/src/main/java/gregtech/common/render/IRenderedBlock.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,10 +15,10 @@ public interface IRenderedBlock { /** @return the Textures to be rendered */ @SideOnly(Side.CLIENT) - ITexture[] getTexture(Block aBlock, byte aSide, int aRenderPass, boolean[] aShouldSideBeRendered); + ITexture[] getTexture(Block aBlock, ForgeDirection side, int aRenderPass, boolean[] aShouldSideBeRendered); @SideOnly(Side.CLIENT) - ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass); + ITexture[] getTexture(Block aBlock, ForgeDirection side, boolean isActive, int aRenderPass); /** gets the Amount of Render Passes for this TileEntity or similar Handler. Only gets called once per Rendering. */ @SideOnly(Side.CLIENT) @@ -57,12 +58,13 @@ public interface IRenderedBlock { public ITexture[] mErrorTexture = Textures.BlockIcons.ERROR_RENDERING; @Override - public ITexture[] getTexture(Block aBlock, byte aSide, int aRenderPass, boolean[] aShouldSideBeRendered) { + public ITexture[] getTexture(Block aBlock, ForgeDirection side, int aRenderPass, + boolean[] aShouldSideBeRendered) { return mErrorTexture; } @Override - public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { + public ITexture[] getTexture(Block aBlock, ForgeDirection side, boolean isActive, int aRenderPass) { return mErrorTexture; } @@ -83,7 +85,7 @@ public interface IRenderedBlock { } @Override - public boolean renderFullBlockSide(Block aBlock, RenderBlocks aRenderer, byte aSide) { + public boolean renderFullBlockSide(Block aBlock, RenderBlocks aRenderer, ForgeDirection side) { return true; } diff --git a/src/main/java/gregtech/common/render/IRenderedBlockSideCheck.java b/src/main/java/gregtech/common/render/IRenderedBlockSideCheck.java index 1d109216de..8feb69b2f5 100644 --- a/src/main/java/gregtech/common/render/IRenderedBlockSideCheck.java +++ b/src/main/java/gregtech/common/render/IRenderedBlockSideCheck.java @@ -2,6 +2,7 @@ package gregtech.common.render; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -10,5 +11,5 @@ public interface IRenderedBlockSideCheck { /** returning false stops all the other Rendering from happening on that Side. */ @SideOnly(Side.CLIENT) - boolean renderFullBlockSide(Block aBlock, RenderBlocks aRenderer, byte aSide); + boolean renderFullBlockSide(Block aBlock, RenderBlocks aRenderer, ForgeDirection side); } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java index c6c73cb02f..a5b495d73d 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java @@ -5,6 +5,7 @@ import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER_GLOW; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -87,8 +88,9 @@ public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer implement } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack)) { return false; } if (this.bInvertFilter) { @@ -110,8 +112,14 @@ public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer implement if (mInventory[i] == null) ++emptySlots; } if (!bInvert) emptySlots = 9 - emptySlots; - for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) emptySlots); - } else for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) 0); + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + aBaseMetaTileEntity.setInternalOutputRedstoneSignal(side, (byte) emptySlots); + } + } else { + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + aBaseMetaTileEntity.setInternalOutputRedstoneSignal(side, (byte) 0); + } + } } @Override diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java index 7b2978d701..1f4117acc9 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -25,7 +26,8 @@ import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer implements IAddUIWidgets { private byte[] itemsPerSide = new byte[6]; - private byte currentSide = 0, currentSideItemCount = 0; + private ForgeDirection currentSide = ForgeDirection.DOWN; + private byte currentSideItemCount = 0; public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier) { super( @@ -74,17 +76,18 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == aBaseMetaTileEntity.getFrontFacing(); + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return side == aBaseMetaTileEntity.getFrontFacing(); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return mTextures[0][aColorIndex + 1]; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { + return mTextures[0][colorIndex + 1]; } else { - return mTextures[1][aColorIndex + 1]; + return mTextures[1][colorIndex + 1]; } } @@ -100,13 +103,13 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer } @Override - public boolean isInputFacing(byte aSide) { - return getBaseMetaTileEntity().getFrontFacing() == aSide || itemsPerSide[aSide] == 0; + public boolean isInputFacing(ForgeDirection side) { + return getBaseMetaTileEntity().getFrontFacing() == side || itemsPerSide[side.ordinal()] == 0; } @Override - public boolean isOutputFacing(byte aSide) { - return getBaseMetaTileEntity().getFrontFacing() != aSide && itemsPerSide[aSide] > 0; + public boolean isOutputFacing(ForgeDirection side) { + return getBaseMetaTileEntity().getFrontFacing() != side && itemsPerSide[side.ordinal()] > 0; } @Override @@ -121,18 +124,20 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer if (itemsPerSide.length != 6) { itemsPerSide = new byte[6]; } - currentSide = aNBT.getByte("mCurrentSide"); + currentSide = ForgeDirection.getOrientation(aNBT.getByte("mCurrentSide")); currentSideItemCount = aNBT.getByte("mCurrentSideItemCount"); } @Override protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + int currentSideOrdinal = currentSide.ordinal(); fillStacksIntoFirstSlots(); int movedItems; TileEntity adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide); int inspectedSides = 0; - while (itemsPerSide[currentSide] == 0) { - currentSide = (byte) ((currentSide + 1) % 6); + while (itemsPerSide[currentSideOrdinal] == 0) { + currentSideOrdinal = ((currentSideOrdinal + 1) % 6); + currentSide = ForgeDirection.getOrientation(currentSideOrdinal); currentSideItemCount = 0; adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide); inspectedSides += 1; @@ -144,16 +149,17 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer aBaseMetaTileEntity, adjacentTileEntity, currentSide, - GT_Utility.getOppositeSide(currentSide), + currentSide.getOpposite(), null, false, (byte) 64, (byte) 1, - (byte) (itemsPerSide[currentSide] - currentSideItemCount), + (byte) (itemsPerSide[currentSideOrdinal] - currentSideItemCount), (byte) 1); currentSideItemCount += movedItems; - if (currentSideItemCount >= itemsPerSide[currentSide]) { - currentSide = (byte) ((currentSide + 1) % 6); + if (currentSideItemCount >= itemsPerSide[currentSideOrdinal]) { + currentSideOrdinal = ((currentSideOrdinal + 1) % 6); + currentSide = ForgeDirection.getOrientation(currentSideOrdinal); currentSideItemCount = 0; } if (movedItems > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { @@ -163,18 +169,19 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + final int ordinalSide = side.ordinal(); // Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127] - itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1; - itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128); - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("211", "Items per side: ") + itemsPerSide[aSide]); + itemsPerSide[ordinalSide] += aPlayer.isSneaking() ? -1 : 1; + itemsPerSide[ordinalSide] = (byte) ((itemsPerSide[ordinalSide] + 128) % 128); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("211", "Items per side: ") + itemsPerSide[ordinalSide]); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setByteArray("mItemsPerSide", itemsPerSide); - aNBT.setByte("mCurrentSide", currentSide); + aNBT.setByte("mCurrentSide", (byte) currentSide.ordinal()); aNBT.setByte("mCurrentSideItemCount", currentSideItemCount); } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index 9b0824aed1..3fa296f9a2 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -8,6 +8,7 @@ import java.util.Collections; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -106,7 +107,7 @@ public class GT_MetaTileEntity_Regulator extends GT_MetaTileEntity_Buffer implem } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { // Regulation per Screwdriver is overridden by GUI regulation. } @@ -134,8 +135,9 @@ public class GT_MetaTileEntity_Regulator extends GT_MetaTileEntity_Buffer implem } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && aIndex >= 0 + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, side, aStack) && aIndex >= 0 && aIndex <= 8 && GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)]); } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index fbcc8f62ce..325728ba98 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -70,11 +70,16 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex - + 1]; - if (aSide != aFacing && tmp.length == 2) { + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + ITexture[] tmp; + if (sideDirection.offsetY == 0) { + if (sideDirection != facingDirection) tmp = mTextures[2][colorIndex + 1]; + else tmp = mTextures[(byte) (active ? 4 : 3)][colorIndex + 1]; + } else { + tmp = mTextures[sideDirection.ordinal()][colorIndex + 1]; + } + if (sideDirection != facingDirection && tmp.length == 2) { tmp = new ITexture[] { tmp[0] }; } return tmp; @@ -86,23 +91,8 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } @Override - public boolean isPneumatic() { - return false; - } - - @Override - public boolean isSteampowered() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + public boolean isFacingValid(ForgeDirection facingDirection) { + return facingDirection.offsetY == 0; } @Override @@ -197,7 +187,7 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) { + public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCover) { return GregTech_API.getCoverBehaviorNew(aCover.toStack()) .isSimpleCover(); } @@ -324,26 +314,17 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa * Pushes Steam to a Side of this Boiler * * @param aBaseMetaTileEntity The tile-entity instance of this Boiler - * @param aSide The ordinal direction of the side to push Steam to + * @param side The direction of the side to push Steam to */ - protected final void pushSteamToSide(IGregTechTileEntity aBaseMetaTileEntity, int aSide) { + protected final void pushSteamToSide(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side) { if (mSteam == null || mSteam.amount == 0) return; - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide((byte) aSide); + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(side); if (tTileEntity == null) return; - FluidStack tDrained = aBaseMetaTileEntity - .drain(ForgeDirection.getOrientation(aSide), Math.max(1, this.mSteam.amount / 2), false); + final FluidStack tDrained = aBaseMetaTileEntity.drain(side, Math.max(1, this.mSteam.amount / 2), false); if (tDrained == null) return; - int tFilledAmount = tTileEntity.fill( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - tDrained, - false); + final int tFilledAmount = tTileEntity.fill(side.getOpposite(), tDrained, false); if (tFilledAmount <= 0) return; - tTileEntity.fill( - ForgeDirection.getOrientation(aSide) - .getOpposite(), - aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), tFilledAmount, true), - true); + tTileEntity.fill(side.getOpposite(), aBaseMetaTileEntity.drain(side, tFilledAmount, true), true); } /** @@ -353,9 +334,10 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa */ protected void pushSteamToInventories(IGregTechTileEntity aBaseMetaTileEntity) { if (mSteam == null || mSteam.amount == 0) return; - for (int i = 1; (this.mSteam != null) && (i < 6); i++) { - if (i == aBaseMetaTileEntity.getFrontFacing()) continue; - pushSteamToSide(aBaseMetaTileEntity, i); + for (final ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { + if (direction == aBaseMetaTileEntity.getFrontFacing()) continue; + if (this.mSteam == null) break; + pushSteamToSide(aBaseMetaTileEntity, direction); } } @@ -371,12 +353,14 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index d375d285d2..c9a67f5d42 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -100,9 +100,9 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isActive()) { - final byte frontFacing = aBaseMetaTileEntity.getFrontFacing(); + final ForgeDirection frontFacing = aBaseMetaTileEntity.getFrontFacing(); - if (frontFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 + if (frontFacing.offsetY == 0 && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(frontFacing)) { final double oX = aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 8D / 16D; @@ -115,16 +115,16 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { y = oY + XSTR_INSTANCE.nextFloat() * 6D / 16D; - if (frontFacing == ForgeDirection.WEST.ordinal()) { + if (frontFacing == ForgeDirection.WEST) { x = oX - offset; z = oZ + horizontal; - } else if (frontFacing == ForgeDirection.EAST.ordinal()) { + } else if (frontFacing == ForgeDirection.EAST) { x = oX + offset; z = oZ + horizontal; - } else if (frontFacing == ForgeDirection.NORTH.ordinal()) { + } else if (frontFacing == ForgeDirection.NORTH) { x = oX + horizontal; z = oZ - offset; - } else // if (frontFacing == ForgeDirection.SOUTH.ordinal()) + } else // if (frontFacing == ForgeDirection.SOUTH) { x = oX + horizontal; z = oZ + offset; diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index 6ffcd37f28..3a8b94463b 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -86,23 +86,21 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - final ForgeDirection sideDirection = ForgeDirection.getOrientation(aSide); - final ForgeDirection facingDirection = ForgeDirection.getOrientation(aFacing); + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { final ForgeDirection rearDirection = facingDirection.getOpposite(); final ITexture[] tmp; - if (aSide >= 2) { + if (sideDirection.offsetY == 0) { if (sideDirection == facingDirection) { - if (aActive) tmp = mTextures[4][aColorIndex + 1]; - else tmp = mTextures[3][aColorIndex + 1]; + if (active) tmp = mTextures[4][colorIndex + 1]; + else tmp = mTextures[3][colorIndex + 1]; } else if (sideDirection == rearDirection) { - tmp = mTextures[5][aColorIndex + 1]; + tmp = mTextures[5][colorIndex + 1]; } else { - tmp = mTextures[2][aColorIndex + 1]; + tmp = mTextures[2][colorIndex + 1]; } - } else tmp = mTextures[aSide][aColorIndex + 1]; - if (aSide != aFacing && tmp.length == 2) { + } else tmp = mTextures[sideDirection.ordinal()][colorIndex + 1]; + if (sideDirection != facingDirection && tmp.length == 2) { return new ITexture[] { tmp[0] }; } return tmp; @@ -267,9 +265,8 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { if (mSteam == null || mSteam.amount == 0) return; pushSteamToSide( aBaseMetaTileEntity, - ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()) - .getOpposite() - .ordinal()); + aBaseMetaTileEntity.getFrontFacing() + .getOpposite()); } /** @@ -278,7 +275,7 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { * @param aBaseMetaTileEntity The tile-entity instance of this Lava Boiler */ protected void drainLava(IGregTechTileEntity aBaseMetaTileEntity) { - final IFluidHandler upTank = aBaseMetaTileEntity.getITankContainerAtSide((byte) ForgeDirection.UP.ordinal()); + final IFluidHandler upTank = aBaseMetaTileEntity.getITankContainerAtSide(ForgeDirection.UP); if (upTank == null) return; // Simulates drain of maximum lava amount up to 1000L that can fit the internal tank final FluidStack drainableLavaStack = upTank.drain( @@ -321,10 +318,9 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isActive()) { - final byte frontFacing = aBaseMetaTileEntity.getFrontFacing(); - final ForgeDirection frontDirection = ForgeDirection.getOrientation(frontFacing); + final ForgeDirection frontFacing = aBaseMetaTileEntity.getFrontFacing(); - if (frontFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 + if (frontFacing.offsetY == 0 && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(frontFacing)) { final double oX = aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 8D / 16D; @@ -337,7 +333,7 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { y = oY + XSTR_INSTANCE.nextFloat() * 6D / 16D; - switch (frontDirection) { + switch (frontFacing) { case WEST -> { x = oX - offset; z = oZ + horizontal; @@ -395,12 +391,14 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return true; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return true; } @@ -408,7 +406,7 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public void doSound(byte aIndex, double aX, double aY, double aZ) { if (aIndex != GT_MetaTileEntity_Boiler.SOUND_EVENT_LET_OFF_EXCESS_STEAM) return; - final ForgeDirection rearDirection = ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()) + final ForgeDirection rearDirection = getBaseMetaTileEntity().getFrontFacing() .getOpposite(); GT_Utility.doSoundAtClient( SoundResource.RANDOM_FIZZ, @@ -459,8 +457,8 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - return new FluidTankInfo[] { super.getTankInfo(aSide)[0], + public FluidTankInfo[] getTankInfo(ForgeDirection side) { + return new FluidTankInfo[] { super.getTankInfo(side)[0], new FluidTankInfo(this.lavaTank.getFluid(), this.lavaTank.getCapacity()), new FluidTankInfo(getDrainableStack(), getCapacity()) }; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index 38c0d6e9e2..3deaf12b6f 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -128,14 +128,14 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - int i = aColorIndex + 1; - if (aSide >= 2) { - if (aSide != aFacing) return mTextures[2][i]; + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + final int i = colorIndex + 1; + if (sideDirection.offsetY == 0) { + if (sideDirection != facingDirection) return mTextures[2][i]; return mTextures[3][i]; } - return mTextures[aSide][i]; + return mTextures[sideDirection.ordinal()][i]; } @Override @@ -224,7 +224,7 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { if ((aTick % 240L != 0L) || (world.isThundering())) { return; } - if (!aBaseMetaTileEntity.getSkyAtSide((byte) ForgeDirection.UP.ordinal())) { + if (!aBaseMetaTileEntity.getSkyAtSide(ForgeDirection.UP)) { return; } boolean weatherClear = !world.isRaining() || aBaseMetaTileEntity.getBiome().rainfall == 0.0F; diff --git a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java index c153e6c1c5..cc62de308c 100644 --- a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java +++ b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.casings.upgrade; import java.util.UUID; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -79,7 +80,7 @@ public class Inventory extends UpgradeCasing { } @Override - public boolean hasGui(byte aSide) { + public boolean hasGui(ForgeDirection side) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/debug/GT_MetaTileEntity_AdvDebugStructureWriter.java b/src/main/java/gregtech/common/tileentities/debug/GT_MetaTileEntity_AdvDebugStructureWriter.java index deb71f93cf..f143ec556e 100644 --- a/src/main/java/gregtech/common/tileentities/debug/GT_MetaTileEntity_AdvDebugStructureWriter.java +++ b/src/main/java/gregtech/common/tileentities/debug/GT_MetaTileEntity_AdvDebugStructureWriter.java @@ -70,19 +70,20 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing - ? TextureFactory.of( - TextureFactory.builder() - .addIcon(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) - .glow() - .build()) - : TextureFactory.of( - TextureFactory.builder() - .addIcon(Textures.BlockIcons.STRUCTURE_MARK) - .glow() - .build()) }; + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + return new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], sideDirection != facingDirection + ? TextureFactory.of( + TextureFactory.builder() + .addIcon(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) + .glow() + .build()) + : TextureFactory.of( + TextureFactory.builder() + .addIcon(Textures.BlockIcons.STRUCTURE_MARK) + .glow() + .build()) }; } @Override @@ -91,12 +92,14 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity } @Override - public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection b, + ItemStack itemStack) { return false; } @Override - public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) { + public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection b, + ItemStack itemStack) { return false; } @@ -132,8 +135,7 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - ExtendedFacing writerFacing = ExtendedFacing - .of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + ExtendedFacing writerFacing = ExtendedFacing.of(aBaseMetaTileEntity.getFrontFacing()); double[] abc = new double[3]; double[] xyz = new double[3]; boundingBox.dim = aBaseMetaTileEntity.getWorld().provider.dimensionId; @@ -163,7 +165,7 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); printStructure(aPlayer); aBaseMetaTileEntity.disableWorking(); @@ -173,7 +175,7 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); String pseudoJavaCode = StructureUtility.getPseudoJavaCode( aBaseMetaTileEntity.getWorld(), - ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), + ExtendedFacing.of(aBaseMetaTileEntity.getFrontFacing()), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), @@ -199,7 +201,7 @@ public class GT_MetaTileEntity_AdvDebugStructureWriter extends GT_MetaTileEntity } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java index e2aea182fb..df7028c232 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java @@ -54,8 +54,8 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override @@ -124,15 +124,13 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isActive()) { - final byte topFacing = (byte) ForgeDirection.UP.ordinal(); + if (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP)) { - if (aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { - - final double x = aBaseMetaTileEntity.getOffsetX(topFacing, 1) + 2D / 16D + final double x = aBaseMetaTileEntity.getOffsetX(ForgeDirection.UP, 1) + 2D / 16D + XSTR_INSTANCE.nextFloat() * 14D / 16D; - final double y = aBaseMetaTileEntity.getOffsetY(topFacing, 1) + 1D / 32D; - final double z = aBaseMetaTileEntity.getOffsetZ(topFacing, 1) + 2D / 16D + final double y = aBaseMetaTileEntity.getOffsetY(ForgeDirection.UP, 1) + 1D / 32D; + final double z = aBaseMetaTileEntity.getOffsetZ(ForgeDirection.UP, 1) + 2D / 16D + XSTR_INSTANCE.nextFloat() * 14D / 16D; new ParticleEventBuilder().setMotion(0D, 0D, 0D) diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java index 1c8aeebb40..f1f366052c 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java @@ -2,6 +2,8 @@ package gregtech.common.tileentities.generators; import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -69,8 +71,8 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java index e72f944ebb..9809dba278 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java @@ -34,15 +34,15 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != ForgeDirection.UP.ordinal()) { - return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection != ForgeDirection.UP) { + return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] }; } - if (!aActive) return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + if (!active) return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS) }; - return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), TextureFactory.builder() .addIcon(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) .glow() @@ -110,12 +110,14 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @@ -125,12 +127,12 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } @Override - public boolean isFacingValid(byte aFacing) { - return aFacing == 1; + public boolean isFacingValid(ForgeDirection facing) { + return facing == ForgeDirection.UP; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java index 17089403c3..07990213be 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java @@ -10,6 +10,8 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -41,8 +43,8 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index b95f79c0f5..ff3353256d 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -144,7 +144,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) mMagicalEnergyBB.decreaseTier(); else mMagicalEnergyBB.increaseTier(); GT_Utility.sendChatToPlayer( @@ -338,8 +338,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override @@ -393,9 +393,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B if (aBaseMetaTileEntity.isActive()) { - final byte topFacing = (byte) ForgeDirection.UP.ordinal(); - - if (isEgg(aBaseMetaTileEntity.getBlockAtSide(topFacing))) { + if (isEgg(aBaseMetaTileEntity.getBlockAtSide(ForgeDirection.UP))) { final double oX = aBaseMetaTileEntity.getXCoord() + 8D / 16D; final double oY = aBaseMetaTileEntity.getYCoord() + 17D / 32D; @@ -443,7 +441,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { // Restrict input to disenchantable items or enchanted books return (isDisenchantableItem(aStack) || isEnchantedBook(aStack)); } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java index 7e9fff95aa..c7e4106399 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java @@ -2,6 +2,8 @@ package gregtech.common.tileentities.generators; import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -33,9 +35,9 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe } @Override - public boolean isOutputFacing(byte aSide) { - return (aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing()) - && (aSide != getBaseMetaTileEntity().getBackFacing()); + public boolean isOutputFacing(ForgeDirection side) { + return (side.offsetY == 0) && (side != getBaseMetaTileEntity().getFrontFacing()) + && (side != getBaseMetaTileEntity().getBackFacing()); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java index c1370cce63..00c7f93128 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java @@ -5,6 +5,8 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -106,8 +108,8 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java index a875fd521c..28962b69a0 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java @@ -2,6 +2,7 @@ package gregtech.common.tileentities.generators; import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.api.GregTech_API; @@ -39,8 +40,8 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java index 2b78fd5c55..4aa56ae4f4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java @@ -127,7 +127,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Override public AECableType getCableConnectionType(ForgeDirection forgeDirection) { - return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; + return isOutputFacing(forgeDirection) ? AECableType.SMART : AECableType.NONE; } @Override @@ -223,17 +223,19 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { setAutoPullItemList(!autoPullItemList); GT_Utility.sendChatToPlayer(aPlayer, "Automatic Item Pull " + autoPullItemList); } @@ -242,13 +244,13 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch public void updateSlots() {} @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, + float aX, float aY, float aZ) { if (!(aPlayer instanceof EntityPlayerMP)) - return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); ItemStack dataStick = aPlayer.inventory.getCurrentItem(); if (!ItemList.Tool_DataStick.isStackEqual(dataStick, true, true)) - return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); if (!dataStick.hasTagCompound() || !"stockingBus".equals(dataStick.stackTagCompound.getString("type"))) return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 22afe4b9fe..0a58dbf1b6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -120,7 +120,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public AECableType getCableConnectionType(ForgeDirection forgeDirection) { - return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; + return isOutputFacing(forgeDirection) ? AECableType.SMART : AECableType.NONE; } @Override @@ -129,8 +129,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!getBaseMetaTileEntity().getCoverInfoAtSide(side) .isGUIClickable()) return; infiniteCache = !infiniteCache; GT_Utility diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java index 0c65d1bc2e..241412b423 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java @@ -126,8 +126,8 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O } @Override - public AECableType getCableConnectionType(ForgeDirection forgeDirection) { - return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; + public AECableType getCableConnectionType(ForgeDirection side) { + return isOutputFacing(side) ? AECableType.SMART : AECableType.NONE; } @Override @@ -149,9 +149,9 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O public void updateFluidDisplayItem() {} @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { // Don't allow to lock fluid in me fluid hatch - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + if (!getBaseMetaTileEntity().getCoverInfoAtSide(side) .isGUIClickable()) return; infiniteCache = !infiniteCache; GT_Utility.sendChatToPlayer( diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index 02c1897522..fdadb44a23 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.Textures.BlockIcons.*; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; @@ -194,9 +195,9 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) { + if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack)) { return false; } ItemStack tInput1 = getInputAt(1); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java index 01832d0d96..5408beca32 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java @@ -2,6 +2,7 @@ package gregtech.common.tileentities.machines.basic; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -63,9 +64,9 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) + return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack)) && ItemList.Cell_Empty.isStackEqual(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java index a0e5561559..974036625b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java @@ -1,6 +1,5 @@ package gregtech.common.tileentities.machines.basic; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.enums.GT_Values.AuthorKuba; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.Textures.BlockIcons.*; @@ -28,6 +27,7 @@ import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.collect.ImmutableSet; import com.gtnewhorizons.modularui.api.drawable.IDrawable; @@ -183,8 +183,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM openGUI(aBaseMetaTileEntity, aPlayer); return true; } - for (byte tSide : ALL_VALID_SIDES) { - if (aBaseMetaTileEntity.getAirAtSide(tSide)) { + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + if (aBaseMetaTileEntity.getAirAtSide(side)) { openGUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -723,13 +723,13 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public int getBlockLightValue() { return this.getBaseMetaTileEntity() - .getLightLevelAtSide((byte) 1); + .getLightLevelAtSide(ForgeDirection.UP); } @Override public boolean canBlockSeeTheSky() { return this.getBaseMetaTileEntity() - .getSkyAtSide((byte) 1); + .getSkyAtSide(ForgeDirection.UP); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index 3db90597f6..d7ddd84d21 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizons.modularui.api.drawable.IDrawable; @@ -116,15 +117,15 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == 0) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; - if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == ForgeDirection.DOWN) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1] }; + if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) .glow() .build() }; - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_GLOW) .glow() @@ -251,7 +252,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } energyUse = packetSize + ((V[mTier] * energyUse) / 100); if (getBaseMetaTileEntity().isUniversalEnergyStored(energyUse)) { - if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, packetSize, 1) > 0) { + if (((IEnergyConnected) tTile).injectEnergyUnits(ForgeDirection.UNKNOWN, packetSize, 1) + > 0) { getBaseMetaTileEntity().decreaseStoredEnergyUnits(energyUse, false); } } @@ -296,7 +298,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -306,12 +308,12 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 8186d716df..314ffd8d1d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -16,6 +16,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; import com.gtnewhorizons.modularui.api.drawable.UITexture; @@ -152,9 +153,9 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) // + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) // && aStack.getItem() == GT_DrillingLogicDelegate.MINING_PIPE_STACK.getItem(); } @@ -169,9 +170,9 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - if (aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != mMainFacing) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); + if (side != getBaseMetaTileEntity().getFrontFacing() && side != mMainFacing) { if (aPlayer.isSneaking()) { if (radiusConfig >= 0) { radiusConfig--; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java index 7306e89986..fde78cfa2e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java @@ -60,15 +60,15 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; - if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection != ForgeDirection.UP) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1] }; + if (active) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) .glow() .build() }; - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_GLOW) .glow() @@ -118,7 +118,7 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -128,7 +128,7 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @@ -158,12 +158,14 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java index ad73047507..2b1399b8f4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java @@ -4,6 +4,7 @@ import static gregtech.api.enums.Textures.BlockIcons.*; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -211,9 +212,9 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi } @Override - public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && getRecipeList().containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index db0a889205..ea67dc2dc3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -150,8 +150,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); int max = getMaxPumpableDistance(); if (aPlayer.isSneaking()) { if (radiusConfig >= 0) { @@ -175,12 +175,12 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true; + public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, + EntityPlayer entityPlayer, float aX, float aY, float aZ) { + if (super.onSolderingToolRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ)) return true; mDisallowRetract = !mDisallowRetract; GT_Utility.sendChatToPlayer( - aPlayer, + entityPlayer, StatCollector.translateToLocal( mDisallowRetract ? "GT5U.machines.autoretract.disabled" : "GT5U.machines.autoretract.enabled")); return true; @@ -234,8 +234,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { IGregTechTileEntity tTileEntity; for (int i = 1; (i < 21) - && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) - != null) + && ((tTileEntity = getBaseMetaTileEntity() + .getIGregTechTileEntityAtSideAndDistance(ForgeDirection.DOWN, i)) != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { // Apparently someone might stack 21 pumps on top of each other, so let's check for that getBaseMetaTileEntity().setActive(tTileEntity.isActive()); @@ -400,7 +400,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (this.mFluid != null && (aTick % 20 == 0)) { // auto outputs on top every second or so - IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide((byte) 1); // 1 is up. + IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(ForgeDirection.UP); // 1 is up. if (tTank != null) { FluidStack tDrained = drain(1000, false); if (tDrained != null) { @@ -732,7 +732,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -742,12 +742,12 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return false; } @@ -802,10 +802,10 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], - (aSide == 0 || aSide == 1) ? TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT) + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], + (sideDirection.offsetY != 0) ? TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT) : TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP) }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index 45abd16d9f..1d9b6f61e1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.NoSuchElementException; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.api.GregTech_API; @@ -179,9 +180,9 @@ public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && ItemList.Cell_Empty.isStackEqual(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java index 2c16cbad2a..751ab7f57d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java @@ -4,6 +4,7 @@ import static gregtech.api.enums.Textures.BlockIcons.*; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -107,9 +108,9 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && getRecipeList().containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index ef4dc2ec3b..508b9b07b4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -12,6 +12,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IIndividual; @@ -400,9 +401,9 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && getRecipeList().containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index ffff8801a5..a0d56a683a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -39,6 +39,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizons.modularui.api.drawable.IDrawable; @@ -210,21 +211,21 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != this.getBaseMetaTileEntity() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side != this.getBaseMetaTileEntity() .getFrontFacing()) - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER_SIDES), TextureFactory.builder() + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_SIDES), + TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_SIDES_GLOW) .glow() .build() }; - if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) .glow() .build() }; - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), TextureFactory.builder() .addIcon(OVERLAY_TELEPORTER_GLOW) .glow() @@ -314,19 +315,8 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } super.onPostTick(aBaseMetaTileEntity, aTick); if (getBaseMetaTileEntity().isServerSide()) { - // if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { - // this.hasEgg = checkForEgg(); - // } if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) { if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(sPassiveEnergyDrain, false)) { - // if (hasDimensionalTeleportCapability() && this.mTargetD != - // getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || - // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))&& new XSTR().nextInt(10)==0) { - // mFluid.amount--; - // if (mFluid.amount < 1) { - // mFluid = null; - // } - // } int tDistance = distanceCalculation(); if (mInventory[0] != null) { TileEntity tTile = null; @@ -343,8 +333,8 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank GT_Utility.moveOneItemStack( this, tTile, - (byte) 0, - (byte) 0, + ForgeDirection.DOWN, + ForgeDirection.DOWN, null, false, (byte) 64, @@ -377,15 +367,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank if (getBaseMetaTileEntity().decreaseStoredEnergyUnits( (long) (Math.pow(tDistance, 1.5) * weightCalculation(tEntity) * sFPowerMultiplyer), false)) { - // if (hasDimensionalTeleportCapability() && this.mTargetD != - // getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || - // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) { - // mFluid.amount = mFluid.amount - ((int) Math.min(10, (Math.pow(tDistance, 1.5) * - // weightCalculation(tEntity) / 8192))); - // if (mFluid.amount < 1) { - // mFluid = null; - // } - // } + if (tEntity.ridingEntity != null) { tEntity.mountEntity(null); } @@ -455,7 +437,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -465,12 +447,12 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java index b868d151f2..70270996f3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java @@ -279,11 +279,11 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta + Math.abs(getBaseMetaTileEntity().getZCoord() - aCoords.posZ); } - public ChunkCoordinates getFacingOffset(IGregTechTileEntity gt_tile, byte aSide) { + public ChunkCoordinates getFacingOffset(IGregTechTileEntity gt_tile, ForgeDirection side) { return new ChunkCoordinates( - gt_tile.getOffsetX(aSide, 1), - gt_tile.getOffsetY(aSide, 1), - gt_tile.getOffsetZ(aSide, 1)); + gt_tile.getOffsetX(side, 1), + gt_tile.getOffsetY(side, 1), + gt_tile.getOffsetZ(side, 1)); } public ChunkCoordinates getCoords() { @@ -312,12 +312,11 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - final int facing = getBaseMetaTileEntity().getFrontFacing(); - final int side = (byte) accessor.getSide() - .ordinal(); + final ForgeDirection facing = getBaseMetaTileEntity().getFrontFacing(); + final ForgeDirection side = accessor.getSide(); if (side == facing) currentTip.add(GOLD + "Pipeline Input" + RESET); - else if (side == ForgeDirection.OPPOSITES[facing]) currentTip.add(BLUE + "Pipeline Output" + RESET); + else if (side == facing.getOpposite()) currentTip.add(BLUE + "Pipeline Output" + RESET); else currentTip.add("Pipeline Side"); if (tag.getBoolean("hasSender")) currentTip.add("Other End of Input: " + GREEN + "distance" + RESET); diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java index 6b95d20d5c..11e2680e31 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java @@ -35,7 +35,6 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEntity_LongDistancePipelineBase { @@ -68,33 +67,32 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { + public FluidTankInfo[] getTankInfo(ForgeDirection side) { if (checkTarget()) { final IFluidHandler tankTile = getTank(); - if (tankTile != null) return tankTile.getTankInfo(aSide); + if (tankTile != null) return tankTile.getTankInfo(side); } return emptyTank; } @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean aDoFill) { + public int fill(ForgeDirection side, FluidStack aFluid, boolean aDoFill) { if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); final IFluidHandler tankTile = getTank(); - if (tankTile != null) - return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill); + if (tankTile != null) return tankTile.fill(tTile.getFrontFacing(), aFluid, aDoFill); } return 0; } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean aDoDrain) { + public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean aDoDrain) { return null; } @Override - public FluidStack drain(ForgeDirection aSide, int aMaxDrain, boolean aDoDrain) { + public FluidStack drain(ForgeDirection side, int aMaxDrain, boolean aDoDrain) { return null; } @@ -109,13 +107,13 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT) }; - else if (aSide == GT_Utility.getOppositeSide(aFacing)) return new ITexture[] { - MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK) }; - else return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + else if (sideDirection == facingDirection.getOpposite()) return new ITexture[] { + MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK) }; + else return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE), TextureFactory.builder() .addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW) .glow() diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java index dc3956d2a6..13cd231183 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java @@ -29,13 +29,13 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntity_LongDistancePipelineBase { @@ -149,12 +149,13 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit // @Override - public int[] getAccessibleSlotsFromSide(int aSide) { + public int[] getAccessibleSlotsFromSide(int ordinalSide) { if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); final IInventory iInventory = getInventory(); - if (iInventory instanceof ISidedInventory) - return ((ISidedInventory) iInventory).getAccessibleSlotsFromSide(tTile.getFrontFacing()); + if (iInventory instanceof ISidedInventory inv) return inv.getAccessibleSlotsFromSide( + tTile.getFrontFacing() + .ordinal()); if (iInventory != null) { final int[] tReturn = new int[iInventory.getSizeInventory()]; for (int i = 0; i < tReturn.length; i++) tReturn[i] = i; @@ -166,19 +167,22 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } @Override - public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) { + public boolean canInsertItem(int aSlot, ItemStack aStack, int ordinalSide) { if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); IInventory iInventory = getInventory(); - if (iInventory instanceof ISidedInventory) - return ((ISidedInventory) iInventory).canInsertItem(aSlot, aStack, tTile.getFrontFacing()); + if (iInventory instanceof ISidedInventory iSidedInventory) return iSidedInventory.canInsertItem( + aSlot, + aStack, + tTile.getFrontFacing() + .ordinal()); return iInventory != null; } return false; } @Override - public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) { + public boolean canExtractItem(int aSlot, ItemStack aStack, int ordinalSide) { return false; } @@ -188,13 +192,13 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, + ForgeDirection facingDirection, int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == facingDirection) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT) }; - else if (aSide == GT_Utility.getOppositeSide(aFacing)) return new ITexture[] { - MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK) }; - else return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + else if (side == facingDirection.getOpposite()) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK) }; + else return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE), TextureFactory.builder() .addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW) .glow() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index ccffb3cd3a..c92a33e5d5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -170,10 +170,10 @@ public class GT_MetaTileEntity_AssemblyLine } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { BlockIcons.casingTexturePages[0][16], TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { BlockIcons.casingTexturePages[0][16], TextureFactory.builder() .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) .extFacing() .build(), diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index b650619966..3fe0ab5149 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -2,6 +2,7 @@ package gregtech.common.tileentities.machines.multi; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.input.Keyboard; @@ -77,9 +78,9 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; } return FACING_SIDE; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index 2341f6a046..83e8cc1817 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -7,6 +7,7 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.GregTech_API; import gregtech.api.enums.SteamVariant; @@ -39,9 +40,9 @@ public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_Prim } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; } return FACING_SIDE; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 9e1912ca51..3a45496772 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; import gregtech.GT_Mod; @@ -46,8 +47,8 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul } @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + public boolean isFacingValid(ForgeDirection facing) { + return facing.offsetY == 0; } @Override @@ -267,9 +268,9 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == 1) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == ForgeDirection.UP) { if (aActive) return new ITexture[] { casingTexturePages[0][10], TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), TextureFactory.builder() .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) @@ -299,9 +300,9 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul new WorldSpawnedEventBuilder.ParticleEventBuilder().setMotion(0D, 0.3D, 0D) .setIdentifier(ParticleFX.LARGE_SMOKE) .setPosition( - aBaseMetaTileEntity.getOffsetX((byte) 1, 1) + XSTR_INSTANCE.nextFloat(), - aBaseMetaTileEntity.getOffsetY((byte) 1, 1), - aBaseMetaTileEntity.getOffsetZ((byte) 1, 1) + XSTR_INSTANCE.nextFloat()) + aBaseMetaTileEntity.getOffsetX(ForgeDirection.UP, 1) + XSTR_INSTANCE.nextFloat(), + aBaseMetaTileEntity.getOffsetY(ForgeDirection.UP, 1), + aBaseMetaTileEntity.getOffsetZ(ForgeDirection.UP, 1) + XSTR_INSTANCE.nextFloat()) .setWorld(getBaseMetaTileEntity().getWorld()) .run(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 5a25507524..a3326c4a07 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -1,6 +1,5 @@ package gregtech.common.tileentities.machines.multi; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.enums.GT_Values.debugCleanroom; import static gregtech.api.enums.Textures.BlockIcons.*; @@ -101,8 +100,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + public boolean isFacingValid(ForgeDirection facing) { + return facing.offsetY == 0; } @Override @@ -275,7 +274,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB if (doorState) { this.mEfficiency = Math.max(0, this.mEfficiency - 200); } - for (byte tSide : ALL_VALID_SIDES) { + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { final byte t = (byte) Math.max(1, (byte) (15 / (10000f / this.mEfficiency))); aBaseMetaTileEntity.setInternalOutputRedstoneSignal(tSide, t); } @@ -323,10 +322,10 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == ForgeDirection.DOWN.ordinal() || aSide == ForgeDirection.UP.ordinal()) { - return new ITexture[] { TextureFactory.of(BLOCK_PLASCRETE), aActive + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection.offsetY != 0) { + return new ITexture[] { TextureFactory.of(BLOCK_PLASCRETE), active ? TextureFactory.of( TextureFactory.of(OVERLAY_TOP_CLEANROOM_ACTIVE), TextureFactory.builder() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index 4fdc2e7f03..bf5d12482f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -113,9 +114,9 @@ public class GT_MetaTileEntity_DieselEngine } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][50], TextureFactory.builder() .addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 17b043ead2..73b6526903 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -149,14 +149,13 @@ public class GT_MetaTileEntity_DistillationTower extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) - .extFacing() - .build(), + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), TextureFactory.builder() .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index e7879cbe0d..d65dd0ad60 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -144,10 +144,10 @@ public abstract class GT_MetaTileEntity_DrillerBase } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { getCasingTextureForId(casingTextureIndex), TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { getCasingTextureForId(casingTextureIndex), TextureFactory.builder() .addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE) .extFacing() .build(), @@ -196,17 +196,17 @@ public abstract class GT_MetaTileEntity_DrillerBase } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, + EntityPlayer entityPlayer, float aX, float aY, float aZ) { + if (side == getBaseMetaTileEntity().getFrontFacing()) { mChunkLoadingEnabled = !mChunkLoadingEnabled; GT_Utility.sendChatToPlayer( - aPlayer, + entityPlayer, mChunkLoadingEnabled ? GT_Utility.trans("502", "Mining chunk loading enabled") : GT_Utility.trans("503", "Mining chunk loading disabled")); return true; } - return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); + return super.onSolderingToolRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ); } @Override @@ -444,7 +444,7 @@ public abstract class GT_MetaTileEntity_DrillerBase xDrill = getBaseMetaTileEntity().getXCoord(); yDrill = getBaseMetaTileEntity().getYCoord(); zDrill = getBaseMetaTileEntity().getZCoord(); - back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()); + back = getBaseMetaTileEntity().getBackFacing(); xPipe = xDrill + back.offsetX; zPipe = zDrill + back.offsetZ; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index acd87c1687..c0334bfcec 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -120,9 +121,9 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE) .extFacing() @@ -422,7 +423,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { inputSeparation = !inputSeparation; GT_Utility.sendChatToPlayer( aPlayer, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java index f156d4ffbd..ee08617950 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java @@ -10,6 +10,7 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -68,9 +69,9 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][60], TextureFactory.builder() .addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index a67b050abb..4f353b24f9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.google.common.collect.ImmutableMap; @@ -156,9 +157,9 @@ public abstract class GT_MetaTileEntity_FusionComputer public abstract MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + return side != getBaseMetaTileEntity().getFrontFacing(); } @Override @@ -243,9 +244,9 @@ public abstract class GT_MetaTileEntity_FusionComputer public abstract int getFusionCoilMeta(); @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[] { TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) return new ITexture[] { TextureFactory.builder() .addIcon(MACHINE_CASING_FUSION_GLASS) .extFacing() .build(), getTextureOverlay() }; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java index bdaf5209ce..95529c503f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -131,9 +132,9 @@ public class GT_MetaTileEntity_HeatExchanger extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 0ba884ab8c..a5cce300ed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -7,6 +7,7 @@ import static gregtech.api.enums.Textures.BlockIcons.*; import java.util.ArrayList; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizon.structurelib.structure.IStructureElement; @@ -68,9 +69,9 @@ public class GT_MetaTileEntity_ImplosionCompressor } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { BlockIcons.casingTexturePages[0][16], TextureFactory.builder() .addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java index 5b3db72c98..3747bf8523 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java @@ -23,6 +23,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -371,7 +372,7 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { sVoidStone = !sVoidStone; GT_Utility.sendChatToPlayer( @@ -662,9 +663,9 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX2), TextureFactory.builder() .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index a2086307f1..2e68b12375 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -187,9 +188,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { BlockIcons.getCasingTextureForId(getCasingTextureIndex()), TextureFactory.builder() .addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index 6fb7c6430a..d3d425fc7f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.StructureLibAPI; @@ -112,9 +113,9 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[1][48], TextureFactory.builder() .addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index 8ffd401646..102ffab30e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -137,14 +137,14 @@ public abstract class GT_MetaTileEntity_LargeTurbine if (!isNewStyleRendering() || !mFormed) return false; int[] tABCCoord = new int[] { -1, -1, 0 }; int[] tXYZOffset = new int[3]; - byte tFacing = getBaseMetaTileEntity().getFrontFacing(); - ExtendedFacing tExtendedFacing = getExtendedFacing(); - ForgeDirection tDirection = tExtendedFacing.getDirection(); - LightingHelper tLighting = new LightingHelper(aRenderer); + final ForgeDirection tFacing = getBaseMetaTileEntity().getFrontFacing(); + final ExtendedFacing tExtendedFacing = getExtendedFacing(); + final ForgeDirection tDirection = tExtendedFacing.getDirection(); + final LightingHelper tLighting = new LightingHelper(aRenderer); // for some reason +x and -z need this field set to true, but not any other sides - if (tFacing == 2 || tFacing == 5) aRenderer.field_152631_f = true; - Block tBlock = getCasingBlock(); + if (tFacing == ForgeDirection.NORTH || tFacing == ForgeDirection.EAST) aRenderer.field_152631_f = true; + final Block tBlock = getCasingBlock(); IIconContainer[] tTextures; if (getBaseMetaTileEntity().isActive()) tTextures = getTurbineTextureActive(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index d48f27a7a4..1984d48a51 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.GT_Mod; @@ -30,10 +31,10 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? (aActive ? TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + return new ITexture[] { MACHINE_CASINGS[1][colorIndex + 1], + aFacing == side ? (aActive ? TextureFactory.builder() .addIcon(LARGETURBINE_NEW_ACTIVE5) .build() : hasTurbine() ? TextureFactory.builder() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java index 81bd201b38..568925b371 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.GT_Mod; @@ -30,10 +31,10 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? (aActive ? TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + return new ITexture[] { MACHINE_CASINGS[1][colorIndex + 1], + aFacing == side ? (aActive ? TextureFactory.builder() .addIcon(LARGETURBINE_NEW_ACTIVE5) .build() : hasTurbine() ? TextureFactory.builder() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index fc1e7fe3ce..03d9de99be 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -10,6 +10,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.GT_Mod; @@ -36,10 +37,10 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? (aActive ? TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + return new ITexture[] { MACHINE_CASINGS[1][colorIndex + 1], + aFacing == side ? (aActive ? TextureFactory.builder() .addIcon(LARGETURBINE_NEW_ACTIVE5) .build() : hasTurbine() ? TextureFactory.builder() @@ -192,8 +193,8 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (side == getBaseMetaTileEntity().getFrontFacing()) { looseFit ^= true; GT_Utility.sendChatToPlayer( aPlayer, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index cfc565558b..df4e7e6d91 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -8,6 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -36,10 +37,10 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? (aActive ? TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + return new ITexture[] { MACHINE_CASINGS[1][colorIndex + 1], + aFacing == side ? (aActive ? TextureFactory.builder() .addIcon(LARGETURBINE_NEW_ACTIVE5) .build() : hasTurbine() ? TextureFactory.builder() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java index 1a6a6f678a..17fe1d2af3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java @@ -10,6 +10,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import gregtech.GT_Mod; @@ -37,10 +38,10 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return new ITexture[] { MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? (aActive ? TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + return new ITexture[] { MACHINE_CASINGS[1][colorIndex + 1], + aFacing == side ? (aActive ? TextureFactory.builder() .addIcon(LARGETURBINE_NEW_ACTIVE5) .build() : hasTurbine() ? TextureFactory.builder() @@ -233,8 +234,8 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (side == getBaseMetaTileEntity().getFrontFacing()) { looseFit ^= true; GT_Utility.sendChatToPlayer( aPlayer, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index 58d82f2901..3bc884f8af 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -104,10 +104,10 @@ public class GT_MetaTileEntity_MultiFurnace } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != aFacing) return new ITexture[] { casingTexturePages[0][CASING_INDEX] }; - if (aActive) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection != facingDirection) return new ITexture[] { casingTexturePages[0][CASING_INDEX] }; + if (active) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() .addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE) .extFacing() .build(), @@ -219,11 +219,11 @@ public class GT_MetaTileEntity_MultiFurnace } private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int tX = aBaseMetaTileEntity.getXCoord() + xDir; - int tY = aBaseMetaTileEntity.getYCoord(); - int tZ = aBaseMetaTileEntity.getZCoord() + zDir; + final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX; + final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ; + final int tX = aBaseMetaTileEntity.getXCoord() + xDir; + final int tY = aBaseMetaTileEntity.getYCoord(); + final int tZ = aBaseMetaTileEntity.getZCoord() + zDir; int tUsedMeta; for (int xPos = tX - 1; xPos <= tX + 1; xPos++) for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { if ((xPos == tX) && (zPos == tZ)) continue; @@ -238,12 +238,12 @@ public class GT_MetaTileEntity_MultiFurnace @Override public String[] getInfoData() { int mPollutionReduction = 0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) if (isValidMetaTileEntity(tHatch)) + for (final GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) if (isValidMetaTileEntity(tHatch)) mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); long storedEnergy = 0; long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { + for (final GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity() .getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java index 61ce017d5a..1468dab84b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_NanoForge.java @@ -185,10 +185,10 @@ public class GT_MetaTileEntity_NanoForge extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { BlockIcons.getCasingTextureForId(GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 10)), TextureFactory.builder() .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) @@ -487,7 +487,7 @@ public class GT_MetaTileEntity_NanoForge extends } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { inputSeparation = !inputSeparation; GT_Utility.sendChatToPlayer( aPlayer, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index 384013459c..478aa7f7cd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -136,10 +136,10 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { casingTexturePages[0][CASING_INDEX], TextureFactory.builder() .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) .extFacing() .build(), @@ -322,16 +322,16 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int tX = aBaseMetaTileEntity.getXCoord() + xDir; - int tY = aBaseMetaTileEntity.getYCoord(); - int tZ = aBaseMetaTileEntity.getZCoord() + zDir; + final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX; + final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ; + final int tX = aBaseMetaTileEntity.getXCoord() + xDir; + final int tY = aBaseMetaTileEntity.getYCoord(); + final int tZ = aBaseMetaTileEntity.getZCoord() + zDir; for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2)) for (int yPos = tY - 1; yPos <= tY + 1; yPos++) for (int zPos = tZ - 1; zPos <= tZ + 1; zPos += (xDir != 0 ? 2 : 1)) { if ((yPos == tY) && (xPos == tX || zPos == tZ)) continue; - byte tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos); + final byte tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos); if (tUsedMeta < 12) continue; if (tUsedMeta > 14) continue; if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1) continue; @@ -343,12 +343,12 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult @Override public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { + final ArrayList<FluidStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { tHatch.mRecipeMap = getRecipeMap(); if (tHatch instanceof GT_MetaTileEntity_Hatch_MultiInput) { if (isValidMetaTileEntity(tHatch)) { - for (FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { + for (final FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { if (tFluid != null && !GT_Recipe.GT_Recipe_Map.sCrackingRecipes.isValidCatalystFluid(tFluid)) { rList.add(tFluid); } @@ -361,11 +361,11 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } } } - for (GT_MetaTileEntity_Hatch_Input tHatch : mMiddleInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input tHatch : mMiddleInputHatches) { tHatch.mRecipeMap = getRecipeMap(); if (tHatch instanceof GT_MetaTileEntity_Hatch_MultiInput) { if (isValidMetaTileEntity(tHatch)) { - for (FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { + for (final FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { if (tFluid != null && GT_Recipe.GT_Recipe_Map.sCrackingRecipes.isValidCatalystFluid(tFluid)) { rList.add(tFluid); } @@ -373,7 +373,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } } else { if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { - FluidStack tStack = tHatch.getFillableStack(); + final FluidStack tStack = tHatch.getFillableStack(); if (GT_Recipe.GT_Recipe_Map.sCrackingRecipes.isValidCatalystFluid(tStack)) { rList.add(tStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index c945e8c861..1e7f683bc5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -22,6 +22,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -54,9 +55,9 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { getCasingTextureForId(casingTextureIndex), TextureFactory.builder() .addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE) .extFacing() @@ -122,8 +123,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D protected abstract int getRangeInChunks(); @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); int oldChunkRange = chunkRangeConfig; if (aPlayer.isSneaking()) { if (chunkRangeConfig > 0) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index de6b5c5144..8e8f16d111 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -20,6 +20,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.google.common.collect.ImmutableList; @@ -72,8 +73,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) { if (chunkRadiusConfig > 0) { chunkRadiusConfig--; @@ -94,8 +95,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, + float aX, float aY, float aZ) { replaceWithCobblestone = !replaceWithCobblestone; GT_Utility.sendChatToPlayer(aPlayer, "Replace with cobblestone " + replaceWithCobblestone); return true; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java index 0938da2b65..719cbc0f63 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PCBFactory.java @@ -385,10 +385,10 @@ public class GT_MetaTileEntity_PCBFactory extends } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { BlockIcons.getCasingTextureForId( getTier() < 3 ? GT_Utility.getCasingTextureIndex(GregTech_API.sBlockCasings8, 11) @@ -854,7 +854,7 @@ public class GT_MetaTileEntity_PCBFactory extends } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { inputSeparation = !inputSeparation; GT_Utility.sendChatToPlayer( aPlayer, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java index 30368a12f0..621a6aaf16 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java @@ -18,6 +18,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -607,9 +608,9 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][DIM_BRIDGE_CASING], TextureFactory.builder() .addIcon(OVERLAY_DTPF_ON) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index ccd536d341..88ca267e51 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -113,12 +113,12 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return false; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return false; } @@ -128,8 +128,8 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + public boolean isFacingValid(ForgeDirection facing) { + return facing.offsetY == 0; } @Override @@ -154,9 +154,9 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCoverID) { return (GregTech_API.getCoverBehaviorNew(aCoverID.toStack()) - .isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); + .isSimpleCover()) && (super.allowCoverOnSide(side, aCoverID)); } @Override @@ -196,14 +196,12 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn @Override public ExtendedFacing getExtendedFacing() { - return ExtendedFacing.of(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); + return ExtendedFacing.of(getBaseMetaTileEntity().getFrontFacing()); } @Override public void setExtendedFacing(ExtendedFacing alignment) { - getBaseMetaTileEntity().setFrontFacing( - (byte) alignment.getDirection() - .ordinal()); + getBaseMetaTileEntity().setFrontFacing(alignment.getDirection()); } @Override @@ -329,7 +327,7 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isActive()) { - final byte frontFacing = aBaseMetaTileEntity.getFrontFacing(); + final ForgeDirection frontFacing = aBaseMetaTileEntity.getFrontFacing(); final double oX = aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 0.5D; final double oY = aBaseMetaTileEntity.getOffsetY(frontFacing, 1); @@ -341,13 +339,13 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn y = oY + XSTR_INSTANCE.nextFloat() * 10D / 16D + 5D / 16D; - if (frontFacing == ForgeDirection.WEST.ordinal()) { + if (frontFacing == ForgeDirection.WEST) { x = oX - offset; z = oZ + horizontal; - } else if (frontFacing == ForgeDirection.EAST.ordinal()) { + } else if (frontFacing == ForgeDirection.EAST) { x = oX + offset; z = oZ + horizontal; - } else if (frontFacing == ForgeDirection.NORTH.ordinal()) { + } else if (frontFacing == ForgeDirection.NORTH) { x = oX + horizontal; z = oZ - offset; } else // if (frontFacing == ForgeDirection.SOUTH.ordinal()) @@ -441,12 +439,14 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return aIndex > INPUT_SLOTS; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 6e60396af4..ff8178ad78 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.google.common.collect.ImmutableList; @@ -115,9 +116,9 @@ public class GT_MetaTileEntity_ProcessingArray } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { BlockIcons.casingTexturePages[0][48], TextureFactory.builder() .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE) .extFacing() @@ -453,10 +454,10 @@ public class GT_MetaTileEntity_ProcessingArray } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { // Lock to single recipe - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); } else { inputSeparation = !inputSeparation; GT_Utility.sendChatToPlayer( @@ -466,8 +467,8 @@ public class GT_MetaTileEntity_ProcessingArray } @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, + float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { batchMode = !batchMode; if (batchMode) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 90bfa18138..d9b9d3c943 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -118,10 +118,10 @@ public class GT_MetaTileEntity_PyrolyseOven } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aActive) return new ITexture[] { BlockIcons.casingTexturePages[8][66], TextureFactory.builder() + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection == facingDirection) { + if (active) return new ITexture[] { BlockIcons.casingTexturePages[8][66], TextureFactory.builder() .addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE) .extFacing() .build(), @@ -263,11 +263,11 @@ public class GT_MetaTileEntity_PyrolyseOven } private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int tX = aBaseMetaTileEntity.getXCoord() + xDir * 2; - int tY = aBaseMetaTileEntity.getYCoord(); - int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2; + final int xDir = aBaseMetaTileEntity.getBackFacing().offsetX; + final int zDir = aBaseMetaTileEntity.getBackFacing().offsetZ; + final int tX = aBaseMetaTileEntity.getXCoord() + xDir * 2; + final int tY = aBaseMetaTileEntity.getYCoord(); + final int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2; for (int xPos = tX - 1; xPos <= tX + 1; xPos++) { for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { if (aBaseMetaTileEntity.getBlock(xPos, tY, zPos) == GregTech_API.sBlockCasings1 diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_TranscendentPlasmaMixer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_TranscendentPlasmaMixer.java index b8d9b008e2..2c1b7dae57 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_TranscendentPlasmaMixer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_TranscendentPlasmaMixer.java @@ -13,6 +13,7 @@ import static net.minecraft.util.EnumChatFormatting.GRAY; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -98,9 +99,9 @@ public class GT_MetaTileEntity_TranscendentPlasmaMixer } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][DIM_TRANS_CASING], TextureFactory.builder() .addIcon(OVERLAY_DTPF_ON) .extFacing() diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index 19bd46df5d..1d86dfecce 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -7,6 +7,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZE import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.structure.IStructureElement; @@ -59,10 +60,10 @@ public class GT_MetaTileEntity_VacuumFreezer } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { ITexture[] rTexture; - if (aSide == aFacing) { + if (side == aFacing) { if (aActive) { rTexture = new ITexture[] { casingTexturePages[0][17], TextureFactory.builder() .addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE) diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java index 64ae331f99..8fce81c676 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java @@ -140,9 +140,9 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi // Random Sparkles at main face if (aBaseMetaTileEntity.isActive() && XSTR_INSTANCE.nextInt(3) == 0) { - final byte mainFacing = (byte) this.mMainFacing; + final ForgeDirection mainFacing = this.mMainFacing; - if (mainFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + if (mainFacing.ordinal() > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); @@ -155,17 +155,17 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi y = oY + XSTR_INSTANCE.nextFloat() * 10D / 16D + 5D / 16D; - if (mainFacing == ForgeDirection.WEST.ordinal()) { + if (mainFacing == ForgeDirection.WEST) { x = oX - offset; mX = -.05D; z = oZ + horizontal; mZ = 0D; - } else if (mainFacing == ForgeDirection.EAST.ordinal()) { + } else if (mainFacing == ForgeDirection.EAST) { x = oX + offset; mX = .05D; z = oZ + horizontal; mZ = 0D; - } else if (mainFacing == ForgeDirection.NORTH.ordinal()) { + } else if (mainFacing == ForgeDirection.NORTH) { x = oX + horizontal; mX = 0D; z = oZ - offset; diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java index 75aaf48078..3fc2d45e38 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java @@ -140,9 +140,9 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic // Random Sparkles at main face if (aBaseMetaTileEntity.isActive() && XSTR_INSTANCE.nextInt(3) == 0) { - final byte mainFacing = (byte) this.mMainFacing; + final ForgeDirection mainFacing = this.mMainFacing; - if (mainFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + if (mainFacing.ordinal() > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); @@ -155,17 +155,17 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic y = oY + XSTR_INSTANCE.nextFloat() * 10D / 16D + 5D / 16D; - if (mainFacing == ForgeDirection.WEST.ordinal()) { + if (mainFacing == ForgeDirection.WEST) { x = oX - offset; mX = -.05D; z = oZ + horizontal; mZ = 0D; - } else if (mainFacing == ForgeDirection.EAST.ordinal()) { + } else if (mainFacing == ForgeDirection.EAST) { x = oX + offset; mX = .05D; z = oZ + horizontal; mZ = 0D; - } else if (mainFacing == ForgeDirection.NORTH.ordinal()) { + } else if (mainFacing == ForgeDirection.NORTH) { x = oX + horizontal; mX = 0D; z = oZ - offset; diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java index 088292548a..1f22455311 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.steam; import static gregtech.api.enums.Textures.BlockIcons.*; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; @@ -54,9 +55,9 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java index 49663fd852..4c2d039a8e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.steam; import static gregtech.api.enums.Textures.BlockIcons.*; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; @@ -54,9 +55,9 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index 7481b8716a..7097d68525 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -44,11 +44,9 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM super.onPreTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - final byte topFacing = (byte) ForgeDirection.UP.ordinal(); - - if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + if (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP + && aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP)) { new ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D) .setIdentifier(ParticleFX.SMOKE) @@ -86,9 +84,9 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index fb270fc95f..2c221a273a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -43,12 +43,9 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - - final byte topFacing = (byte) ForgeDirection.UP.ordinal(); - - if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + if (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP + && aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP)) { new WorldSpawnedEventBuilder.ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D) .setIdentifier(ParticleFX.SMOKE) @@ -86,9 +83,9 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa } @Override - public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index aeced754fe..ec8eade5da 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -20,6 +20,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.storage.IMEMonitor; import appeng.api.storage.IMEMonitorHandlerReceiver; @@ -274,7 +275,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { mVoidOverflow = !mVoidOverflow; GT_Utility.sendChatToPlayer( aPlayer, @@ -284,9 +285,9 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true; + public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, + float aX, float aY, float aZ) { + if (super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ)) return true; mDisableFilter = !mDisableFilter; GT_Utility.sendChatToPlayer( aPlayer, @@ -355,7 +356,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -467,13 +468,15 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; return aIndex == 1; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; if (aIndex != 0) return false; if ((mInventory[0] != null && !GT_Utility.areStacksEqual(mInventory[0], aStack))) return false; @@ -483,10 +486,10 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != aFacing) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_SCHEST), + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side != aFacing) return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1] }; + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_SCHEST), TextureFactory.builder() .addIcon(OVERLAY_SCHEST_GLOW) .glow() @@ -497,7 +500,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); - NBTTagCompound tag = accessor.getNBTData(); + final NBTTagCompound tag = accessor.getNBTData(); if (tag.hasKey("itemType", Constants.NBT.TAG_COMPOUND)) { currenttip.add("Item Count: " + GT_Utility.parseNumberToString(tag.getInteger("itemCount"))); currenttip.add( diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java index 14f1501527..822b4e0f6f 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java @@ -268,14 +268,14 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide != ForgeDirection.UP.ordinal()) { - if (aSide == aBaseMetaTileEntity.getFrontFacing()) { - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPE) }; - } else return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, + ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { + if (sideDirection != ForgeDirection.UP) { + if (sideDirection == baseMetaTileEntity.getFrontFacing()) { + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_PIPE) }; + } else return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1] }; } - return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_QTANK), + return new ITexture[] { MACHINE_CASINGS[mTier][colorIndex + 1], TextureFactory.of(OVERLAY_QTANK), TextureFactory.builder() .addIcon(OVERLAY_QTANK_GLOW) .glow() @@ -289,8 +289,8 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (side == getBaseMetaTileEntity().getFrontFacing()) { mAllowInputFromOutputSide = !mAllowInputFromOutputSide; GT_Utility.sendChatToPlayer( aPlayer, @@ -411,12 +411,9 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit if (tTank != null) { FluidStack tDrained = drain(20 * (1 << (3 + 2 * tierPump(mTier))), false); if (tDrained != null) { - int tFilledAmount = tTank - .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); - if (tFilledAmount > 0) tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - drain(tFilledAmount, true), - true); + int tFilledAmount = tTank.fill(aBaseMetaTileEntity.getBackFacing(), tDrained, false); + if (tFilledAmount > 0) + tTank.fill(aBaseMetaTileEntity.getBackFacing(), drain(tFilledAmount, true), true); } } } @@ -424,27 +421,27 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection side) { return true; } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(ForgeDirection side) { return false; } @Override - public boolean isLiquidInput(byte aSide) { - return mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing(); + public boolean isLiquidInput(ForgeDirection side) { + return mAllowInputFromOutputSide || side != getBaseMetaTileEntity().getFrontFacing(); } @Override - public boolean isLiquidOutput(byte aSide) { + public boolean isLiquidOutput(ForgeDirection side) { return true; } @@ -478,7 +475,7 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { + public FluidTankInfo[] getTankInfo(ForgeDirection side) { return new FluidTankInfo[] { getInfo() }; } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java index 32d1694cc8..9779d696ea 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java @@ -8,6 +8,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_LOCKER; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; @@ -57,13 +58,13 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[] { this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { + return new ITexture[] { this.mTextures[2][(colorIndex + 1)][0], this.mTextures[2][(colorIndex + 1)][1], LOCKERS[Math.abs(this.mType % LOCKERS.length)] }; } - return this.mTextures[0][(aColorIndex + 1)]; + return this.mTextures[0][(colorIndex + 1)]; } @Override @@ -87,8 +88,8 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; + public boolean isFacingValid(ForgeDirection facing) { + return facing.offsetY == 0; } @Override @@ -97,8 +98,8 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public boolean isInputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getBackFacing(); + public boolean isInputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getBackFacing(); } @Override @@ -164,21 +165,21 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (side == getBaseMetaTileEntity().getFrontFacing()) { this.mType = ((byte) (this.mType + 1)); } } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { + return side != getBaseMetaTileEntity().getFrontFacing(); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { - if ((aBaseMetaTileEntity.isServerSide()) && (aSide == aBaseMetaTileEntity.getFrontFacing())) { + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side, + float aX, float aY, float aZ) { + if ((aBaseMetaTileEntity.isServerSide()) && (side == aBaseMetaTileEntity.getFrontFacing())) { for (int i = 0; i < 4; i++) { ItemStack tSwapStack = this.mInventory[i]; this.mInventory[i] = aPlayer.inventory.armorInventory[i]; @@ -191,12 +192,14 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return false; } } |