Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
@@ -85,6 +85,51 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
return this.breakBlock( true );
}
@Override
public void getBoxes( IPartCollisionHelper bch )
{
int minX = 1;
int minY = 1;
int maxX = 15;
int maxY = 15;
final IPartHost host = this.getHost();
if( host != null )
{
final TileEntity te = host.getTile();
final int x = te.xCoord;
final int y = te.yCoord;
final int z = te.zCoord;
final ForgeDirection e = bch.getWorldX();
final ForgeDirection u = bch.getWorldY();
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
{
minX = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
{
maxX = 16;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
{
minY = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
{
maxY = 16;
}
}
bch.addBox( 5, 5, 14, 11, 11, 15 );
bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 );
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
@@ -112,22 +157,22 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final TileEntity te = this.getHost().getTile();
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
{
minX = 0;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
{
maxX = 16;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
{
minY = 0;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
{
maxY = 16;
}
@@ -148,16 +193,6 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
this.renderLights( x, y, z, rh, renderer );
}
private boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
{
if ( blockTileEntity instanceof IPartHost )
{
final IPart p = ( (IPartHost) blockTileEntity ).getPart( side );
return p instanceof PartAnnihilationPlane;
}
return false;
}
@Override
public void onNeighborChanged()
{
@@ -166,7 +201,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
this.proxy.getTick().alertDevice( this.proxy.getNode() );
}
catch ( final GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -175,19 +210,19 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
public void onEntityCollision( Entity entity )
{
if ( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() )
if( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() )
{
boolean capture = false;
switch ( this.side )
switch( this.side )
{
case DOWN:
case UP:
if ( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
if( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
{
if ( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
if( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
{
if ( ( entity.posY > this.tile.yCoord + 0.9 && this.side == ForgeDirection.UP ) || ( entity.posY < this.tile.yCoord + 0.1 && this.side == ForgeDirection.DOWN ) )
if( ( entity.posY > this.tile.yCoord + 0.9 && this.side == ForgeDirection.UP ) || ( entity.posY < this.tile.yCoord + 0.1 && this.side == ForgeDirection.DOWN ) )
{
capture = true;
}
@@ -196,11 +231,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
break;
case SOUTH:
case NORTH:
if ( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
if( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
{
if ( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
if( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
{
if ( ( entity.posZ > this.tile.zCoord + 0.9 && this.side == ForgeDirection.SOUTH ) || ( entity.posZ < this.tile.zCoord + 0.1 && this.side == ForgeDirection.NORTH ) )
if( ( entity.posZ > this.tile.zCoord + 0.9 && this.side == ForgeDirection.SOUTH ) || ( entity.posZ < this.tile.zCoord + 0.1 && this.side == ForgeDirection.NORTH ) )
{
capture = true;
}
@@ -209,11 +244,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
break;
case EAST:
case WEST:
if ( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
if( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
{
if ( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
if( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
{
if ( ( entity.posX > this.tile.xCoord + 0.9 && this.side == ForgeDirection.EAST ) || ( entity.posX < this.tile.xCoord + 0.1 && this.side == ForgeDirection.WEST ) )
if( ( entity.posX > this.tile.xCoord + 0.9 && this.side == ForgeDirection.EAST ) || ( entity.posX < this.tile.xCoord + 0.1 && this.side == ForgeDirection.WEST ) )
{
capture = true;
}
@@ -225,7 +260,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
break;
}
if ( capture )
if( capture )
{
ServerHelper.proxy.sendToAllNearExcept( null, this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, 64, this.tile.getWorldObj(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.side, false ) );
this.storeEntityItem( (EntityItem) entity );
@@ -233,69 +268,12 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
}
@Override
public void getBoxes( IPartCollisionHelper bch )
{
int minX = 1;
int minY = 1;
int maxX = 15;
int maxY = 15;
final IPartHost host = this.getHost();
if ( host != null )
{
final TileEntity te = host.getTile();
final int x = te.xCoord;
final int y = te.yCoord;
final int z = te.zCoord;
final ForgeDirection e = bch.getWorldX();
final ForgeDirection u = bch.getWorldY();
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
{
minX = 0;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
{
maxX = 16;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
{
minY = 0;
}
if ( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
{
maxY = 16;
}
}
bch.addBox( 5, 5, 14, 11, 11, 15 );
bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 );
}
@Override
public int cableConnectionRenderTo()
{
return 1;
}
/**
* If the plane is accepting items.
*
* This might be improved if a performance problem shows up.
*
* @return true if planes accepts items.
*/
private boolean isAccepting()
{
return this.isAccepting;
}
/**
* Stores an {@link EntityItem} inside the network and either marks it as dead or sets it to the leftover stackSize.
*
@@ -303,7 +281,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
*/
private void storeEntityItem( EntityItem entityItem )
{
if ( !entityItem.isDead )
if( !entityItem.isDead )
{
this.storeItemStack( entityItem.getEntityItem() );
entityItem.setDead();
@@ -328,7 +306,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
this.isAccepting = overflow == null;
}
catch ( final GridAccessException e1 )
catch( final GridAccessException e1 )
{
// :P
}
@@ -336,7 +314,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
private void spawnOverflowItemStack( IAEItemStack overflow )
{
if ( overflow == null )
if( overflow == null )
{
return;
}
@@ -351,6 +329,28 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
Platform.spawnDrops( world, x, y, z, Lists.newArrayList( overflow.getItemStack() ) );
}
private boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
{
if( blockTileEntity instanceof IPartHost )
{
final IPart p = ( (IPartHost) blockTileEntity ).getPart( side );
return p instanceof PartAnnihilationPlane;
}
return false;
}
/**
* If the plane is accepting items.
*
* This might be improved if a performance problem shows up.
*
* @return true if planes accepts items.
*/
private boolean isAccepting()
{
return this.isAccepting;
}
@Override
@MENetworkEventSubscribe
public void chanRender( MENetworkChannelsChanged c )
@@ -369,7 +369,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
public TickRateModulation breakBlock( boolean modulate )
{
if ( this.isAccepting && this.proxy.isActive() )
if( this.isAccepting && this.proxy.isActive() )
{
try
{
@@ -387,16 +387,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final Material mat = blk.getMaterial();
final boolean ignore = mat == Material.air || mat == Material.lava || mat == Material.water || mat.isLiquid() || blk == Blocks.bedrock || blk == Blocks.end_portal || blk == Blocks.end_portal_frame || blk == Blocks.command_block;
if ( !ignore && !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
if( !ignore && !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
{
final float hardness = blk.getBlockHardness( w, x, y, z );
if ( hardness >= 0.0 )
if( hardness >= 0.0 )
{
final ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
float total = 1 + hardness;
for ( final ItemStack is : out )
for( final ItemStack is : out )
{
total += is.stackSize;
}
@@ -404,24 +404,24 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final boolean hasPower = energy.extractAEPower( total, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > total - 0.1;
final boolean canStore = this.canStoreItemStacks( out );
if ( hasPower && canStore )
if( hasPower && canStore )
{
if ( modulate )
if( modulate )
{
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
for ( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if ( ei instanceof EntityItem )
if( ei instanceof EntityItem )
{
final EntityItem entityItem = (EntityItem) ei;
this.storeEntityItem( entityItem );
}
}
for ( final ItemStack snaggedItem : out )
for( final ItemStack snaggedItem : out )
{
this.storeItemStack( snaggedItem );
}
@@ -438,7 +438,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
}
}
catch ( final GridAccessException e1 )
catch( final GridAccessException e1 )
{
// :P
}
@@ -457,7 +457,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall )
{
if ( this.breaking )
if( this.breaking )
{
return TickRateModulation.URGENT;
}
@@ -483,17 +483,17 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
final IStorageGrid storage = this.proxy.getStorage();
for ( final ItemStack itemStack : itemStacks )
for( final ItemStack itemStack : itemStacks )
{
final IAEItemStack itemToTest = AEItemStack.create( itemStack );
final IAEItemStack overflow = storage.getItemInventory().injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
if ( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
if( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
{
canStore = true;
}
}
}
catch ( final GridAccessException e )
catch( final GridAccessException e )
{
// :P
}