Basic reformat, hit once, hope never again
This commit is contained in:
@@ -43,18 +43,20 @@ import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.iterators.NullIterator;
|
||||
|
||||
|
||||
public class ContainerStorageBus extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
final PartStorageBus storageBus;
|
||||
|
||||
@GuiSync(3)
|
||||
@GuiSync( 3 )
|
||||
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;
|
||||
|
||||
@GuiSync(4)
|
||||
@GuiSync( 4 )
|
||||
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||
|
||||
public ContainerStorageBus(InventoryPlayer ip, PartStorageBus te) {
|
||||
public ContainerStorageBus( InventoryPlayer ip, PartStorageBus te )
|
||||
{
|
||||
super( ip, te );
|
||||
this.storageBus = te;
|
||||
}
|
||||
@@ -66,9 +68,29 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
protected void setupConfig()
|
||||
{
|
||||
return 5;
|
||||
int xo = 8;
|
||||
int yo = 23 + 6;
|
||||
|
||||
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
||||
for( int y = 0; y < 7; y++ )
|
||||
{
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
if( y < 2 )
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
else
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
|
||||
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
|
||||
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
|
||||
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
|
||||
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ) ).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,37 +100,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
public int availableUpgrades()
|
||||
{
|
||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
return upgrades > idx;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int xo = 8;
|
||||
int yo = 23 + 6;
|
||||
|
||||
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int y = 0; y < 7; y++)
|
||||
{
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
if ( y < 2 )
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
else
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer )).setNotDraggable() );
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,7 +110,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
{
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
this.rwMode = (AccessRestriction) this.upgradeable.getConfigManager().getSetting( Settings.ACCESS );
|
||||
@@ -126,10 +120,18 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled( int idx )
|
||||
{
|
||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
return upgrades > idx;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
inv.setInventorySlotContents( x, null );
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
@@ -141,15 +143,15 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
|
||||
if ( cellInv != null )
|
||||
if( cellInv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
{
|
||||
if ( i.hasNext() && this.isSlotEnabled( (x / 9) - 2 ) )
|
||||
if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) )
|
||||
{
|
||||
ItemStack g = i.next().getItemStack();
|
||||
g.stackSize = 1;
|
||||
@@ -161,5 +163,4 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user