diff options
Diffstat (limited to 'src/main/java/gregtech/api/graphs')
9 files changed, 94 insertions, 86 deletions
diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java index bbdfa40a10..7289f0faad 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java @@ -1,12 +1,12 @@ package gregtech.api.graphs; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; -import static gregtech.api.util.GT_Utility.getOppositeSide; import java.util.ArrayList; import java.util.HashSet; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.graphs.consumers.ConsumerNode; import gregtech.api.graphs.paths.NodePath; @@ -42,17 +42,17 @@ public abstract class GenerateNodeMap { // get how many connections the pipe have private static int getNumberOfConnections(MetaPipeEntity aPipe) { int tCons = 0; - for (byte side : ALL_VALID_SIDES) { + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { if (aPipe.isConnectedAtSide(side)) tCons++; } return tCons; } // gets the next node - protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, byte aInvalidSide, int aNextNodeValue, - ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { + protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, ForgeDirection aInvalidSide, + int aNextNodeValue, ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { final MetaPipeEntity tMetaPipe = (MetaPipeEntity) aPipe.getMetaTileEntity(); - for (byte side : ALL_VALID_SIDES) { + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { if (side == aInvalidSide) { continue; } @@ -70,12 +70,13 @@ public abstract class GenerateNodeMap { tConsumers, tNodeMap); if (tNextNode != null) { + final int i = side.ordinal(); aNextNodeValue = tNextNode.mHighestNodeValue; aPipeNode.mHighestNodeValue = tNextNode.mHighestNodeValue; - aPipeNode.mNeighbourNodes[side] = tNextNode; - aPipeNode.mNodePaths[side] = aPipeNode.returnValues.mReturnPath; - aPipeNode.locks[side] = aPipeNode.returnValues.returnLock; - aPipeNode.mNodePaths[side].reloadLocks(); + aPipeNode.mNeighbourNodes[i] = tNextNode; + aPipeNode.mNodePaths[i] = aPipeNode.returnValues.mReturnPath; + aPipeNode.locks[i] = aPipeNode.returnValues.returnLock; + aPipeNode.mNodePaths[i].reloadLocks(); } } } @@ -84,10 +85,11 @@ public abstract class GenerateNodeMap { // on a valid tile entity create a new node protected Node generateNode(TileEntity aTileEntity, Node aPreviousNode, int aNextNodeValue, - ArrayList<MetaPipeEntity> aPipes, int aSide, ArrayList<ConsumerNode> aConsumers, HashSet<Node> aNodeMap) { + ArrayList<MetaPipeEntity> aPipes, ForgeDirection side, ArrayList<ConsumerNode> aConsumers, + HashSet<Node> aNodeMap) { if (aTileEntity.isInvalid()) return null; - final byte tSideOp = getOppositeSide(aSide); - final byte tInvalidSide = aPreviousNode == null ? -1 : tSideOp; + final ForgeDirection oppositeSide = side.getOpposite(); + final ForgeDirection tInvalidSide = aPreviousNode == null ? ForgeDirection.UNKNOWN : oppositeSide; Node tThisNode = null; if (isPipe(aTileEntity)) { final BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; @@ -95,33 +97,35 @@ public abstract class GenerateNodeMap { final int tConnections = getNumberOfConnections(tMetaPipe); final Node tPipeNode; if (tConnections == 1) { - tPipeNode = getEmptyNode(aNextNodeValue, tSideOp, aTileEntity, aConsumers); + tPipeNode = getEmptyNode(aNextNodeValue, oppositeSide, aTileEntity, aConsumers); if (tPipeNode == null) return null; } else { - tPipeNode = getPipeNode(aNextNodeValue, tSideOp, aTileEntity, aConsumers); + tPipeNode = getPipeNode(aNextNodeValue, oppositeSide, aTileEntity, aConsumers); } tPipe.setNode(tPipeNode); aNodeMap.add(tPipeNode); tPipeNode.mSelfPath = getNewPath(new MetaPipeEntity[] { tMetaPipe }); tThisNode = tPipeNode; - if (tInvalidSide > -1) { - tPipeNode.mNeighbourNodes[tInvalidSide] = aPreviousNode; - tPipeNode.mNodePaths[tInvalidSide] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); + if (tInvalidSide != ForgeDirection.UNKNOWN) { + final int iInvalid = tInvalidSide.ordinal(); + tPipeNode.mNeighbourNodes[iInvalid] = aPreviousNode; + tPipeNode.mNodePaths[iInvalid] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); final Lock lock = new Lock(); - tPipeNode.mNodePaths[tSideOp].lock = lock; - tPipeNode.locks[tInvalidSide] = lock; - aPreviousNode.returnValues.mReturnPath = tPipeNode.mNodePaths[tInvalidSide]; + tPipeNode.mNodePaths[oppositeSide.ordinal()].lock = lock; + tPipeNode.locks[iInvalid] = lock; + aPreviousNode.returnValues.mReturnPath = tPipeNode.mNodePaths[iInvalid]; aPreviousNode.returnValues.returnLock = lock; } if (tConnections > 1) generateNextNode(tPipe, tPipeNode, tInvalidSide, aNextNodeValue, aConsumers, aNodeMap); - } else if (addConsumer(aTileEntity, tSideOp, aNextNodeValue, aConsumers)) { + } else if (addConsumer(aTileEntity, oppositeSide, aNextNodeValue, aConsumers)) { + final int oppositeSideOrdinal = oppositeSide.ordinal(); final ConsumerNode tConsumeNode = aConsumers.get(aConsumers.size() - 1); - tConsumeNode.mNeighbourNodes[tSideOp] = aPreviousNode; - tConsumeNode.mNodePaths[tSideOp] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); + tConsumeNode.mNeighbourNodes[oppositeSideOrdinal] = aPreviousNode; + tConsumeNode.mNodePaths[oppositeSideOrdinal] = getNewPath(aPipes.toArray(new MetaPipeEntity[0])); final Lock lock = new Lock(); - tConsumeNode.mNodePaths[tSideOp].lock = lock; - aPreviousNode.returnValues.mReturnPath = tConsumeNode.mNodePaths[tSideOp]; + tConsumeNode.mNodePaths[oppositeSideOrdinal].lock = lock; + aPreviousNode.returnValues.mReturnPath = tConsumeNode.mNodePaths[oppositeSideOrdinal]; aPreviousNode.returnValues.returnLock = lock; tThisNode = tConsumeNode; } @@ -129,7 +133,7 @@ public abstract class GenerateNodeMap { } // go over the pipes until we see a valid tile entity that needs a node - protected Pair getNextValidTileEntity(TileEntity aTileEntity, ArrayList<MetaPipeEntity> aPipes, byte aSide, + protected Pair getNextValidTileEntity(TileEntity aTileEntity, ArrayList<MetaPipeEntity> aPipes, ForgeDirection side, HashSet<Node> aNodeMap) { if (isPipe(aTileEntity)) { final BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; @@ -140,23 +144,23 @@ public abstract class GenerateNodeMap { } final int tConnections = getNumberOfConnections(tMetaPipe); if (tConnections == 2) { - final byte tSideOp = getOppositeSide(aSide); - for (byte i : ALL_VALID_SIDES) { - if (i == tSideOp || !(tMetaPipe.isConnectedAtSide(i))) continue; - final TileEntity tNewTileEntity = tPipe.getTileEntityAtSide(i); + final ForgeDirection tSideOp = side.getOpposite(); + for (final ForgeDirection s : ForgeDirection.VALID_DIRECTIONS) { + if (s == tSideOp || !(tMetaPipe.isConnectedAtSide(s))) continue; + final TileEntity tNewTileEntity = tPipe.getTileEntityAtSide(s); if (tNewTileEntity == null) continue; if (isPipe(tNewTileEntity)) { aPipes.add(tMetaPipe); - return getNextValidTileEntity(tNewTileEntity, aPipes, i, aNodeMap); + return getNextValidTileEntity(tNewTileEntity, aPipes, s, aNodeMap); } else { - return new Pair(aTileEntity, i); + return new Pair(aTileEntity, s); } } } else { - return new Pair(aTileEntity, aSide); + return new Pair(aTileEntity, side); } } else { - return new Pair(aTileEntity, aSide); + return new Pair(aTileEntity, side); } return null; } @@ -167,31 +171,32 @@ public abstract class GenerateNodeMap { } // checks if the tile entity is a consumer and add to the list - protected abstract boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, + protected abstract boolean addConsumer(TileEntity aTileEntity, ForgeDirection side, int aNodeValue, ArrayList<ConsumerNode> aConsumers); // get correct pathClass that you need for your node network protected abstract NodePath getNewPath(MetaPipeEntity[] aPipes); // used for if you need to use dead ends for something can be null - protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, + protected Node getEmptyNode(int aNodeValue, ForgeDirection side, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { return null; } // get correct node type you need for your network - protected Node getPipeNode(int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { + protected Node getPipeNode(int aNodeValue, ForgeDirection side, TileEntity aTileEntity, + ArrayList<ConsumerNode> aConsumers) { return new Node(aNodeValue, aTileEntity, aConsumers); } private static class Pair { - public byte mSide; + public ForgeDirection mSide; public TileEntity mTileEntity; - public Pair(TileEntity aTileEntity, byte aSide) { + public Pair(TileEntity aTileEntity, ForgeDirection side) { this.mTileEntity = aTileEntity; - this.mSide = aSide; + this.mSide = side; } } } diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index f2a2e95df8..95f9aee32d 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -27,7 +27,7 @@ import ic2.api.energy.tile.IEnergySink; public class GenerateNodeMapPower extends GenerateNodeMap { public GenerateNodeMapPower(BaseMetaPipeEntity aTileEntity) { - generateNode(aTileEntity, null, 1, null, -1, new ArrayList<>(), new HashSet<>()); + generateNode(aTileEntity, null, 1, null, ForgeDirection.UNKNOWN, new ArrayList<>(), new HashSet<>()); } @Override @@ -37,27 +37,27 @@ public class GenerateNodeMapPower extends GenerateNodeMap { } @Override - protected boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, + protected boolean addConsumer(TileEntity aTileEntity, ForgeDirection side, int aNodeValue, ArrayList<ConsumerNode> aConsumers) { if (aTileEntity instanceof BaseMetaTileEntity tBaseTileEntity) { - if (tBaseTileEntity.inputEnergyFrom(aSide, false)) { - ConsumerNode tConsumerNode = new NodeGTBaseMetaTile(aNodeValue, tBaseTileEntity, aSide, aConsumers); + if (tBaseTileEntity.inputEnergyFrom(side, false)) { + ConsumerNode tConsumerNode = new NodeGTBaseMetaTile(aNodeValue, tBaseTileEntity, side, aConsumers); aConsumers.add(tConsumerNode); return true; } } else if (aTileEntity instanceof IEnergyConnected tTileEntity) { - if (tTileEntity.inputEnergyFrom(aSide, false)) { - ConsumerNode tConsumerNode = new NodeEnergyConnected(aNodeValue, tTileEntity, aSide, aConsumers); + if (tTileEntity.inputEnergyFrom(side, false)) { + ConsumerNode tConsumerNode = new NodeEnergyConnected(aNodeValue, tTileEntity, side, aConsumers); aConsumers.add(tConsumerNode); return true; } - } else if (aTileEntity instanceof IEnergySink) { + } else if (aTileEntity instanceof IEnergySink sink) { // ic2 wants the tilentity next to it of that side not going to add a bunch of arguments just for ic2 // crossborder checks to not load chuncks just to make sure - int dX = aTileEntity.xCoord + ForgeDirection.getOrientation(aSide).offsetX; - int dY = aTileEntity.yCoord + ForgeDirection.getOrientation(aSide).offsetY; - int dZ = aTileEntity.zCoord + ForgeDirection.getOrientation(aSide).offsetZ; + int dX = aTileEntity.xCoord + side.offsetX; + int dY = aTileEntity.yCoord + side.offsetY; + int dZ = aTileEntity.zCoord + side.offsetZ; boolean crossesChuncks = dX >> 4 != aTileEntity.xCoord >> 4 || dZ >> 4 != aTileEntity.zCoord >> 4; TileEntity tNextTo = null; if (!crossesChuncks || !aTileEntity.getWorldObj() @@ -65,21 +65,17 @@ public class GenerateNodeMapPower extends GenerateNodeMap { tNextTo = aTileEntity.getWorldObj() .getTileEntity(dX, dY, dZ); - if (((IEnergySink) aTileEntity).acceptsEnergyFrom(tNextTo, ForgeDirection.getOrientation(aSide))) { + if (sink.acceptsEnergyFrom(tNextTo, side)) { ConsumerNode tConsumerNode = new NodeEnergySink( aNodeValue, (IEnergySink) aTileEntity, - aSide, + side, aConsumers); aConsumers.add(tConsumerNode); return true; } - } else if (GregTech_API.mOutputRF && aTileEntity instanceof IEnergyReceiver) { - ConsumerNode tConsumerNode = new NodeEnergyReceiver( - aNodeValue, - (IEnergyReceiver) aTileEntity, - aSide, - aConsumers); + } else if (GregTech_API.mOutputRF && aTileEntity instanceof IEnergyReceiver receiver) { + ConsumerNode tConsumerNode = new NodeEnergyReceiver(aNodeValue, receiver, side, aConsumers); aConsumers.add(tConsumerNode); return true; } @@ -93,15 +89,16 @@ public class GenerateNodeMapPower extends GenerateNodeMap { // used to apply voltage on dead ends @Override - protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, + protected Node getEmptyNode(int aNodeValue, ForgeDirection side, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { - ConsumerNode tNode = new EmptyPowerConsumer(aNodeValue, aTileEntity, aSide, aConsumers); + ConsumerNode tNode = new EmptyPowerConsumer(aNodeValue, aTileEntity, side, aConsumers); aConsumers.add(tNode); return tNode; } @Override - protected Node getPipeNode(int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { + protected Node getPipeNode(int aNodeValue, ForgeDirection side, TileEntity aTileEntity, + ArrayList<ConsumerNode> aConsumers) { return new PowerNode(aNodeValue, aTileEntity, aConsumers); } } diff --git a/src/main/java/gregtech/api/graphs/PowerNodes.java b/src/main/java/gregtech/api/graphs/PowerNodes.java index be94d2312a..98d35e2971 100644 --- a/src/main/java/gregtech/api/graphs/PowerNodes.java +++ b/src/main/java/gregtech/api/graphs/PowerNodes.java @@ -120,13 +120,13 @@ public class PowerNodes { return tAmpsUsed; } - protected static long processNextNode(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, + protected static long processNextNode(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int ordinalSide, long aMaxAmps, long aVoltage) { - if (aCurrentNode.locks[aSide].isLocked()) { + if (aCurrentNode.locks[ordinalSide].isLocked()) { aConsumers.getNextNode(); return 0; } - final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[aSide]; + final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[ordinalSide]; final PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; long tVoltLoss = 0; if (tSelfPath != null) { @@ -141,13 +141,13 @@ public class PowerNodes { return tAmps; } - protected static long processNextNodeAbove(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, + protected static long processNextNodeAbove(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int ordinalSide, long aMaxAmps, long aVoltage) { - if (aCurrentNode.locks[aSide].isLocked()) { + if (aCurrentNode.locks[ordinalSide].isLocked()) { aConsumers.getNextNode(); return 0; } - final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[aSide]; + final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[ordinalSide]; final PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; long tVoltLoss = 0; if (tSelfPath != null) { @@ -162,10 +162,10 @@ public class PowerNodes { return tAmps; } - protected static long processNodeInject(Node aCurrentNode, ConsumerNode aConsumer, int aSide, long aMaxAmps, + protected static long processNodeInject(Node aCurrentNode, ConsumerNode aConsumer, int ordinalSide, long aMaxAmps, long aVoltage) { - if (aCurrentNode.locks[aSide].isLocked()) return 0; - final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[aSide]; + if (aCurrentNode.locks[ordinalSide].isLocked()) return 0; + final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[ordinalSide]; final PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; long tVoltLoss = 0; if (tSelfPath != null) { diff --git a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java index f82798f09b..04d7ebbe5a 100644 --- a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java +++ b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java @@ -3,17 +3,19 @@ package gregtech.api.graphs.consumers; import java.util.ArrayList; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.graphs.Node; // node attached to a tile entity that can consume stuff from the network public class ConsumerNode extends Node { - public byte mSide; + public ForgeDirection mSide; - public ConsumerNode(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { + public ConsumerNode(int aNodeValue, TileEntity aTileEntity, ForgeDirection side, + ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aConsumers); - this.mSide = aSide; + this.mSide = side; } public boolean needsEnergy() { diff --git a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java index 6507d0f8e4..48cf330bdb 100644 --- a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java +++ b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java @@ -3,6 +3,7 @@ package gregtech.api.graphs.consumers; import java.util.ArrayList; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.graphs.paths.PowerNodePath; import gregtech.api.metatileentity.BaseMetaPipeEntity; @@ -10,8 +11,9 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; // this is here to apply voltage to dead ends public class EmptyPowerConsumer extends ConsumerNode { - public EmptyPowerConsumer(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue, aTileEntity, aSide, aConsumers); + public EmptyPowerConsumer(int aNodeValue, TileEntity aTileEntity, ForgeDirection side, + ArrayList<ConsumerNode> aConsumers) { + super(aNodeValue, aTileEntity, side, aConsumers); } @Override diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java index 65dd50f9df..6daeae8c9c 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java @@ -3,14 +3,15 @@ package gregtech.api.graphs.consumers; import java.util.ArrayList; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import gregtech.api.interfaces.tileentity.IEnergyConnected; public class NodeEnergyConnected extends ConsumerNode { - public NodeEnergyConnected(int aNodeValue, IEnergyConnected aTileEntity, byte aSide, + public NodeEnergyConnected(int aNodeValue, IEnergyConnected aTileEntity, ForgeDirection side, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); + super(aNodeValue, (TileEntity) aTileEntity, side, aConsumers); } @Override diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index 4e84b04e2a..4f35922029 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -21,14 +21,14 @@ public class NodeEnergyReceiver extends ConsumerNode { int mRestRF = 0; - public NodeEnergyReceiver(int aNodeValue, IEnergyReceiver aTileEntity, byte aSide, + public NodeEnergyReceiver(int aNodeValue, IEnergyReceiver aTileEntity, ForgeDirection side, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); + super(aNodeValue, (TileEntity) aTileEntity, side, aConsumers); } @Override public int injectEnergy(long aVoltage, long aMaxAmps) { - ForgeDirection tDirection = ForgeDirection.getOrientation(mSide); + ForgeDirection tDirection = mSide; int rfOut = GT_Utility.safeInt(aVoltage * GregTech_API.mEUtoRF / 100); int ampsUsed = 0; if (mRestRF < rfOut) { diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java index d978a99d0b..44fb88e5e8 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java @@ -10,7 +10,8 @@ import ic2.api.energy.tile.IEnergySink; // consumer for IC2 machines public class NodeEnergySink extends ConsumerNode { - public NodeEnergySink(int nodeValue, IEnergySink tileEntity, byte side, ArrayList<ConsumerNode> consumers) { + public NodeEnergySink(int nodeValue, IEnergySink tileEntity, ForgeDirection side, + ArrayList<ConsumerNode> consumers) { super(nodeValue, (TileEntity) tileEntity, side, consumers); } @@ -23,9 +24,7 @@ public class NodeEnergySink extends ConsumerNode { public int injectEnergy(long aVoltage, long aMaxAmps) { int tUsedAmps = 0; while (aMaxAmps > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 - && ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) - < aVoltage) - tUsedAmps++; + && ((IEnergySink) mTileEntity).injectEnergy(mSide, aVoltage, aVoltage) < aVoltage) tUsedAmps++; return tUsedAmps; } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java index ec75468db5..e8d8304eb3 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java @@ -2,15 +2,17 @@ package gregtech.api.graphs.consumers; import java.util.ArrayList; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.metatileentity.BaseMetaTileEntity; // consumer for gt machines public class NodeGTBaseMetaTile extends ConsumerNode { - public NodeGTBaseMetaTile(int aNodeValue, BaseMetaTileEntity aTileEntity, byte aSide, + public NodeGTBaseMetaTile(int aNodeValue, BaseMetaTileEntity aTileEntity, ForgeDirection side, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue, aTileEntity, aSide, aConsumers); + super(aNodeValue, aTileEntity, side, aConsumers); } @Override |