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
@@ -66,15 +66,21 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
ICellWorkbenchItem cell = this.getCell();
if( cell == null )
{
return null;
}
ItemStack is = this.cell.getStackInSlot( 0 );
if( is == null )
{
return null;
}
IInventory inv = cell.getUpgradesInventory( is );
if( inv == null )
{
return null;
}
return this.cacheUpgrades = inv;
}
@@ -84,10 +90,14 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
public ICellWorkbenchItem getCell()
{
if( this.cell.getStackInSlot( 0 ) == null )
{
return null;
}
if( this.cell.getStackInSlot( 0 ).getItem() instanceof ICellWorkbenchItem )
{
return ( (ICellWorkbenchItem) this.cell.getStackInSlot( 0 ).getItem() );
}
return null;
}
@@ -112,10 +122,14 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
public IInventory getInventoryByName( String name )
{
if( name.equals( "config" ) )
{
return this.config;
}
if( name.equals( "cell" ) )
{
return this.cell;
}
return null;
}
@@ -152,12 +166,16 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
if( cellHasConfig )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
{
this.config.setInventorySlotContents( x, configInventory.getStackInSlot( x ) );
}
}
else
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
{
configInventory.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
}
configInventory.markDirty();
}
@@ -165,7 +183,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
else if( this.manager.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
{
this.config.setInventorySlotContents( x, null );
}
this.markDirty();
}
@@ -178,7 +198,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
if( c != null )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
{
c.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
}
c.markDirty();
}
@@ -191,15 +213,21 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
ICellWorkbenchItem cell = this.getCell();
if( cell == null )
{
return null;
}
ItemStack is = this.cell.getStackInSlot( 0 );
if( is == null )
{
return null;
}
IInventory inv = cell.getConfigInventory( is );
if( inv == null )
{
return null;
}
this.cacheConfig = inv;
}
@@ -212,7 +240,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
super.getDrops( w, x, y, z, drops );
if( this.cell.getStackInSlot( 0 ) != null )
{
drops.add( this.cell.getStackInSlot( 0 ) );
}
}
@Override
@@ -97,7 +97,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
{
AEItemStack is = AEItemStack.create( this.getStackInSlot( 0 ) );
if( is != null )
{
is.writeToPacket( data );
}
}
@TileEvent( TileEventType.TICK )
@@ -113,7 +115,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
this.tickTickTimer++;
if( this.tickTickTimer < 20 )
{
return;
}
this.tickTickTimer = 0;
ItemStack myItem = this.getStackInSlot( 0 );
@@ -133,7 +137,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
if( myItem == null )
{
return;
}
final IMaterials materials = AEApi.instance().definitions().materials();
@@ -147,7 +153,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
this.internalCurrentPower += adjustment;
if( oldPower > this.internalCurrentPower )
{
this.requiresUpdate = true;
}
this.tickTickTimer = 20; // keep ticking...
}
}
@@ -246,7 +254,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
{
IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem();
if( ips.getAECurrentPower( extractedItem ) >= ips.getAEMaxPower( extractedItem ) )
{
return true;
}
}
return AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( extractedItem );
@@ -261,7 +271,9 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
public void activate( EntityPlayer player )
{
if( !Platform.hasPermissions( new DimensionalCoord( this ), player ) )
{
return;
}
ItemStack myItem = this.getStackInSlot( 0 );
if( myItem == null )
@@ -83,7 +83,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
IStorageComponent sc = (IStorageComponent) is.getItem();
if( sc.isStorageComponent( is ) )
{
return sc.getBytes( is ) * 8;
}
}
}
return 0;
@@ -104,7 +106,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
this.addOutput( output );
}
else
{
break;
}
}
}
@@ -123,7 +127,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
ItemStack outputStack = this.getStackInSlot( 1 );
if( outputStack == null )
{
this.setInventorySlotContents( 1, output.copy() );
}
else
{
outputStack.stackSize++;
@@ -172,7 +178,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
if( i == 0 )
{
if( itemstack != null )
{
this.addPower( itemstack.stackSize );
}
}
else
{
@@ -222,7 +230,9 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
{
if( doFill )
{
this.addPower( ( resource == null ? 0.0 : (double) resource.amount ) / 500.0 );
}
return resource == null ? 0 : resource.amount;
}
@@ -149,9 +149,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
{
if( ( slot & ( 1 << num ) ) > 0 )
{
this.inv.setInventorySlotContents( num, AEItemStack.loadItemStackFromPacket( data ).getItemStack() );
}
else
{
this.inv.setInventorySlotContents( num, null );
}
}
return false;
@@ -165,7 +169,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
{
if( this.inv.getStackInSlot( num ) != null )
{
slot |= ( 1 << num );
}
}
data.writeByte( slot );
@@ -196,7 +202,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
ItemStack is = this.upgrades.getStackInSlot( h );
if( is != null )
{
drops.add( is );
}
}
}
@@ -222,7 +230,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
if( this.smash )
{
return false;
}
if( i == 0 || i == 1 )
{
@@ -232,8 +242,12 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
for( ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
{
if( Platform.isSameItemPrecise( optionals, itemstack ) )
{
return true;
}
}
}
return i == 2;
@@ -247,10 +261,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( mc != InvOperation.markDirty )
{
if( slot != 3 )
{
this.processingTime = 0;
}
if( !this.smash )
{
this.markForUpdate();
}
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
@@ -265,7 +283,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
{
if( this.smash )
{
return false;
}
return slotIndex == 0 || slotIndex == 1 || slotIndex == 3;
}
@@ -274,10 +294,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public int[] getAccessibleSlotsBySide( ForgeDirection d )
{
if( d == ForgeDirection.UP )
{
return this.top;
}
if( d == ForgeDirection.DOWN )
{
return this.bottom;
}
return this.sides;
}
@@ -291,7 +315,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
private boolean hasWork()
{
if( this.getTask() != null )
{
return true;
}
this.processingTime = 0;
return this.smash;
@@ -305,13 +331,19 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
ItemStack renamedItem = this.getStackInSlot( 2 );
if( plateA != null && plateA.stackSize > 1 )
{
return null;
}
if( plateB != null && plateB.stackSize > 1 )
{
return null;
}
if( renamedItem != null && renamedItem.stackSize > 1 )
{
return null;
}
final IComparableDefinition namePress = AEApi.instance().definitions().materials().namePress();
boolean isNameA = namePress.isSameAs( plateA );
@@ -333,7 +365,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
NBTTagCompound tag = Platform.openNbtData( plateB );
if( name.length() > 0 )
{
name += " ";
}
name += tag.getString( "InscribeName" );
}
@@ -345,9 +379,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
tag.setTag( "display", display );
if( name.length() > 0 )
{
display.setString( "Name", name );
}
else
{
display.removeTag( "Name" );
}
final List<ItemStack> inputs = Lists.newArrayList( startingItem );
final InscriberProcessType type = InscriberProcessType.Inscribe;
@@ -370,7 +408,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
for( ItemStack option : recipe.getInputs() )
{
if( Platform.isSameItemPrecise( option, this.getStackInSlot( 2 ) ) )
{
return recipe;
}
}
}
}
@@ -437,9 +477,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );
if( this.processingTime == 0 )
{
this.processingTime += speedFactor;
}
else
{
this.processingTime += TicksSinceLastCall * speedFactor;
}
}
}
catch( GridAccessException e )
@@ -478,10 +522,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public IInventory getInventoryByName( String name )
{
if( name.equals( "inv" ) )
{
return this.inv;
}
if( name.equals( "upgrades" ) )
{
return this.upgrades;
}
return null;
}
@@ -85,21 +85,35 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
public void setSide( ForgeDirection axis )
{
if( Platform.isClient() )
{
return;
}
if( this.pointAt == axis.getOpposite() )
{
this.pointAt = axis;
}
else if( this.pointAt == axis || this.pointAt == axis.getOpposite() )
{
this.pointAt = ForgeDirection.UNKNOWN;
}
else if( this.pointAt == ForgeDirection.UNKNOWN )
{
this.pointAt = axis.getOpposite();
}
else
{
this.pointAt = Platform.rotateAround( this.pointAt, axis );
}
if( ForgeDirection.UNKNOWN == this.pointAt )
{
this.setOrientation( this.pointAt, this.pointAt );
}
else
{
this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() );
}
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
this.markForUpdate();
@@ -145,9 +159,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
int val = data.getInteger( "pointAt" );
if( val >= 0 && val < ForgeDirection.values().length )
{
this.pointAt = ForgeDirection.values()[val];
}
else
{
this.pointAt = ForgeDirection.UNKNOWN;
}
this.duality.readFromNBT( data );
}
@@ -228,7 +246,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
public EnumSet<ForgeDirection> getTargets()
{
if( this.pointAt == null || this.pointAt == ForgeDirection.UNKNOWN )
{
return EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) );
}
return EnumSet.of( this.pointAt );
}
@@ -58,7 +58,9 @@ public class TilePaint extends AEBaseTile
ByteBuf myDat = Unpooled.buffer();
this.writeBuffer( myDat );
if( myDat.hasArray() )
{
data.setByteArray( "dots", myDat.array() );
}
}
void writeBuffer( ByteBuf out )
@@ -72,14 +74,18 @@ public class TilePaint extends AEBaseTile
out.writeByte( this.dots.size() );
for( Splotch s : this.dots )
{
s.writeToStream( out );
}
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TilePaint( NBTTagCompound data )
{
if( data.hasKey( "dots" ) )
{
this.readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) );
}
}
void readBuffer( ByteBuf in )
@@ -95,7 +101,9 @@ public class TilePaint extends AEBaseTile
this.dots = new ArrayList( howMany );
for( int x = 0; x < howMany; x++ )
{
this.dots.add( new Splotch( in ) );
}
this.isLit = 0;
for( Splotch s : this.dots )
@@ -112,10 +120,14 @@ public class TilePaint extends AEBaseTile
private void maxLit()
{
if( this.isLit > 14 )
{
this.isLit = 14;
}
if( this.worldObj != null )
{
this.worldObj.updateLightByType( EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord );
}
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -134,12 +146,16 @@ public class TilePaint extends AEBaseTile
public void onNeighborBlockChange()
{
if( this.dots == null )
{
return;
}
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
if( !this.isSideValid( side ) )
{
this.removeSide( side );
}
}
this.updateData();
@@ -158,7 +174,9 @@ public class TilePaint extends AEBaseTile
{
Splotch s = i.next();
if( s.side == side )
{
i.remove();
}
}
this.markForUpdate();
@@ -179,16 +197,22 @@ public class TilePaint extends AEBaseTile
this.maxLit();
if( this.dots.isEmpty() )
{
this.dots = null;
}
if( this.dots == null )
{
this.worldObj.setBlock( this.xCoord, this.yCoord, this.zCoord, Blocks.air );
}
}
public void cleanSide( ForgeDirection side )
{
if( this.dots == null )
{
return;
}
this.removeSide( side );
@@ -211,14 +235,20 @@ public class TilePaint extends AEBaseTile
boolean lit = ipb.isLumen( type );
if( this.dots == null )
{
this.dots = new ArrayList<Splotch>();
}
if( this.dots.size() > 20 )
{
this.dots.remove( 0 );
}
this.dots.add( new Splotch( col, lit, side, hitVec ) );
if( lit )
{
this.isLit += LIGHT_PER_DOT;
}
this.maxLit();
this.markForUpdate();
@@ -229,7 +259,9 @@ public class TilePaint extends AEBaseTile
public Collection<Splotch> getDots()
{
if( this.dots == null )
{
return ImmutableList.of();
}
return this.dots;
}
@@ -98,7 +98,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
this.securityKey = System.currentTimeMillis() * 10 + difference;
if( difference > 10 )
{
difference = 0;
}
this.cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
this.cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
@@ -115,10 +117,14 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
public void getDrops( World w, int x, int y, int z, ArrayList<ItemStack> drops )
{
if( !this.configSlot.isEmpty() )
{
drops.add( this.configSlot.getStackInSlot( 0 ) );
}
for( IAEItemStack ais : this.inventory.storedItems )
{
drops.add( ais.getItemStack() );
}
}
IMEInventoryHandler<IAEItemStack> getSecurityInventory()
@@ -173,7 +179,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
{
this.cm.readFromNBT( data );
if( data.hasKey( "paintedColor" ) )
{
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
}
this.securityKey = data.getLong( "securityKey" );
this.configSlot.readFromNBT( data, "config" );
@@ -342,7 +350,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
{
if( this.paintedColor == newPaintedColor )
{
return false;
}
this.paintedColor = newPaintedColor;
this.markDirty();
@@ -157,7 +157,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{
int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
{
return true;
}
}
return false;
}
@@ -172,7 +174,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
public TickingRequest getTickingRequest( IGridNode node )
{
if( this.burnTime <= 0 )
{
this.eatFuel();
}
return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, this.burnTime <= 0, false );
}
@@ -185,7 +189,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
this.eatFuel();
if( this.burnTime > 0 )
{
return TickRateModulation.URGENT;
}
this.burnSpeed = 100;
return TickRateModulation.SLEEP;
@@ -212,9 +218,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE );
if( overFlow > 0 )
{
this.burnSpeed -= TicksSinceLastCall;
}
else
{
this.burnSpeed += TicksSinceLastCall;
}
this.burnSpeed = Math.max( 20, Math.min( this.burnSpeed, 200 ) );
return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER;
@@ -243,12 +253,16 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
ItemStack container = null;
if( is.getItem().hasContainerItem( is ) )
{
container = is.getItem().getContainerItem( is );
}
this.setInventorySlotContents( 0, container );
}
else
{
this.setInventorySlotContents( 0, is );
}
}
}