+ Mostly working GUI + Many new utilities => A lot of this will need clean-up
44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
package mmm.utils;
|
|
|
|
|
|
public class UContainers
|
|
{
|
|
|
|
public static interface SlotAdder
|
|
{
|
|
public void addSlot( int index , int x , int y );
|
|
}
|
|
|
|
|
|
public static void addPlayerInventory( final UContainers.SlotAdder slotAdder , final int x , final int y )
|
|
{
|
|
UContainers.addPlayerInventory( slotAdder , x , y , 4 );
|
|
}
|
|
|
|
|
|
public static void addPlayerInventory( final UContainers.SlotAdder slotAdder , final int x , final int y ,
|
|
final int spacing )
|
|
{
|
|
UContainers.addGrid( slotAdder , 9 , 3 , 9 , x , y ); // Main inventory
|
|
UContainers.addGrid( slotAdder , 9 , 1 , 0 , x , y + spacing + 54 ); // Quick bar
|
|
}
|
|
|
|
|
|
public static void addGrid( final UContainers.SlotAdder slotAdder , final int columns , final int rows ,
|
|
final int index , final int x , final int y )
|
|
{
|
|
addGrid( slotAdder , columns , rows , index , x , y , 2 , 2 );
|
|
}
|
|
|
|
|
|
public static void addGrid( final UContainers.SlotAdder slotAdder , final int columns , final int rows ,
|
|
final int index , final int x , final int y , int xSpacing , int ySpacing )
|
|
{
|
|
for ( int row = 0 , i = 0 ; row < rows ; ++row ) {
|
|
for ( int column = 0 ; column < columns ; ++column , ++i ) {
|
|
slotAdder.addSlot( index + i , x + column * ( 16 + xSpacing ) , y + row * ( 16 + ySpacing ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|