Puts everywhere brackets

This commit is contained in:
thatsIch
2015-04-29 02:30:53 +02:00
parent 23aa8fd72d
commit 64ed05a1b4
465 changed files with 6726 additions and 14 deletions
@@ -67,7 +67,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
ICellWorkbenchItem cwi = this.workBench.getCell();
if( cwi != null )
{
cwi.setFuzzyMode( this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ), valueOf );
}
}
public void nextCopyMode()
@@ -101,18 +103,22 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
// null, 3 * 8 );
for( int w = 0; w < 7; w++ )
{
for( int z = 0; z < 9; z++ )
{
this.addSlotToContainer( new SlotFakeTypeOnly( inv, offset, x + z * 18, y + w * 18 ) );
offset++;
}
}
for( int zz = 0; zz < 3; zz++ )
{
for( int z = 0; z < 8; z++ )
{
int iSLot = zz * 8 + z;
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
}
}
/*
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
* OptionalSlotFakeTypeOnly( inv, this, offset++, x, y, z, w, 1 ) );
@@ -187,7 +193,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public void onUpdate( String field, Object oldValue, Object newValue )
{
if( field.equals( "copyMode" ) )
{
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.copyMode );
}
super.onUpdate( field, oldValue, newValue );
}
@@ -196,7 +204,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
IInventory inv = this.upgradeable.getInventoryByName( "config" );
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
inv.setInventorySlotContents( x, null );
}
this.detectAndSendChanges();
}
@@ -204,7 +214,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
ICellWorkbenchItem cwi = this.workBench.getCell();
if( cwi != null )
{
return cwi.getFuzzyMode( this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ) );
}
return FuzzyMode.IGNORE_ALL;
}
@@ -230,7 +242,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
inv.setInventorySlotContents( x, g );
}
else
{
inv.setInventorySlotContents( x, null );
}
}
this.detectAndSendChanges();
@@ -98,14 +98,22 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void cycleCpu( boolean next )
{
if( next )
{
this.selectedCpu++;
}
else
{
this.selectedCpu--;
}
if( this.selectedCpu < -1 )
{
this.selectedCpu = this.cpus.size() - 1;
}
else if( this.selectedCpu >= this.cpus.size() )
{
this.selectedCpu = -1;
}
if( this.selectedCpu == -1 )
{
@@ -125,7 +133,9 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void detectAndSendChanges()
{
if( Platform.isClient() )
{
return;
}
ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
@@ -136,16 +146,24 @@ public class ContainerCraftConfirm extends AEBaseContainer
{
boolean found = false;
for( CraftingCPURecord ccr : this.cpus )
{
if( ccr.cpu == c )
{
found = true;
}
}
boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
if( changed || this.cpus.size() != matches )
@@ -154,7 +172,9 @@ public class ContainerCraftConfirm extends AEBaseContainer
for( ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
}
}
this.sendCPUs();
@@ -180,7 +200,9 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
}
else
{
this.simulation = true;
}
try
{
@@ -223,13 +245,19 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
if( o.getStackSize() > 0 )
{
a.appendItem( o );
}
if( p.getStackSize() > 0 )
{
b.appendItem( p );
}
if( c != null && m != null && m.getStackSize() > 0 )
{
c.appendItem( m );
}
}
for( Object g : this.crafters )
@@ -239,7 +267,9 @@ public class ContainerCraftConfirm extends AEBaseContainer
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
if( c != null )
{
NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g );
}
}
}
}
@@ -297,16 +327,24 @@ public class ContainerCraftConfirm extends AEBaseContainer
IActionHost ah = this.getActionHost();
if( ah instanceof WirelessTerminalGuiObject )
{
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if( ah instanceof PartTerminal )
{
OriginalGui = GuiBridge.GUI_ME;
}
if( ah instanceof PartCraftingTerminal )
{
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if( ah instanceof PartPatternTerminal )
{
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if( this.result != null && !this.simulation )
{
@@ -67,14 +67,20 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
this.findNode( host, ForgeDirection.UNKNOWN );
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
this.findNode( host, d );
}
}
if( te instanceof TileCraftingTile )
{
this.setCPU( (ICraftingCPU) ( (TileCraftingTile) te ).getCluster() );
}
if( this.network == null && Platform.isServer() )
{
this.isContainerValid = false;
}
}
private void findNode( IGridHost host, ForgeDirection d )
@@ -83,17 +89,23 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
IGridNode node = host.getGridNode( d );
if( node != null )
{
this.network = node.getGrid();
}
}
}
protected void setCPU( ICraftingCPU c )
{
if( c == this.monitor )
{
return;
}
if( this.monitor != null )
{
this.monitor.removeListener( this );
}
for( Object g : this.crafters )
{
@@ -143,7 +155,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
super.removeCraftingFromCrafters( c );
if( this.crafters.isEmpty() && this.monitor != null )
{
this.monitor.removeListener( this );
}
}
@Override
@@ -151,7 +165,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
super.onContainerClosed( player );
if( this.monitor != null )
{
this.monitor.removeListener( this );
}
}
@Override
@@ -179,13 +195,19 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
if( g instanceof EntityPlayer )
{
if( !a.isEmpty() )
{
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
}
if( !b.isEmpty() )
{
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
}
if( !c.isEmpty() )
{
NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g );
}
}
}
}
@@ -60,16 +60,24 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
{
boolean found = false;
for( CraftingCPURecord ccr : this.cpus )
{
if( ccr.cpu == c )
{
found = true;
}
}
boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
if( changed || this.cpus.size() != matches )
@@ -78,7 +86,9 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
for( ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
}
}
this.sendCPUs();
@@ -109,31 +119,47 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
}
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
{
this.selectedCpu = 0;
}
if( this.selectedCpu != -1 )
{
if( this.cpus.get( this.selectedCpu ).cpu != this.monitor )
{
this.setCPU( this.cpus.get( this.selectedCpu ).cpu );
}
}
else
{
this.setCPU( null );
}
}
public void cycleCpu( boolean next )
{
if( next )
{
this.selectedCpu++;
}
else
{
this.selectedCpu--;
}
if( this.selectedCpu < -1 )
{
this.selectedCpu = this.cpus.size() - 1;
}
else if( this.selectedCpu >= this.cpus.size() )
{
this.selectedCpu = -1;
}
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
{
this.selectedCpu = 0;
}
if( this.selectedCpu == -1 )
{
@@ -52,8 +52,12 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
IInventory crafting = this.ct.getInventoryByName( "crafting" );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 3; x++ )
{
this.addSlotToContainer( this.craftingSlots[x + y * 3] = new SlotCraftingMatrix( this, crafting, x + y * 3, 37 + x * 18, -72 + y * 18 ) );
}
}
this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.mySrc, this.powerSrc, monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) );
@@ -72,7 +76,9 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
InventoryCrafting ic = new InventoryCrafting( cn, 3, 3 );
for( int x = 0; x < 9; x++ )
{
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
}
this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj ) );
}
@@ -37,10 +37,12 @@ public class ContainerDrive extends AEBaseContainer
this.drive = drive;
for( int y = 0; y < 5; y++ )
{
for( int x = 0; x < 2; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.invPlayer ) );
}
}
this.bindPlayerInventory( ip, 0, 199 - /* height of player inventory */82 );
}
@@ -67,9 +67,13 @@ public class ContainerFormationPlane extends ContainerUpgradeable
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 ) );
}
}
}
@@ -65,14 +65,22 @@ public class ContainerIOPort extends ContainerUpgradeable
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 2; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
}
}
offX = 122;
offY = 17;
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 2; x++ )
{
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
}
}
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
@@ -118,7 +118,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
for( ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
{
if( Platform.isSameItemPrecise( optional, is ) )
{
return false;
}
}
boolean matches = false;
@@ -138,13 +140,17 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
for( ItemStack option : recipe.getInputs() )
{
if( Platform.isSameItemPrecise( is, option ) )
{
found = true;
}
}
}
}
if( matches && !found )
{
return false;
}
}
if( ( s == this.top && bot != null ) || ( s == this.bottom && top != null ) )
@@ -152,9 +158,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
boolean isValid = false;
ItemStack otherSlot = null;
if( s == this.top )
{
otherSlot = this.bottom.getStack();
}
else
{
otherSlot = this.top.getStack();
}
// name presses
final IItemDefinition namePress = AEApi.instance().definitions().materials().namePress();
@@ -176,11 +186,15 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
}
if( isValid )
{
break;
}
}
if( !isValid )
{
return false;
}
}
return true;
@@ -51,13 +51,19 @@ public class ContainerInterface extends ContainerUpgradeable
this.myDuality = te.getInterfaceDuality();
for( int x = 0; x < 9; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.invPlayer ) );
}
for( int x = 0; x < 8; x++ )
{
this.addSlotToContainer( new SlotFake( this.myDuality.getConfig(), x, 17 + 18 * x, 35 ) );
}
for( int x = 0; x < 8; x++ )
{
this.addSlotToContainer( new SlotNormal( this.myDuality.getStorage(), x, 17 + 18 * x, 35 + 18 ) );
}
}
@Override
@@ -72,7 +72,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
super( ip, anchor );
if( Platform.isServer() )
{
this.grid = anchor.getActionableNode().getGrid();
}
this.bindPlayerInventory( ip, 0, 222 - /* height of player inventory */82 );
}
@@ -81,12 +83,16 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
public void detectAndSendChanges()
{
if( Platform.isClient() )
{
return;
}
super.detectAndSendChanges();
if( this.grid == null )
{
return;
}
int total = 0;
boolean missing = false;
@@ -103,17 +109,23 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
{
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
if( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO )
{
continue;
}
InvTracker t = this.diList.get( ih );
if( t == null )
{
missing = true;
}
else
{
DualityInterface dual = ih.getInterfaceDuality();
if( !t.unlocalizedName.equals( dual.getTermName() ) )
{
missing = true;
}
}
total++;
@@ -126,17 +138,23 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
{
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
if( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO )
{
continue;
}
InvTracker t = this.diList.get( ih );
if( t == null )
{
missing = true;
}
else
{
DualityInterface dual = ih.getInterfaceDuality();
if( !t.unlocalizedName.equals( dual.getTermName() ) )
{
missing = true;
}
}
total++;
@@ -146,7 +164,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
}
if( total != this.diList.size() || missing )
{
this.regenList( this.data );
}
else
{
for( Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet() )
@@ -155,7 +175,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
for( int x = 0; x < inv.server.getSizeInventory(); x++ )
{
if( this.isDifferent( inv.server.getStackInSlot( x ), inv.client.getStackInSlot( x ) ) )
{
this.addItems( this.data, inv, x, 1 );
}
}
}
}
@@ -199,7 +221,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
{
ItemStack inSlot = theSlot.getStackInSlot( 0 );
if( inSlot == null )
{
player.inventory.setItemStack( interfaceSlot.addItems( player.inventory.getItemStack() ) );
}
else
{
inSlot = inSlot.copy();
@@ -211,7 +235,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
player.inventory.setItemStack( interfaceSlot.addItems( inHand.copy() ) );
if( player.inventory.getItemStack() == null )
{
player.inventory.setItemStack( inSlot );
}
else
{
player.inventory.setItemStack( inHand );
@@ -232,17 +258,25 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
{
ItemStack extra = playerHand.removeItems( 1, null, null );
if( extra != null )
{
extra = interfaceSlot.addItems( extra );
}
if( extra != null )
{
playerHand.addItems( extra );
}
}
else if( is != null )
{
ItemStack extra = interfaceSlot.removeItems( ( is.stackSize + 1 ) / 2, null, null );
if( extra != null )
{
extra = playerHand.addItems( extra );
}
if( extra != null )
{
interfaceSlot.addItems( extra );
}
}
break;
@@ -294,7 +328,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
DualityInterface dual = ih.getInterfaceDuality();
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
{
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
}
}
for( IGridNode gn : this.grid.getMachines( PartInterface.class ) )
@@ -302,7 +338,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
DualityInterface dual = ih.getInterfaceDuality();
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
{
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
}
}
}
}
@@ -320,10 +358,14 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
private boolean isDifferent( ItemStack a, ItemStack b )
{
if( a == null && b == null )
{
return false;
}
if( a == null || b == null )
{
return true;
}
return !ItemStack.areItemStacksEqual( a, b );
}
@@ -349,7 +391,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
inv.client.setInventorySlotContents( x + offset, is == null ? null : is.copy() );
if( is != null )
{
is.writeToNBT( itemNBT );
}
tag.setTag( Integer.toString( x + offset ), itemNBT );
}
@@ -81,13 +81,21 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
if( this.availableUpgrades() > 0 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 1 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 2 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 3 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
}
IInventory inv = this.upgradeable.getInventoryByName( "config" );
this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
@@ -129,7 +137,9 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
if( field.equals( "EmitterValue" ) )
{
if( this.textField != null )
{
this.textField.setText( String.valueOf( this.EmitterValue ) );
}
}
}
}
@@ -58,7 +58,9 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
ItemStack is = mac.getStackInSlot( 10 );
if( is == null )
{
return false;
}
if( is.getItem() instanceof ItemEncodedPattern )
{
@@ -66,7 +68,9 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
if( ph.isCraftable() )
{
return ph.isValidItemForSlot( slotIndex, i, w );
}
}
return false;
@@ -87,11 +91,13 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
IInventory mac = this.upgradeable.getInventoryByName( "mac" );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 3; x++ )
{
SlotMACPattern s = new SlotMACPattern( this, mac, x + y * 3, offX + x * 18, offY + y * 18 );
this.addSlotToContainer( s );
}
}
offX = 126;
offY = 16;
@@ -112,9 +112,13 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
this.cellInv = this.monitor;
if( monitorable instanceof IPortableCell )
{
this.powerSrc = (IPortableCell) monitorable;
}
else if( monitorable instanceof IMEChest )
{
this.powerSrc = (IMEChest) monitorable;
}
else if( monitorable instanceof IGridHost )
{
IGridNode node = ( (IGridHost) monitorable ).getGridNode( ForgeDirection.UNKNOWN );
@@ -123,15 +127,21 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
this.networkNode = node;
IGrid g = node.getGrid();
if( g != null )
{
this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) );
}
}
}
}
else
{
this.isContainerValid = false;
}
}
else
{
this.monitor = null;
}
this.canAccessViewCells = false;
if( monitorable instanceof IViewCellStorage )
@@ -145,7 +155,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
}
if( bindInventory )
{
this.bindPlayerInventory( ip, 0, 0 );
}
}
public IGridNode getNetworkNode()
@@ -159,7 +171,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
if( Platform.isServer() )
{
if( this.monitor != this.host.getItemInventory() )
{
this.isContainerValid = false;
}
for( Settings set : this.serverCM.getSettings() )
{
@@ -200,7 +214,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
piu.appendItem( is );
}
else
{
piu.appendItem( send );
}
}
if( !piu.isEmpty() )
@@ -210,7 +226,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
for( Object c : this.crafters )
{
if( c instanceof EntityPlayer )
{
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
}
}
}
}
@@ -229,7 +247,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
for( int y = 0; y < 5; y++ )
{
if( this.cellView[y] != null )
{
this.cellView[y].allowEdit = this.canAccessViewCells;
}
}
}
@@ -242,11 +262,17 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
try
{
if( this.networkNode != null )
{
this.hasPower = this.networkNode.isActive();
}
else if( this.powerSrc instanceof IEnergyGrid )
{
this.hasPower = ( (IEnergyGrid) this.powerSrc ).isNetworkPowered();
}
else
{
this.hasPower = this.powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8;
}
}
catch( Throwable t )
{
@@ -260,8 +286,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
if( field.equals( "canAccessViewCells" ) )
{
for( int y = 0; y < 5; y++ )
{
if( this.cellView[y] != null )
{
this.cellView[y].allowEdit = this.canAccessViewCells;
}
}
}
super.onUpdate( field, oldValue, newValue );
@@ -313,7 +343,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
super.removeCraftingFromCrafters( c );
if( this.crafters.isEmpty() && this.monitor != null )
{
this.monitor.removeListener( this );
}
}
@Override
@@ -321,7 +353,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
super.onContainerClosed( player );
if( this.monitor != null )
{
this.monitor.removeListener( this );
}
}
@Override
@@ -334,7 +368,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
public void postChange( IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source )
{
for( IAEItemStack is : change )
{
this.items.add( is );
}
}
@Override
@@ -354,14 +390,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
{
if( this.gui != null )
{
this.gui.updateSetting( manager, settingName, newValue );
}
}
@Override
public IConfigManager getConfigManager()
{
if( Platform.isServer() )
{
return this.serverCM;
}
return this.clientCM;
}
@@ -370,7 +410,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
ItemStack[] list = new ItemStack[this.cellView.length];
for( int x = 0; x < this.cellView.length; x++ )
{
list[x] = this.cellView[x].getStack();
}
return list;
}
@@ -68,16 +68,24 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
if( currentItem != null )
{
if( Platform.isSameItem( this.civ.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
}
else
{
this.isContainerValid = false;
}
}
else
{
this.isContainerValid = false;
}
}
}
else
{
this.isContainerValid = false;
}
// drain 1 ae t
this.ticks++;
@@ -67,11 +67,15 @@ public class ContainerNetworkStatus extends AEBaseContainer
{
this.findNode( host, ForgeDirection.UNKNOWN );
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
this.findNode( host, d );
}
}
if( this.network == null && Platform.isServer() )
{
this.isContainerValid = false;
}
}
private void findNode( IGridHost host, ForgeDirection d )
@@ -80,7 +84,9 @@ public class ContainerNetworkStatus extends AEBaseContainer
{
IGridNode node = host.getGridNode( d );
if( node != null )
{
this.network = node.getGrid();
}
}
}
@@ -123,13 +129,17 @@ public class ContainerNetworkStatus extends AEBaseContainer
}
for( IAEItemStack ais : list )
{
piu.appendItem( ais );
}
}
for( Object c : this.crafters )
{
if( c instanceof EntityPlayer )
{
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
}
}
}
catch( IOException e )
@@ -46,8 +46,12 @@ public class ContainerNetworkTool extends AEBaseContainer
this.lockPlayerInventorySlot( ip.currentItem );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 3; x++ )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.invPlayer ) ) );
}
}
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
}
@@ -73,10 +77,14 @@ public class ContainerNetworkTool extends AEBaseContainer
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
}
else
{
this.isContainerValid = false;
}
}
else
{
this.isContainerValid = false;
}
}
if( this.isContainerValid )
@@ -91,8 +91,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
this.crafting = this.ct.getInventoryByName( "crafting" );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 3; x++ )
{
this.addSlotToContainer( this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix( this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18 ) );
}
}
this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.mySrc, this.powerSrc, monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) );
this.craftSlot.IIcon = -1;
@@ -120,14 +124,18 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
this.craftSlot.xDisplayPosition = -9000;
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].defX;
}
}
else
{
this.craftSlot.xDisplayPosition = this.craftSlot.defX;
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xDisplayPosition = -9000;
}
}
}
@@ -149,7 +157,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
for( int x = 0; x < ic.getSizeInventory(); x++ )
{
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
}
ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj );
this.cOut.setInventorySlotContents( 0, is );
@@ -177,23 +187,29 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
// if there is no input, this would be silly.
if( in == null || out == null )
{
return;
}
// first check the output slots, should either be null, or a pattern
if( output != null && !this.isPattern( output ) )
{
return;
// if nothing is there we should snag a new pattern.
}// if nothing is there we should snag a new pattern.
else if( output == null )
{
output = this.patternSlotIN.getStack();
if( output == null || !this.isPattern( output ) )
{
return; // no blanks.
}
// remove one, and clear the input slot.
output.stackSize--;
if( output.stackSize == 0 )
{
this.patternSlotIN.putStack( null );
}
// add a new encoded pattern.
for( ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
@@ -210,10 +226,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
NBTTagList tagOut = new NBTTagList();
for( ItemStack i : in )
{
tagIn.appendTag( this.createItemTag( i ) );
}
for( ItemStack i : out )
{
tagOut.appendTag( this.createItemTag( i ) );
}
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
@@ -231,11 +251,15 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
input[x] = this.craftingSlots[x].getStack();
if( input[x] != null )
{
hasValue = true;
}
}
if( hasValue )
{
return input;
}
return null;
}
@@ -246,7 +270,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
ItemStack out = this.getAndUpdateOutput();
if( out != null && out.stackSize > 0 )
{
return new ItemStack[] { out };
}
}
else
{
@@ -264,7 +290,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
if( hasValue )
{
return list.toArray( new ItemStack[list.size()] );
}
}
return null;
@@ -273,7 +301,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private boolean isPattern( ItemStack output )
{
if( output == null )
{
return false;
}
final IDefinitions definitions = AEApi.instance().definitions();
@@ -288,7 +318,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
NBTTagCompound c = new NBTTagCompound();
if( i != null )
{
i.writeToNBT( c );
}
return c;
}
@@ -297,11 +329,17 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
public boolean isSlotEnabled( int idx )
{
if( idx == 1 )
{
return Platform.isServer() ? !this.ct.isCraftingRecipe() : !this.craftingMode;
}
else if( idx == 2 )
{
return Platform.isServer() ? this.ct.isCraftingRecipe() : this.craftingMode;
}
else
{
return false;
}
}
public void craftOrGetItem( PacketPatternSlot packetPatternSlot )
@@ -313,10 +351,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player );
InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( this.getPlayerInv().player, ForgeDirection.UNKNOWN );
if( packetPatternSlot.shift )
{
inv = playerInv;
}
if( inv.simulateAdd( out.getItemStack() ) != null )
{
return;
}
IAEItemStack extracted = Platform.poweredExtraction( this.powerSrc, this.cellInv, out, this.mySrc );
EntityPlayer p = this.getPlayerInv().player;
@@ -325,7 +367,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
inv.addItems( extracted.getItemStack() );
if( p instanceof EntityPlayerMP )
{
this.updateHeld( (EntityPlayerMP) p );
}
this.detectAndSendChanges();
return;
}
@@ -340,7 +384,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
if( r == null )
{
return;
}
IMEMonitor<IAEItemStack> storage = this.ct.getItemInventory();
IItemList<IAEItemStack> all = storage.getStorageList();
@@ -367,12 +413,16 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
ItemStack failed = playerInv.addItems( real.getStackInSlot( x ) );
if( failed != null )
{
p.dropPlayerItemWithRandomChoice( failed, false );
}
}
inv.addItems( is );
if( p instanceof EntityPlayerMP )
{
this.updateHeld( (EntityPlayerMP) p );
}
this.detectAndSendChanges();
}
else
@@ -441,10 +491,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
public void clear()
{
for( Slot s : this.craftingSlots )
{
s.putStack( null );
}
for( Slot s : this.outputSlots )
{
s.putStack( null );
}
this.detectAndSendChanges();
this.getAndUpdateOutput();
@@ -82,7 +82,9 @@ public class ContainerPriority extends AEBaseContainer
if( field.equals( "PriorityValue" ) )
{
if( this.textField != null )
{
this.textField.setText( String.valueOf( this.PriorityValue ) );
}
}
super.onUpdate( field, oldValue, newValue );
@@ -76,12 +76,18 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
if( currentItem != null )
{
if( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
}
else
{
this.isContainerValid = false;
}
}
else
{
this.isContainerValid = false;
}
}
super.detectAndSendChanges();
@@ -91,7 +97,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
public void onContainerClosed( EntityPlayer par1EntityPlayer )
{
if( this.inSlot.getStackInSlot( 0 ) != null )
{
par1EntityPlayer.dropPlayerItemWithRandomChoice( this.inSlot.getStackInSlot( 0 ), false );
}
}
@Override
@@ -117,7 +125,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
{
ItemStack input = this.inSlot.getStackInSlot( 0 );
if( input == null )
{
return null;
}
if( SlotRestrictedInput.isMetalIngot( input ) )
{
@@ -143,7 +153,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
if( is != null )
{
if( this.makePlate() )
{
return is;
}
}
return null;
}
@@ -176,7 +188,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
public void setInventorySlotContents( int var1, ItemStack var2 )
{
if( var2 == null && Platform.isServer() )
{
this.makePlate();
}
}
@Override
@@ -79,9 +79,13 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
{
IBiometricCard bc = (IBiometricCard) a.getItem();
if( bc.hasPermission( a, permission ) )
{
bc.removePermission( a, permission );
}
else
{
bc.addPermission( a, permission );
}
}
}
catch( EnumConstantNotPresentException ex )
@@ -103,7 +107,9 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
IBiometricCard bc = (IBiometricCard) a.getItem();
for( SecurityPermissions sp : bc.getPermissions( a ) )
{
this.security |= ( 1 << sp.ordinal() );
}
}
this.updatePowerStatus();
@@ -117,10 +123,14 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
super.onContainerClosed( player );
if( this.wirelessIn.getHasStack() )
{
player.dropPlayerItemWithRandomChoice( this.wirelessIn.getStack(), false );
}
if( this.wirelessOut.getHasStack() )
{
player.dropPlayerItemWithRandomChoice( this.wirelessOut.getStack(), false );
}
}
@Override
@@ -140,11 +150,15 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
INetworkEncodable networkEncodable = null;
if( term.getItem() instanceof INetworkEncodable )
{
networkEncodable = (INetworkEncodable) term.getItem();
}
IWirelessTermHandler wTermHandler = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term );
if( wTermHandler != null )
{
networkEncodable = wTermHandler;
}
if( networkEncodable != null )
{
@@ -55,7 +55,9 @@ public class ContainerSpatialIOPort extends AEBaseContainer
this.spatialIOPort = spatialIOPort;
if( Platform.isServer() )
{
this.network = spatialIOPort.getGridNode( ForgeDirection.UNKNOWN ).getGrid();
}
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.invPlayer ) );
this.addSlotToContainer( new SlotOutput( spatialIOPort, 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
@@ -79,9 +79,13 @@ public class ContainerStorageBus extends ContainerUpgradeable
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 ) );
}
}
}
@@ -132,7 +136,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
{
IInventory inv = this.upgradeable.getInventoryByName( "config" );
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
inv.setInventorySlotContents( x, null );
}
this.detectAndSendChanges();
}
@@ -158,7 +164,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
inv.setInventorySlotContents( x, g );
}
else
{
inv.setInventorySlotContents( x, null );
}
}
this.detectAndSendChanges();
@@ -104,8 +104,12 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
if( this.hasToolbox() )
{
for( int v = 0; v < 3; v++ )
{
for( int u = 0; u < 3; u++ )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.invPlayer ) ).setPlayerSide() );
}
}
}
this.setupConfig();
@@ -150,13 +154,21 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
if( this.availableUpgrades() > 0 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 1 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 2 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 3 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
}
}
protected boolean supportCapacity()
@@ -188,7 +200,9 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
OptionalSlotFake fs = (OptionalSlotFake) o;
if( !fs.isEnabled() && fs.getDisplayStack() != null )
{
fs.clearStack();
}
}
}
@@ -200,7 +214,9 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
this.fzMode = (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE );
this.rsMode = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED );
if( this.upgradeable instanceof PartExportBus )
{
this.cMode = (YesNo) cm.getSetting( Settings.CRAFT_ONLY );
}
}
public void checkToolbox()
@@ -214,12 +230,18 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
if( currentItem != null )
{
if( Platform.isSameItem( this.tbInventory.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
}
else
{
this.isContainerValid = false;
}
}
else
{
this.isContainerValid = false;
}
}
}
}
@@ -235,9 +257,13 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
if( idx == 1 && upgrades > 0 )
{
return true;
}
if( idx == 2 && upgrades > 1 )
{
return true;
}
return false;
}
@@ -46,7 +46,9 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
if( !this.wirelessTerminalGUIObject.rangeCheck() )
{
if( Platform.isServer() && this.isContainerValid )
{
this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
}
this.isContainerValid = false;
}
@@ -44,7 +44,9 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
{
int a = ItemSorters.compareLong( o.processors, this.processors );
if( a != 0 )
{
return a;
}
return ItemSorters.compareLong( o.size, this.size );
}
}