From 141051a88b1a0563e12e020f25d192068bde2cfd Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Thu, 20 Jun 2019 00:19:32 -0500 Subject: #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. --- .../api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech') 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); -- cgit