aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Hendricks <richardhendricks@pobox.com>2019-06-20 00:19:32 -0500
committerRichard Hendricks <richardhendricks@pobox.com>2019-06-20 00:19:32 -0500
commit141051a88b1a0563e12e020f25d192068bde2cfd (patch)
tree3297eca7bb7a818c0611545da5fd14f9582ace86 /src
parentd34bf4e364c5f31967bbf8b7e35a74463ef4112c (diff)
downloadGT5-Unofficial-141051a88b1a0563e12e020f25d192068bde2cfd.tar.gz
GT5-Unofficial-141051a88b1a0563e12e020f25d192068bde2cfd.tar.bz2
GT5-Unofficial-141051a88b1a0563e12e020f25d192068bde2cfd.zip
#4727 Modified code to skip to the next cardinal direction pair when doing power delivery instead of always doing a 0-5 search. This should help simple "straight cables with machines attached" prefer to power the closer machines first, especially for NS runs.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index 267287c430..5b75b89d23 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -205,9 +205,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
long rUsedAmperes = 0;
final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity();
-
+ byte i = (byte)((((aSide/2)*2)+2)%6); //this bit of trickery makes sure a direction goes to the next cardinal pair. IE, NS goes to E, EW goes to U, UD goes to N. It's a lame way to make sure locally connected machines on a wire get EU first.
aVoltage -= mCableLossPerMeter;
- if (aVoltage > 0) for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; i++)
+
+ if (aVoltage > 0) for (byte j = 0; j < 6 && aAmperage > rUsedAmperes; j++, i=(byte)((i+1)%6) )
if (i != aSide && isConnectedAtSide(i) && baseMetaTile.getCoverBehaviorAtSide(i).letsEnergyOut(i, baseMetaTile.getCoverIDAtSide(i), baseMetaTile.getCoverDataAtSide(i), baseMetaTile)) {
final TileEntity tTileEntity = baseMetaTile.getTileEntityAtSide(i);