aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-05-01 02:45:56 -0700
committerGitHub <noreply@github.com>2023-05-01 11:45:56 +0200
commitb2c8cfb4ec8b82337a95f51364277964ec968b52 (patch)
treed4cf94acc93249cd649b33ec13c5b0d75f1f75db /src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone
parentd2eda84e457d549ad9a51f40e9dd159147a141f8 (diff)
downloadGT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.tar.gz
GT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.tar.bz2
GT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.zip
ForgeDirection (#608)
* ForgeDirection WIP * Fix GTPP_Render_MachineBlock Fix handling of getTexture with facing mask for pipes Kill a bunch of magic numbers * spotlessApply (#612) Co-authored-by: GitHub GTNH Actions <> * Bump bw/tt deps --------- Co-authored-by: Léa Gris <lea.gris@noiraude.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java17
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java78
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java99
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java30
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java20
6 files changed, 127 insertions, 122 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
index ddf35d1f0d..3a070ec781 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
@@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
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.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -40,8 +41,8 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T
}
@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
@@ -50,7 +51,7 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T
}
@Override
- public final boolean isFacingValid(byte aFacing) {
+ public final boolean isFacingValid(ForgeDirection facing) {
return true;
}
@@ -86,8 +87,8 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T
if (getBaseMetaTileEntity().getStrongestRedstone() > 0) {
return true;
}
- for (byte i = 0; i < 6; i++) {
- if (getBaseMetaTileEntity().getOutputRedstoneSignal(i) > 0) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ if (getBaseMetaTileEntity().getOutputRedstoneSignal(side) > 0) {
return true;
}
}
@@ -95,12 +96,14 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T
}
@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/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java
index 187fafb4b7..f76154b1c6 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java
@@ -2,13 +2,13 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
@@ -68,74 +68,74 @@ public class GT_MetaTileEntity_RedstoneButtonPanel extends GT_MetaTileEntity_Red
}
@Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
- float aY, float aZ) {
- if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side,
+ float aX, float aY, float aZ) {
+ if (side == getBaseMetaTileEntity().getFrontFacing()) {
if (getBaseMetaTileEntity().isServerSide()) {
mUpdate = 2;
switch (mType) {
case 0:
default:
- switch (aSide) {
- case 0:
- case 1:
+ switch (side) {
+ case DOWN:
+ case UP:
mRedstoneStrength = (byte) ((byte) (aX * 4) + 4 * (byte) (aZ * 4));
break;
- case 2:
+ case NORTH:
mRedstoneStrength = (byte) ((byte) (4 - aX * 4) + 4 * (byte) (4 - aY * 4));
break;
- case 3:
+ case SOUTH:
mRedstoneStrength = (byte) ((byte) (aX * 4) + 4 * (byte) (4 - aY * 4));
break;
- case 4:
+ case WEST:
mRedstoneStrength = (byte) ((byte) (aZ * 4) + 4 * (byte) (4 - aY * 4));
break;
- case 5:
+ case EAST:
mRedstoneStrength = (byte) ((byte) (4 - aZ * 4) + 4 * (byte) (4 - aY * 4));
break;
}
break;
case 1:
- switch (aSide) {
- case 0:
- case 1:
+ switch (side) {
+ case DOWN:
+ case UP:
mRedstoneStrength = (byte) (mRedstoneStrength
^ (1 << (((byte) (aX * 2) + 2 * (byte) (aZ * 2)))));
break;
- case 2:
+ case NORTH:
mRedstoneStrength = (byte) (mRedstoneStrength
^ (1 << (((byte) (2 - aX * 2) + 2 * (byte) (2 - aY * 2)))));
break;
- case 3:
+ case SOUTH:
mRedstoneStrength = (byte) (mRedstoneStrength
^ (1 << (((byte) (aX * 2) + 2 * (byte) (2 - aY * 2)))));
break;
- case 4:
+ case WEST:
mRedstoneStrength = (byte) (mRedstoneStrength
^ (1 << (((byte) (aZ * 2) + 2 * (byte) (2 - aY * 2)))));
break;
- case 5:
+ case EAST:
mRedstoneStrength = (byte) (mRedstoneStrength
^ (1 << (((byte) (2 - aZ * 2) + 2 * (byte) (2 - aY * 2)))));
break;
}
break;
case 2:
- switch (aSide) {
- case 0:
- case 1:
+ switch (side) {
+ case DOWN:
+ case UP:
mRedstoneStrength = (byte) (mRedstoneStrength ^ (1 << ((byte) (aZ * 4))));
break;
- case 2:
+ case NORTH:
mRedstoneStrength = (byte) (mRedstoneStrength ^ (1 << ((byte) (4 - aY * 4))));
break;
- case 3:
+ case SOUTH:
mRedstoneStrength = (byte) (mRedstoneStrength ^ (1 << ((byte) (4 - aY * 4))));
break;
- case 4:
+ case WEST:
mRedstoneStrength = (byte) (mRedstoneStrength ^ (1 << ((byte) (4 - aY * 4))));
break;
- case 5:
+ case EAST:
mRedstoneStrength = (byte) (mRedstoneStrength ^ (1 << ((byte) (4 - aY * 4))));
break;
}
@@ -156,20 +156,20 @@ public class GT_MetaTileEntity_RedstoneButtonPanel extends GT_MetaTileEntity_Red
} else if (getBaseMetaTileEntity().isAllowedToWork()) {
mRedstoneStrength = 0;
}
- for (byte i = 0; i < 6; i++) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
getBaseMetaTileEntity().setStrongOutputRedstoneSignal(
- i,
- i == getBaseMetaTileEntity().getFrontFacing() ? (byte) 0 : mRedstoneStrength);
+ side,
+ side == getBaseMetaTileEntity().getFrontFacing() ? (byte) 0 : mRedstoneStrength);
getBaseMetaTileEntity().setInternalOutputRedstoneSignal(
- i,
- i == getBaseMetaTileEntity().getFrontFacing() ? (byte) 0 : mRedstoneStrength);
+ side,
+ side == getBaseMetaTileEntity().getFrontFacing() ? (byte) 0 : mRedstoneStrength);
}
}
}
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (aSide == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 3);
+ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (side == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 3);
}
@Override
@@ -191,15 +191,17 @@ public class GT_MetaTileEntity_RedstoneButtonPanel extends GT_MetaTileEntity_Red
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- if (aSide == aFacing) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
+ final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (side == facing) {
return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1],
new GT_RenderedTexture(sIconList[mType * 16 + mRedstoneStrength]) };
}
- return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0
- : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
- + 1];
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0)
+ + (side == facing ? 0
+ : side == facing.getOpposite() ? 1
+ : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
+ + 1];
}
public ITexture[] getFront(final byte aColor) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
index 2c320f843a..933e7f1b75 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
@@ -1,6 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -11,6 +12,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 net.minecraftforge.oredict.OreDictionary;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -77,8 +79,8 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
@Override
- public boolean isInputFacing(byte aSide) {
- return !this.isOutputFacing(aSide);
+ public boolean isInputFacing(ForgeDirection side) {
+ return !this.isOutputFacing(side);
}
@Override
@@ -97,8 +99,8 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
@Override
- public boolean isOutputFacing(byte aSide) {
- return aSide == this.getOutputFacing();
+ public boolean isOutputFacing(ForgeDirection side) {
+ return side == this.getOutputFacing();
}
@Override
@@ -197,12 +199,12 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
private void resetRedstone() {
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 0, (byte) 0);
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 1, (byte) 0);
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 2, (byte) 0);
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 3, (byte) 0);
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 4, (byte) 0);
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 5, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.DOWN, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.UP, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.NORTH, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.SOUTH, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.WEST, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(ForgeDirection.EAST, (byte) 0);
}
public void changeGateData(int aIndex, int aValue) {
@@ -217,7 +219,7 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
private void switchGate() {
resetRedstone();
- for (int i = 0; i < mGateData.length; i++) mGateData[i] = 0;
+ Arrays.fill(mGateData, 0);
GT_CircuitryBehavior tBehaviour = GregTech_API.sCircuitryBehaviors.get(mGate);
if (tBehaviour != null) try {
tBehaviour.initParameters(mGateData, this);
@@ -283,16 +285,16 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
return;
}
// Emit Redstone
- for (byte i = 0; i < 6; i++) {
- byte aRedstone = getBaseMetaTileEntity().getOutputRedstoneSignal(i);
- this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(i, aRedstone);
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ byte aRedstone = getBaseMetaTileEntity().getOutputRedstoneSignal(side);
+ this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(side, aRedstone);
}
}
@Override
public final boolean hasRedstoneSignal() {
- for (byte i = 0; i < 6; i++) {
- if (getBaseMetaTileEntity().getOutputRedstoneSignal(i) > 0) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ if (getBaseMetaTileEntity().getOutputRedstoneSignal(side) > 0) {
return true;
}
}
@@ -324,15 +326,15 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
@Override
- public byte getOutputFacing() {
+ public ForgeDirection getOutputFacing() {
return getBaseMetaTileEntity().getBackFacing();
}
@Override
- public boolean setRedstone(byte aStrength, byte aSide) {
- if (getOutputRedstone(aSide) != aStrength) {
+ public boolean setRedstone(byte aStrength, ForgeDirection side) {
+ if (getOutputRedstone(side) != aStrength) {
if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(1, false)) {
- getBaseMetaTileEntity().setInternalOutputRedstoneSignal(aSide, aStrength);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(side, aStrength);
getBaseMetaTileEntity().setErrorDisplayID(0);
return true;
} else {
@@ -345,44 +347,45 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
/*
* @Override public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide ==
- * getOutputFacing()) { if (aSide == 0) return aRedstone ? 56 : 54; if (aSide == 1) return aRedstone ? 53 : 52;
- * return aRedstone ? 94 : 93; } if (aSide == 0) return aRedstone ? 60 : 59; if (aSide == 1) return aRedstone ? 58 :
- * 57; return aRedstone ? 62 : 61; }
+ * getOutputFacing()) { if (side == ForgeDirection.DOWN) return aRedstone ? 56 : 54; if (side == ForgeDirection.UP)
+ * return aRedstone ? 53 : 52; return aRedstone ? 94 : 93; } if (side == ForgeDirection.DOWN) return aRedstone ? 60
+ * : 59; if (side == ForgeDirection.UP) return aRedstone ? 58 : 57; return aRedstone ? 62 : 61; }
*/
@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 byte getOutputRedstone(byte aSide) {
- return getBaseMetaTileEntity().getOutputRedstoneSignal(aSide);
+ public byte getOutputRedstone(ForgeDirection side) {
+ return getBaseMetaTileEntity().getOutputRedstoneSignal(side);
}
@Override
- public byte getInputRedstone(byte aSide) {
- return getBaseMetaTileEntity().getInternalInputRedstoneSignal(aSide);
+ public byte getInputRedstone(ForgeDirection side) {
+ return getBaseMetaTileEntity().getInternalInputRedstoneSignal(side);
}
@Override
- public Block getBlockAtSide(byte aSide) {
- return getBaseMetaTileEntity().getBlockAtSide(aSide);
+ public Block getBlockAtSide(ForgeDirection side) {
+ return getBaseMetaTileEntity().getBlockAtSide(side);
}
@Override
- public byte getMetaIDAtSide(byte aSide) {
- return getBaseMetaTileEntity().getMetaIDAtSide(aSide);
+ public byte getMetaIDAtSide(ForgeDirection side) {
+ return getBaseMetaTileEntity().getMetaIDAtSide(side);
}
@Override
- public TileEntity getTileEntityAtSide(byte aSide) {
- return getBaseMetaTileEntity().getTileEntityAtSide(aSide);
+ public TileEntity getTileEntityAtSide(ForgeDirection side) {
+ return getBaseMetaTileEntity().getTileEntityAtSide(side);
}
@Override
@@ -391,18 +394,18 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
@Override
- public GT_CoverBehavior getCover(byte aSide) {
- return getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide);
+ public GT_CoverBehavior getCover(ForgeDirection side) {
+ return getBaseMetaTileEntity().getCoverBehaviorAtSide(side);
}
@Override
- public int getCoverID(byte aSide) {
- return getBaseMetaTileEntity().getCoverIDAtSide(aSide);
+ public int getCoverID(ForgeDirection side) {
+ return getBaseMetaTileEntity().getCoverIDAtSide(side);
}
@Override
- public int getCoverVariable(byte aSide) {
- return getBaseMetaTileEntity().getCoverDataAtSide(aSide);
+ public int getCoverVariable(ForgeDirection side) {
+ return getBaseMetaTileEntity().getCoverDataAtSide(side);
}
@Override
@@ -429,11 +432,13 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0
- : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
- + 1];
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
+ final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0)
+ + (side == facing ? 0
+ : side == facing.getOpposite() ? 1
+ : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
+ + 1];
}
private GT_RenderedTexture getBase() {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java
index 6413f59508..1180ffe6b9 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java
@@ -1,6 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -57,8 +58,8 @@ public class GT_MetaTileEntity_RedstoneLamp extends GT_MetaTileEntity_RedstoneBa
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
+ final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
return this.mTextures[(aActive ? 1 : 0)][aColorIndex + 1];
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java
index 286b79ca3b..681cc9278f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java
@@ -2,13 +2,13 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
@@ -68,21 +68,11 @@ public class GT_MetaTileEntity_RedstoneStrengthDisplay extends GT_MetaTileEntity
}
}
- /*
- * @Override public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide ==
- * 0) return aRedstone ? 60 : 59; if (aSide == 1) return aRedstone ? 58 : 57; return aRedstone ? 62 : 61; }
- */
-
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (aSide == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 6);
+ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (side == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 6);
}
- /*
- * @Override public IIcon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { return
- * aSide == aFacing ? sIconList[mType * 16 + mRedstoneStrength] : null; }
- */
-
@Override
public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
final ITexture[][][] rTextures = new ITexture[10][17][];
@@ -102,15 +92,17 @@ public class GT_MetaTileEntity_RedstoneStrengthDisplay extends GT_MetaTileEntity
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- if (aSide == aFacing) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
+ final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (side == facing) {
return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1],
new GT_RenderedTexture(sIconList[mType * 16 + mRedstoneStrength]) };
}
- return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0
- : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
- + 1];
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0)
+ + (side == facing ? 0
+ : side == facing.getOpposite() ? 1
+ : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
+ + 1];
}
public ITexture[] getFront(final byte aColor) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java
index ff65ebfe91..00c2d9cc9a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java
@@ -1,13 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
@@ -36,19 +36,21 @@ public class GT_MetaTileEntity_RedstoneStrengthScale extends GT_MetaTileEntity_R
}
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (aSide == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 2);
+ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (side == getBaseMetaTileEntity().getFrontFacing()) mType = (byte) ((mType + 1) % 2);
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- if (aSide == aFacing) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side,
+ final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (side == facing) {
return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1],
new GT_RenderedTexture(sIconList[mType * 16 + mRedstoneStrength]) };
}
- return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0
- : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
- + 1];
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0)
+ + (side == facing ? 0
+ : side == facing.getOpposite() ? 1
+ : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex
+ + 1];
}
}