aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-04-22 22:33:35 -0700
committerGitHub <noreply@github.com>2023-04-23 07:33:35 +0200
commit56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b (patch)
tree745e6d92025ec4ef449fc59fa5fdd741200b0489 /src/main/java/gregtech/api/util
parentac0b7a7da46646d325def36eed811941dbfc5950 (diff)
downloadGT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.gz
GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.bz2
GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.zip
Forge direction (#1895)
* ForgeDirection Also refactor the clusterfuck that was `getCoordinateScan` Co-authored by: Jason Mitchell <mitchej@gmail.com> * Fix rendering of Frame Boxes Frame boxes needed their own implementation of getTexture with int connexion mask, which is returning an error texture for the MetaTileEntity, because pipes (FrameBox **is** a pipe) do use this method to return different textures based on connexion status. --------- Co-authored-by: Léa Gris <lea.gris@noiraude.net>
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_CircuitryBehavior.java14
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehavior.java218
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java299
-rw-r--r--src/main/java/gregtech/api/util/GT_HatchElementBuilder.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java1591
-rw-r--r--src/main/java/gregtech/api/util/LightingHelper.java21
6 files changed, 1081 insertions, 1064 deletions
diff --git a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
index b15627bb05..d5cd50049e 100644
--- a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
@@ -1,6 +1,6 @@
package gregtech.api.util;
-import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES;
+import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -35,7 +35,7 @@ public abstract class GT_CircuitryBehavior {
* returns if there is Redstone applied to any of the valid Inputs (OR)
*/
public static boolean getAnyRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
@@ -54,7 +54,7 @@ public abstract class GT_CircuitryBehavior {
* returns if there is Redstone applied to all the valid Inputs (AND)
*/
public static boolean getAllRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
@@ -74,7 +74,7 @@ public abstract class GT_CircuitryBehavior {
*/
public static boolean getOneRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
int tRedstoneAmount = 0;
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
@@ -94,7 +94,7 @@ public abstract class GT_CircuitryBehavior {
*/
public static byte getStrongestRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
byte tRedstoneAmount = 0;
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
@@ -117,7 +117,7 @@ public abstract class GT_CircuitryBehavior {
public static byte getWeakestNonZeroRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0;
byte tRedstoneAmount = 15;
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
@@ -137,7 +137,7 @@ public abstract class GT_CircuitryBehavior {
public static byte getWeakestRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) {
if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0;
byte tRedstoneAmount = 15;
- for (byte side : ALL_VALID_SIDES) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side)
.letsRedstoneGoIn(
side,
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
index 60196bd236..6441adb22b 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import gregtech.api.enums.GT_Values;
@@ -47,172 +48,161 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
}
@Override
- protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID,
+ protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) {
- return isRedstoneSensitive(aSide, aCoverID, aCoverVariable.get(), aTileEntity, aTimer);
+ return isRedstoneSensitive(side, aCoverID, aCoverVariable.get(), aTileEntity, aTimer);
}
@Override
- protected ISerializableObject.LegacyCoverData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID,
- ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ protected ISerializableObject.LegacyCoverData doCoverThingsImpl(ForgeDirection side, byte aInputRedstone,
+ int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) {
if (aCoverVariable == null) aCoverVariable = new ISerializableObject.LegacyCoverData();
- aCoverVariable.set(doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable.get(), aTileEntity, aTimer));
+ aCoverVariable.set(doCoverThings(side, aInputRedstone, aCoverID, aCoverVariable.get(), aTileEntity, aTimer));
return aCoverVariable;
}
@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) {
- return onCoverRightclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ);
+ return onCoverRightclick(side, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ);
}
@Override
- protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl(byte aSide, int aCoverID,
+ protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX,
float aY, float aZ) {
if (aCoverVariable == null) aCoverVariable = new ISerializableObject.LegacyCoverData();
aCoverVariable
- .set(onCoverScrewdriverclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ));
+ .set(onCoverScrewdriverclick(side, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ));
return aCoverVariable;
}
@Override
- protected boolean onCoverShiftRightClickImpl(byte aSide, int aCoverID,
+ protected boolean onCoverShiftRightClickImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) {
- return onCoverShiftRightclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer);
+ return onCoverShiftRightclick(side, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer);
}
@Deprecated
@Override
- protected Object getClientGUIImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) {
- return getClientGUI(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
- }
-
- @Override
- protected boolean onCoverRemovalImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity, boolean aForced) {
- return onCoverRemoval(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aForced);
+ protected Object getClientGUIImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer,
+ World aWorld) {
+ return getClientGUI(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected String getDescriptionImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return getDescription(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean onCoverRemovalImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, boolean aForced) {
+ return onCoverRemoval(side, aCoverID, convert(aCoverVariable), aTileEntity, aForced);
}
@Override
- protected float getBlastProofLevelImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return getBlastProofLevel(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
- }
-
- @Override
- protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return letsRedstoneGoIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected String getDescriptionImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return getDescription(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID,
+ protected float getBlastProofLevelImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
- return letsRedstoneGoOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ return getBlastProofLevel(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsFibreGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return letsFibreGoIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return letsRedstoneGoIn(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsFibreGoOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return letsFibreGoOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return letsRedstoneGoOut(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsEnergyInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return letsEnergyIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return letsEnergyIn(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return letsEnergyOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return letsEnergyOut(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean letsFluidInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- Fluid aFluid, ICoverable aTileEntity) {
- return letsFluidIn(aSide, aCoverID, convert(aCoverVariable), aFluid, aTileEntity);
+ protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return letsFluidIn(side, aCoverID, convert(aCoverVariable), aFluid, aTileEntity);
}
@Override
- protected boolean letsFluidOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- Fluid aFluid, ICoverable aTileEntity) {
- return letsFluidOut(aSide, aCoverID, convert(aCoverVariable), aFluid, aTileEntity);
+ protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ return letsFluidOut(side, aCoverID, convert(aCoverVariable), aFluid, aTileEntity);
}
@Override
- protected boolean letsItemsInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- int aSlot, ICoverable aTileEntity) {
- return letsItemsIn(aSide, aCoverID, convert(aCoverVariable), aSlot, aTileEntity);
+ protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return letsItemsIn(side, aCoverID, convert(aCoverVariable), aSlot, aTileEntity);
}
@Override
- protected boolean letsItemsOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- int aSlot, ICoverable aTileEntity) {
- return letsItemsOut(aSide, aCoverID, convert(aCoverVariable), aSlot, aTileEntity);
+ protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return letsItemsOut(side, aCoverID, convert(aCoverVariable), aSlot, aTileEntity);
}
@Override
- protected boolean isGUIClickableImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return isGUIClickable(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected boolean isGUIClickableImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return isGUIClickable(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID,
+ protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
- return manipulatesSidedRedstoneOutput(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ return manipulatesSidedRedstoneOutput(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID,
+ protected boolean alwaysLookConnectedImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
- return alwaysLookConnected(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ return alwaysLookConnected(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected byte getRedstoneInputImpl(byte aSide, byte aInputRedstone, int aCoverID,
+ protected byte getRedstoneInputImpl(ForgeDirection side, byte aInputRedstone, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
- return getRedstoneInput(aSide, aInputRedstone, aCoverID, convert(aCoverVariable), aTileEntity);
+ return getRedstoneInput(side, aInputRedstone, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected int getTickRateImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
+ protected int getTickRateImpl(ForgeDirection side, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
ICoverable aTileEntity) {
- return getTickRate(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ return getTickRate(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected byte getLensColorImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return getLensColor(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected byte getLensColorImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return getLensColor(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
@Override
- protected ItemStack getDropImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable,
- ICoverable aTileEntity) {
- return getDrop(aSide, aCoverID, convert(aCoverVariable), aTileEntity);
+ protected ItemStack getDropImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ return getDrop(side, aCoverID, convert(aCoverVariable), aTileEntity);
}
// endregion
- 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 true;
}
@@ -220,8 +210,8 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
/**
* Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time.
*/
- 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;
}
@@ -230,7 +220,7 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* <p/>
* return true, if something actually happens.
*/
- 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;
}
@@ -240,7 +230,7 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* <p/>
* return the new Value of the Cover Variable
*/
- 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) {
return aCoverVariable;
}
@@ -248,17 +238,17 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
/**
* Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case.
*/
- public boolean onCoverShiftRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ public boolean onCoverShiftRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
EntityPlayer aPlayer) {
if (hasCoverGUI() && aPlayer instanceof EntityPlayerMP) {
lastPlayer = aPlayer;
mPlayerNotified = false;
if (useModularUI()) {
- GT_UIInfos.openCoverUI(aTileEntity, aPlayer, aSide);
+ GT_UIInfos.openCoverUI(aTileEntity, aPlayer, side);
} else {
GT_Values.NW.sendToPlayer(
new GT_Packet_TileEntityCoverGUI(
- aSide,
+ side,
aCoverID,
aCoverVariable,
aTileEntity,
@@ -271,7 +261,7 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
}
@Deprecated
- public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ public Object getClientGUI(ForgeDirection side, int aCoverID, int coverData, ICoverable aTileEntity) {
return null;
}
@@ -279,7 +269,7 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* Removes the Cover if this returns true, or if aForced is true. Doesn't get called when the Machine Block is
* getting broken, only if you break the Cover away from the Machine.
*/
- 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;
}
@@ -287,14 +277,14 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
/**
* Gives a small Text for the status of the Cover.
*/
- public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public String getDescription(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return E;
}
/**
* How Blast Proof the Cover is. 30 is normal.
*/
- public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public float getBlastProofLevel(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 10.0F;
}
@@ -303,58 +293,44 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* <p/>
* This is just Informative so that Machines know if their Redstone Input is blocked or not
*/
- public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
/**
* If it lets RS-Signals out of the Block
*/
- public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return false;
- }
-
- /**
- * If it lets Fibre-Signals into the Block
- * <p/>
- * This is just Informative so that Machines know if their Redstone Input is blocked or not
- */
- public boolean letsFibreGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return false;
- }
-
- /**
- * If it lets Fibre-Signals out of the Block
- */
- public boolean letsFibreGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
/**
* If it lets Energy into the Block
*/
- public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsEnergyIn(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
/**
* If it lets Energy out of the Block
*/
- public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean letsEnergyOut(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
/**
* If it lets Liquids into the Block, aFluid can be null meaning if this is generally allowing Fluids or not.
*/
- 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;
}
/**
* If it lets Liquids out of the Block, aFluid can be null meaning if this is generally allowing Fluids or not.
*/
- 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;
}
@@ -363,7 +339,8 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each
* Slot).
*/
- 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;
}
@@ -372,21 +349,22 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each
* Slot).
*/
- 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;
}
/**
* If it lets you rightclick the Machine normally
*/
- public boolean isGUIClickable(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean isGUIClickable(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
/**
* Needs to return true for Covers, which have a Redstone Output on their Facing.
*/
- public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable,
+ public boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, int aCoverVariable,
ICoverable aTileEntity) {
return false;
}
@@ -394,7 +372,7 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
/**
* if this Cover should let Pipe Connections look connected even if it is not the case.
*/
- public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return false;
}
@@ -402,9 +380,9 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* Called to determine the incoming Redstone Signal of a Machine. Returns the original Redstone per default. The
* Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0.
*/
- 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 letsRedstoneGoIn(aSide, aCoverID, aCoverVariable, aTileEntity) ? aInputRedstone : 0;
+ return letsRedstoneGoIn(side, aCoverID, aCoverVariable, aTileEntity) ? aInputRedstone : 0;
}
/**
@@ -412,21 +390,21 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
* <p/>
* 0 = No Ticks! Yes, 0 is Default, you have to override this
*/
- public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 0;
}
/**
* The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then).
*/
- public byte getLensColor(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ public byte getLensColor(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return -1;
}
/**
* @return the ItemStack dropped by this Cover
*/
- public ItemStack getDrop(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
- return GT_OreDictUnificator.get(true, aTileEntity.getCoverItemAtSide(aSide));
+ public ItemStack getDrop(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return GT_OreDictUnificator.get(true, aTileEntity.getCoverItemAtSide(side));
}
}
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index 1757d0375a..8f65ae1553 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import com.gtnewhorizons.modularui.api.ModularUITextures;
@@ -89,23 +90,23 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
/**
* Get target facade block. Does not affect rendering of **this** block. It is only used as a hint for other block
* in case of CTM
- *
+ *
* @return null if none, otherwise return facade target block
*/
- public final Block getFacadeBlock(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final Block getFacadeBlock(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
- return getFacadeBlockImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ return getFacadeBlockImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
* Get target facade block. Does not affect rendering of **this** block. It is only used as a hint for other block
* in case of CTM
- *
+ *
* @return 0 if none, otherwise return facade target meta
*/
- public final int getFacadeMeta(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final int getFacadeMeta(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
- return getFacadeMetaImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ return getFacadeMetaImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
@@ -120,46 +121,46 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
* passed to {@link gregtech.api.GregTech_API#registerCover(ItemStack, ITexture, GT_CoverBehaviorBase)} or its
* overloads.
*/
- public final ITexture getSpecialCoverFGTexture(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
- ICoverable aTileEntity) {
- return getSpecialCoverFGTextureImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ public final ITexture getSpecialCoverFGTexture(ForgeDirection side, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity) {
+ return getSpecialCoverFGTextureImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
* Get the special cover texture associated with this cover. Return null if one should use the texture passed to
* {@link gregtech.api.GregTech_API#registerCover(ItemStack, ITexture, GT_CoverBehaviorBase)} or its overloads.
*/
- public final ITexture getSpecialCoverTexture(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final ITexture getSpecialCoverTexture(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
- return getSpecialCoverTextureImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ return getSpecialCoverTextureImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
* Return whether cover data needs to be synced to client upon tile entity creation or cover placement.
*
* Note if you want to sync the data afterwards you will have to manually do it by calling
- * {@link ICoverable#issueCoverUpdate(byte)} This option only affects the initial sync.
+ * {@link ICoverable#issueCoverUpdate(ForgeDirection)} This option only affects the initial sync.
*/
- public final boolean isDataNeededOnClient(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final boolean isDataNeededOnClient(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
- return isDataNeededOnClientImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ return isDataNeededOnClientImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
* Called upon receiving data from network. Use {@link ICoverable#isClientSide()} to determine the side.
*/
- public final void onDataChanged(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final void onDataChanged(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
- onDataChangedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ onDataChangedImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
/**
* Called before receiving data from network. Use {@link ICoverable#isClientSide()} to determine the side.
*/
- public final void preDataChanged(byte aSide, int aCoverID, int aNewCoverId, ISerializableObject aCoverVariable,
- ISerializableObject aNewCoverVariable, ICoverable aTileEntity) {
+ public final void preDataChanged(ForgeDirection side, int aCoverID, int aNewCoverId,
+ ISerializableObject aCoverVariable, ISerializableObject aNewCoverVariable, ICoverable aTileEntity) {
preDataChangedImpl(
- aSide,
+ side,
aCoverID,
aNewCoverId,
forceCast(aCoverVariable),
@@ -170,21 +171,22 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
/**
* Called upon cover being removed. Called on both server and client.
*/
- public final void onDropped(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) {
- onDroppedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ public final void onDropped(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
+ ICoverable aTileEntity) {
+ onDroppedImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
- public final boolean isRedstoneSensitive(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity, long aTimer) {
- return isRedstoneSensitiveImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer);
+ return isRedstoneSensitiveImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer);
}
/**
* Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time.
*/
- public final T doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject aCoverVariable,
- ICoverable aTileEntity, long aTimer) {
- return doCoverThingsImpl(aSide, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer);
+ public final T doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID,
+ ISerializableObject aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ return doCoverThingsImpl(side, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer);
}
/**
@@ -192,9 +194,9 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
* <p/>
* return true, if something actually happens.
*/
- public final boolean onCoverRightClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final boolean onCoverRightClick(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- return onCoverRightClickImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ);
+ return onCoverRightClickImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ);
}
/**
@@ -202,65 +204,57 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
* <p/>
* return the new Value of the Cover Variable
*/
- public final T onCoverScrewdriverClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable,
+ public final T onCoverScrewdriverClick(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- return onCoverScrewdriverClickImpl(