Minor adjustment to make certain routes preferred over others.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package appeng.me;
|
package appeng.me;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -354,6 +356,21 @@ public class GridNode implements IGridNode, IPathItem
|
|||||||
Connections.add( gridConnection );
|
Connections.add( gridConnection );
|
||||||
if ( gridConnection.hasDirection() )
|
if ( gridConnection.hasDirection() )
|
||||||
gridProxy.onGridNotification( GridNotification.ConnectionsChanged );
|
gridProxy.onGridNotification( GridNotification.ConnectionsChanged );
|
||||||
|
|
||||||
|
final IGridNode gn = this;
|
||||||
|
|
||||||
|
Collections.sort( Connections, new Comparator<IGridConnection>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(IGridConnection o1, IGridConnection o2)
|
||||||
|
{
|
||||||
|
boolean preferedA = o1.getOtherSide( gn ).hasFlag( GridFlags.PREFERED );
|
||||||
|
boolean preferedB = o2.getOtherSide( gn ).hasFlag( GridFlags.PREFERED );
|
||||||
|
|
||||||
|
return preferedA == preferedB ? 0 : (preferedA ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeConnection(IGridConnection gridConnection)
|
public void removeConnection(IGridConnection gridConnection)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
public PartCable(Class c, ItemStack is) {
|
public PartCable(Class c, ItemStack is) {
|
||||||
super( c, is );
|
super( c, is );
|
||||||
|
proxy.setFlags( GridFlags.PREFERED );
|
||||||
proxy.setIdlePowerUsage( 0.0 );
|
proxy.setIdlePowerUsage( 0.0 );
|
||||||
proxy.myColor = AEColor.values()[((ItemMultiPart) is.getItem()).varientOf( is.getItemDamage() )];
|
proxy.myColor = AEColor.values()[((ItemMultiPart) is.getItem()).varientOf( is.getItemDamage() )];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class PartDenseCable extends PartCable
|
|||||||
|
|
||||||
public PartDenseCable(Class c, ItemStack is) {
|
public PartDenseCable(Class c, ItemStack is) {
|
||||||
super( c, is );
|
super( c, is );
|
||||||
proxy.setFlags( GridFlags.TIER_2_CAPACITY );
|
proxy.setFlags( GridFlags.TIER_2_CAPACITY, GridFlags.PREFERED );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartDenseCable(ItemStack is) {
|
public PartDenseCable(ItemStack is) {
|
||||||
|
|||||||
Reference in New Issue
Block a user