Create a sort order for interfaces based on their location.
This commit is contained in:
@@ -150,7 +150,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
{
|
||||
long id = Long.parseLong( key.substring( 1 ), Character.MAX_RADIX );
|
||||
NBTTagCompound invData = in.getCompoundTag( key );
|
||||
ClientDCInternalInv current = getById( id, invData.getString( "un" ) );
|
||||
ClientDCInternalInv current = getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
|
||||
|
||||
for (int x = 0; x < current.inv.getSizeInventory(); x++)
|
||||
{
|
||||
@@ -182,21 +182,29 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
for (String n : names)
|
||||
{
|
||||
lines.add( n );
|
||||
for (ClientDCInternalInv i : byName.get( n ))
|
||||
|
||||
ArrayList<ClientDCInternalInv> lset = new ArrayList();
|
||||
lset.addAll( byName.get( n ) );
|
||||
|
||||
Collections.sort( lset );
|
||||
|
||||
for (ClientDCInternalInv i : lset)
|
||||
{
|
||||
lines.add( i );
|
||||
}
|
||||
}
|
||||
|
||||
myScrollBar.setRange( 0, getTotalRows() - 6, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
private ClientDCInternalInv getById(long id, String string)
|
||||
private ClientDCInternalInv getById(long id, long sortBy, String string)
|
||||
{
|
||||
ClientDCInternalInv o = byId.get( id );
|
||||
|
||||
if ( o == null )
|
||||
{
|
||||
byId.put( id, o = new ClientDCInternalInv( 9, id, string ) );
|
||||
byId.put( id, o = new ClientDCInternalInv( 9, id, sortBy, string ) );
|
||||
refreshList = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,21 @@ package appeng.client.me;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.ItemSorters;
|
||||
|
||||
public class ClientDCInternalInv
|
||||
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||
{
|
||||
|
||||
final public String unlocalizedName;
|
||||
final public long id;
|
||||
final public AppEngInternalInventory inv;
|
||||
final public long id;
|
||||
final public long sortBy;
|
||||
|
||||
public ClientDCInternalInv(int size, long id, String unlocalizedName) {
|
||||
public ClientDCInternalInv(int size, long id, long sortBy, String unlocalizedName) {
|
||||
inv = new AppEngInternalInventory( null, size );
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.id = id;
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
@@ -24,4 +27,10 @@ public class ClientDCInternalInv
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ClientDCInternalInv o)
|
||||
{
|
||||
return ItemSorters.compareLong( sortBy, o.sortBy );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user