From 56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 22 Apr 2023 22:33:35 -0700 Subject: Forge direction (#1895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ForgeDirection Also refactor the clusterfuck that was `getCoordinateScan` Co-authored by: Jason Mitchell * 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 --- .../gregtech/api/util/GT_CircuitryBehavior.java | 14 +- .../java/gregtech/api/util/GT_CoverBehavior.java | 218 ++- .../gregtech/api/util/GT_CoverBehaviorBase.java | 299 ++-- .../gregtech/api/util/GT_HatchElementBuilder.java | 2 +- src/main/java/gregtech/api/util/GT_Utility.java | 1591 ++++++++++---------- .../java/gregtech/api/util/LightingHelper.java | 21 +- 6 files changed, 1081 insertions(+), 1064 deletions(-) (limited to 'src/main/java/gregtech/api/util') 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 * 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 * 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 * 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 - *

- * 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 * 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 { /** * 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 { * 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 { /** * 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 { *

* 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 { *

* 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( - aSide, - aCoverID, - forceCast(aCoverVariable), - aTileEntity, - aPlayer, - aX, - aY, - aZ); + return onCoverScrewdriverClickImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ); } /** * Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case. */ - public final boolean onCoverShiftRightClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean onCoverShiftRightClick(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { - return onCoverShiftRightClickImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer); + return onCoverShiftRightClickImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer); } @Deprecated - public final Object getClientGUI(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final Object getClientGUI(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { - return getClientGUIImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aWorld); + return getClientGUIImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aWorld); } /** * 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 final boolean onCoverRemoval(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean onCoverRemoval(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, boolean aForced) { - return onCoverRemovalImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aForced); + return onCoverRemovalImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity, aForced); } /** * Called upon Base TE being destroyed (once getDrops is called), thus getting called only when destroyed in * survival. */ - public final void onBaseTEDestroyed(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final void onBaseTEDestroyed(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - onBaseTEDestroyedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + onBaseTEDestroyedImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * Gives a small Text for the status of the Cover. */ - public final String getDescription(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final String getDescription(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getDescriptionImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return getDescriptionImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * How Blast Proof the Cover is. 30 is normal. */ - public final float getBlastProofLevel(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final float getBlastProofLevel(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getBlastProofLevelImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return getBlastProofLevelImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** @@ -268,67 +262,49 @@ public abstract class GT_CoverBehaviorBase { *

* This is just Informative so that Machines know if their Redstone Input is blocked or not */ - public final boolean letsRedstoneGoIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean letsRedstoneGoIn(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return letsRedstoneGoInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return letsRedstoneGoInImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets RS-Signals out of the Block */ - public final boolean letsRedstoneGoOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, - ICoverable aTileEntity) { - return letsRedstoneGoOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); - } - - /** - * If it lets Fibre-Signals into the Block - *

- * This is just Informative so that Machines know if their Redstone Input is blocked or not - */ - public final boolean letsFibreGoIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, - ICoverable aTileEntity) { - return letsFibreGoInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); - } - - /** - * If it lets Fibre-Signals out of the Block - */ - public final boolean letsFibreGoOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean letsRedstoneGoOut(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return letsFibreGoOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return letsRedstoneGoOutImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Energy into the Block */ - public final boolean letsEnergyIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean letsEnergyIn(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return letsEnergyInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return letsEnergyInImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Energy out of the Block */ - public final boolean letsEnergyOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean letsEnergyOut(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return letsEnergyOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return letsEnergyOutImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Liquids into the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - public final boolean letsFluidIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return letsFluidInImpl(aSide, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); + public final boolean letsFluidIn(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, + Fluid aFluid, ICoverable aTileEntity) { + return letsFluidInImpl(side, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); } /** * If it lets Liquids out of the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - public final boolean letsFluidOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, - ICoverable aTileEntity) { - return letsFluidOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); + public final boolean letsFluidOut(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, + Fluid aFluid, ICoverable aTileEntity) { + return letsFluidOutImpl(side, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); } /** @@ -336,9 +312,9 @@ public abstract class GT_CoverBehaviorBase { * reaction at all), aSlot = -2 means if it would accept for all Slots Impl(return true to skip the Checks for each * Slot). */ - public final boolean letsItemsIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, + public final boolean letsItemsIn(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { - return letsItemsInImpl(aSide, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); + return letsItemsInImpl(side, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); } /** @@ -346,42 +322,42 @@ public abstract class GT_CoverBehaviorBase { * reaction at all), aSlot = -2 means if it would accept for all Slots Impl(return true to skip the Checks for each * Slot). */ - public final boolean letsItemsOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, + public final boolean letsItemsOut(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { - return letsItemsOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); + return letsItemsOutImpl(side, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); } /** * If it lets you rightclick the Machine normally */ - public final boolean isGUIClickable(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean isGUIClickable(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return isGUIClickableImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return isGUIClickableImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * Needs to return true for Covers, which have a Redstone Output on their Facing. */ - public final boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, ISerializableObject aCoverVariable, - ICoverable aTileEntity) { - return manipulatesSidedRedstoneOutputImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + public final boolean manipulatesSidedRedstoneOutput(ForgeDirection side, int aCoverID, + ISerializableObject aCoverVariable, ICoverable aTileEntity) { + return manipulatesSidedRedstoneOutputImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * if this Cover should let Pipe Connections look connected even if it is not the case. */ - public final boolean alwaysLookConnected(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final boolean alwaysLookConnected(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return alwaysLookConnectedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return alwaysLookConnectedImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * 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 final byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, + public final byte getRedstoneInput(ForgeDirection side, byte aInputRedstone, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getRedstoneInputImpl(aSide, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity); + return getRedstoneInputImpl(side, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** @@ -389,24 +365,25 @@ public abstract class GT_CoverBehaviorBase { *

* 0 = No Ticks! Yes, 0 is Default, you have to override this */ - public final int getTickRate(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getTickRateImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + public final int getTickRate(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, + ICoverable aTileEntity) { + return getTickRateImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then). */ - public final byte getLensColor(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final byte getLensColor(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getLensColorImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return getLensColorImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * @return the ItemStack dropped by this Cover */ - public final ItemStack getDrop(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + public final ItemStack getDrop(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { - return getDropImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); + return getDropImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity); } // endregion @@ -540,11 +517,11 @@ public abstract class GT_CoverBehaviorBase { // region impl - protected Block getFacadeBlockImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected Block getFacadeBlockImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return null; } - protected int getFacadeMetaImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected int getFacadeMetaImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return 0; } @@ -552,37 +529,39 @@ public abstract class GT_CoverBehaviorBase { return GT_Utility.intToStack(aCoverID); } - protected ITexture getSpecialCoverFGTextureImpl(byte aSide, int aCoverID, T aCoverVariable, + protected ITexture getSpecialCoverFGTextureImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return coverFGTexture; } - protected ITexture getSpecialCoverTextureImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected ITexture getSpecialCoverTextureImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return null; } - protected boolean isDataNeededOnClientImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean isDataNeededOnClientImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return false; } - protected void onDataChangedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} + protected void onDataChangedImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - 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) {} - protected void onDroppedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} + protected void onDroppedImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - protected void onBaseTEDestroyedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} + protected void onBaseTEDestroyedImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, - long aTimer) { + protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity, long aTimer) { return false; } /** * Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time. */ - protected T doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, T aCoverVariable, + protected T doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable; } @@ -592,7 +571,7 @@ public abstract class GT_CoverBehaviorBase { *

* return true, if something actually happens. */ - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } @@ -602,7 +581,7 @@ public abstract class GT_CoverBehaviorBase { *

* return the new Value of the Cover Variable */ - 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) { return aCoverVariable; } @@ -610,16 +589,16 @@ public abstract class GT_CoverBehaviorBase { /** * Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case. */ - protected boolean onCoverShiftRightClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer) { + protected boolean onCoverShiftRightClickImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity, EntityPlayer aPlayer) { if (hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { lastPlayer = aPlayer; 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, @@ -632,7 +611,7 @@ public abstract class GT_CoverBehaviorBase { } @Deprecated - protected Object getClientGUIImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, + protected Object getClientGUIImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { return null; } @@ -641,7 +620,7 @@ public abstract class GT_CoverBehaviorBase { * 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. */ - protected boolean onCoverRemovalImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, + protected boolean onCoverRemovalImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity, boolean aForced) { return true; } @@ -649,14 +628,15 @@ public abstract class GT_CoverBehaviorBase { /** * Gives a small Text for the status of the Cover. */ - protected String getDescriptionImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected String getDescriptionImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return E; } /** * How Blast Proof the Cover is. 30 is normal. */ - protected float getBlastProofLevelImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected float getBlastProofLevelImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return 10.0F; } @@ -665,51 +645,37 @@ public abstract class GT_CoverBehaviorBase { *

* This is just Informative so that Machines know if their Redstone Input is blocked or not */ - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return false; } /** * If it lets RS-Signals out of the Block */ - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { - return false; - } - - /** - * If it lets Fibre-Signals into the Block - *

- * This is just Informative so that Machines know if their Redstone Input is blocked or not - */ - protected boolean letsFibreGoInImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { - return false; - } - - /** - * If it lets Fibre-Signals out of the Block - */ - protected boolean letsFibreGoOutImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return false; } /** * If it lets Energy into the Block */ - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return false; } /** * If it lets Energy out of the Block */ - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyOutImpl(ForgeDirection side, int aCoverID, T 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. */ - protected boolean letsFluidInImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, + protected boolean letsFluidInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } @@ -717,7 +683,7 @@ public abstract class GT_CoverBehaviorBase { /** * If it lets Liquids out of the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, + protected boolean letsFluidOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } @@ -727,7 +693,8 @@ public abstract class GT_CoverBehaviorBase { * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each * Slot). */ - protected boolean letsItemsInImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsInImpl(ForgeDirection side, int aCoverID, T aCoverVariable, int aSlot, + ICoverable aTileEntity) { return false; } @@ -736,21 +703,22 @@ public abstract class GT_CoverBehaviorBase { * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each * Slot). */ - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsOutImpl(ForgeDirection side, int aCoverID, T aCoverVariable, int aSlot, + ICoverable aTileEntity) { return false; } /** * If it lets you rightclick the Machine normally */ - protected boolean isGUIClickableImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean isGUIClickableImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return false; } /** * Needs to return true for Covers, which have a Redstone Output on their Facing. */ - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, T aCoverVariable, + protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity)