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
@@ -50,14 +50,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
this.setFeature( EnumSet.of( AEFeature.Security ) );
this.setMaxStackSize( 1 );
if ( Platform.isClient() )
if( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() );
}
@Override
public ItemStack onItemRightClick( ItemStack is, World w, EntityPlayer p )
{
if ( p.isSneaking() )
if( p.isSneaking() )
{
this.encode( is, p );
p.swingItem();
@@ -70,9 +70,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public boolean itemInteractionForEntity( ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target )
{
if ( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
if( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
{
if ( par2EntityPlayer.capabilities.isCreativeMode )
if( par2EntityPlayer.capabilities.isCreativeMode )
is = par2EntityPlayer.getCurrentEquippedItem();
this.encode( is, (EntityPlayer) target );
par2EntityPlayer.swingItem();
@@ -92,7 +92,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
GameProfile username = this.getProfile( is );
if ( username != null && username.equals( p.getGameProfile() ) )
if( username != null && username.equals( p.getGameProfile() ) )
this.setProfile( is, null );
else
this.setProfile( is, p.getGameProfile() );
@@ -103,7 +103,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
if ( profile != null )
if( profile != null )
{
NBTTagCompound pNBT = new NBTTagCompound();
NBTUtil.func_152460_a( pNBT, profile );
@@ -117,7 +117,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
public GameProfile getProfile( ItemStack is )
{
NBTTagCompound tag = Platform.openNbtData( is );
if ( tag.hasKey( "profile" ) )
if( tag.hasKey( "profile" ) )
return NBTUtil.func_152459_a( tag.getCompoundTag( "profile" ) );
return null;
}
@@ -128,9 +128,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
NBTTagCompound tag = Platform.openNbtData( is );
EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
for ( SecurityPermissions sp : SecurityPermissions.values() )
for( SecurityPermissions sp : SecurityPermissions.values() )
{
if ( tag.getBoolean( sp.name() ) )
if( tag.getBoolean( sp.name() ) )
result.add( sp );
}
@@ -148,7 +148,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
public void removePermission( ItemStack itemStack, SecurityPermissions permission )
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
if ( tag.hasKey( permission.name() ) )
if( tag.hasKey( permission.name() ) )
tag.removeTag( permission.name() );
}
@@ -169,15 +169,15 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
if ( perms.isEmpty() )
if( perms.isEmpty() )
lines.add( GuiText.NoPermissions.getLocal() );
else
{
String msg = null;
for ( SecurityPermissions sp : perms )
for( SecurityPermissions sp : perms )
{
if ( msg == null )
if( msg == null )
msg = Platform.gui_localize( sp.getUnlocalizedName() );
else
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
@@ -51,7 +51,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
NBTTagCompound data = this.getData( stack );
if ( data.hasKey( "tooltip" ) )
if( data.hasKey( "tooltip" ) )
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
}
@@ -64,14 +64,14 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
*/
private String getLocalizedName( String... name )
{
for ( String n : name )
for( String n : name )
{
String l = StatCollector.translateToLocal( n );
if ( !l.equals( n ) )
if( !l.equals( n ) )
return l;
}
for ( String n : name )
for( String n : name )
return n;
return "";
@@ -98,7 +98,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
NBTTagCompound c = Platform.openNbtData( is );
NBTTagCompound o = c.getCompoundTag( "Data" );
if ( o == null )
if( o == null )
o = new NBTTagCompound();
return (NBTTagCompound) o.copy();
}
@@ -106,10 +106,10 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
@Override
public void notifyUser( EntityPlayer player, MemoryCardMessages msg )
{
if ( Platform.isClient() )
if( Platform.isClient() )
return;
switch ( msg )
switch( msg )
{
case SETTINGS_CLEARED:
player.addChatMessage( PlayerMessages.SettingCleared.get() );
@@ -130,7 +130,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
@Override
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hx, float hy, float hz )
{
if ( player.isSneaking() && !w.isRemote )
if( player.isSneaking() && !w.isRemote )
{
IMemoryCard mem = (IMemoryCard) is.getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
@@ -59,7 +59,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
public ToolNetworkTool()
{
super( Optional.<String> absent() );
super( Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.NetworkTool ) );
this.setMaxStackSize( 1 );
@@ -70,17 +70,17 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
public IGuiItemObject getGuiObject( ItemStack is, World world, int x, int y, int z )
{
TileEntity te = world.getTileEntity( x, y, z );
return new NetworkToolViewer( is, ( IGridHost ) ( te instanceof IGridHost ? te : null ) );
return new NetworkToolViewer( is, (IGridHost) ( te instanceof IGridHost ? te : null ) );
}
@Override
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
{
if ( Platform.isClient() )
if( Platform.isClient() )
{
MovingObjectPosition mop = ClientHelper.proxy.getMOP();
if ( mop == null )
if( mop == null )
{
this.onItemUseFirst( it, p, w, 0, 0, 0, -1, 0, 0, 0 );
}
@@ -90,7 +90,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
int j = mop.blockY;
int k = mop.blockZ;
if ( w.getBlock( i, j, k ).isAir( w, i, j, k ) )
if( w.getBlock( i, j, k ).isAir( w, i, j, k ) )
this.onItemUseFirst( it, p, w, 0, 0, 0, -1, 0, 0, 0 );
}
}
@@ -103,21 +103,21 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
{
MovingObjectPosition mop = new MovingObjectPosition( x, y, z, side, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
TileEntity te = world.getTileEntity( x, y, z );
if ( te instanceof IPartHost )
if( te instanceof IPartHost )
{
SelectedPart part = ( ( IPartHost ) te ).selectPart( mop.hitVec );
if ( part.part != null )
SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
if( part.part != null )
{
if ( part.part instanceof INetworkToolAgent && !( ( INetworkToolAgent ) part.part ).showNetworkInfo( mop ) )
if( part.part instanceof INetworkToolAgent && !( (INetworkToolAgent) part.part ).showNetworkInfo( mop ) )
return false;
}
}
else if ( te instanceof INetworkToolAgent && !( ( INetworkToolAgent ) te ).showNetworkInfo( mop ) )
else if( te instanceof INetworkToolAgent && !( (INetworkToolAgent) te ).showNetworkInfo( mop ) )
{
return false;
}
if ( Platform.isClient() )
if( Platform.isClient() )
{
NetworkHandler.instance.sendToServer( new PacketClick( x, y, z, side, hitX, hitY, hitZ ) );
}
@@ -132,18 +132,18 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
public boolean serverSideToolLogic( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( side >= 0 )
if( side >= 0 )
{
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return false;
Block b = w.getBlock( x, y, z );
if ( b != null && !p.isSneaking() )
if( b != null && !p.isSneaking() )
{
TileEntity te = w.getTileEntity( x, y, z );
if ( !( te instanceof IGridHost ) )
if( !( te instanceof IGridHost ) )
{
if ( b.rotateBlock( w, x, y, z, ForgeDirection.getOrientation( side ) ) )
if( b.rotateBlock( w, x, y, z, ForgeDirection.getOrientation( side ) ) )
{
b.onNeighborBlockChange( w, x, y, z, Platform.AIR );
p.swingItem();
@@ -152,14 +152,14 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
}
}
if ( !p.isSneaking() )
if( !p.isSneaking() )
{
if ( p.openContainer instanceof AEBaseContainer )
if( p.openContainer instanceof AEBaseContainer )
return true;
TileEntity te = w.getTileEntity( x, y, z );
if ( te instanceof IGridHost )
if( te instanceof IGridHost )
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
else
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
@@ -192,5 +192,4 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
{
player.swingItem();
}
}
@@ -40,23 +40,23 @@ public class ToolChargedStaff extends AEBasePoweredItem
public ToolChargedStaff()
{
super( AEConfig.instance.chargedStaffBattery, Optional.<String> absent() );
super( AEConfig.instance.chargedStaffBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.ChargedStaff, AEFeature.PoweredTools ) );
}
@Override
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
{
if ( this.getAECurrentPower( item ) > 300 )
if( this.getAECurrentPower( item ) > 300 )
{
this.extractAEPower( item, 300 );
if ( Platform.isServer() )
if( Platform.isServer() )
{
for ( int x = 0; x < 2; x++ )
for( int x = 0; x < 2; x++ )
{
float dx = ( float ) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
float dy = ( float ) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
float dz = ( float ) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
float dx = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
float dy = (float) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
float dz = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
}
}
@@ -87,21 +87,20 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static
{
for ( AEColor col : AEColor.values() )
for( AEColor col : AEColor.values() )
{
if ( col == AEColor.Transparent )
if( col == AEColor.Transparent )
continue;
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
}
}
public ToolColorApplicator()
{
super( AEConfig.instance.colorApplicatorBattery, Optional.<String> absent() );
super( AEConfig.instance.colorApplicatorBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) );
if ( Platform.isClient() )
if( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() );
}
@@ -121,11 +120,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ItemStack paintBall = this.getColor( is );
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
if ( inv != null )
if( inv != null )
{
IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
if ( option != null )
if( option != null )
{
paintBall = option.getItemStack();
paintBall.stackSize = 1;
@@ -133,19 +132,19 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
else
paintBall = null;
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return false;
if ( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
if( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
{
ForgeDirection orientation = ForgeDirection.getOrientation( side );
TileEntity te = w.getTileEntity( x, y, z );
// clean cables.
if ( te instanceof IColorableTile )
if( te instanceof IColorableTile )
{
if ( this.getAECurrentPower( is ) > powerPerUse && ( ( IColorableTile ) te ).getColor() != AEColor.Transparent )
if( this.getAECurrentPower( is ) > powerPerUse && ( (IColorableTile) te ).getColor() != AEColor.Transparent )
{
if ( ( ( IColorableTile ) te ).recolourBlock( orientation, AEColor.Transparent, p ) )
if( ( (IColorableTile) te ).recolourBlock( orientation, AEColor.Transparent, p ) )
{
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse );
@@ -157,33 +156,31 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
// clean paint balls..
Block testBlk = w.getBlock( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
TileEntity painted = w.getTileEntity( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
if ( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
{
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse );
( ( TilePaint ) painted ).cleanSide( orientation.getOpposite() );
( (TilePaint) painted ).cleanSide( orientation.getOpposite() );
return true;
}
}
else if ( paintBall != null )
else if( paintBall != null )
{
AEColor color = this.getColorFromItem( paintBall );
if ( color != null && this.getAECurrentPower( is ) > powerPerUse )
if( color != null && this.getAECurrentPower( is ) > powerPerUse )
{
if ( color != AEColor.Transparent
&& this.recolourBlock( blk, ForgeDirection.getOrientation( side ), w, x, y, z, ForgeDirection.getOrientation( side ), color, p ) )
if( color != AEColor.Transparent && this.recolourBlock( blk, ForgeDirection.getOrientation( side ), w, x, y, z, ForgeDirection.getOrientation( side ), color, p ) )
{
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse );
return true;
}
}
}
}
if ( p.isSneaking() )
if( p.isSneaking() )
{
this.cycleColors( is, paintBall, 1 );
}
@@ -198,7 +195,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
AEColor selected = this.getActiveColor( par1ItemStack );
if ( selected != null && Platform.isClient() )
if( selected != null && Platform.isClient() )
extra = Platform.gui_localize( selected.unlocalizedName );
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
@@ -211,24 +208,24 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public AEColor getColorFromItem( ItemStack paintBall )
{
if ( paintBall == null )
if( paintBall == null )
return null;
if ( paintBall.getItem() instanceof ItemSnowball )
if( paintBall.getItem() instanceof ItemSnowball )
return AEColor.Transparent;
if ( paintBall.getItem() instanceof ItemPaintBall )
if( paintBall.getItem() instanceof ItemPaintBall )
{
ItemPaintBall ipb = ( ItemPaintBall ) paintBall.getItem();
ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
return ipb.getColor( paintBall );
}
else
{
int[] id = OreDictionary.getOreIDs( paintBall );
for ( int oreID : id )
for( int oreID : id )
{
if ( ORE_TO_COLOR.containsKey( oreID ) )
if( ORE_TO_COLOR.containsKey( oreID ) )
return ORE_TO_COLOR.get( oreID );
}
}
@@ -239,11 +236,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public ItemStack getColor( ItemStack is )
{
NBTTagCompound c = is.getTagCompound();
if ( c != null && c.hasKey( "color" ) )
if( c != null && c.hasKey( "color" ) )
{
NBTTagCompound color = c.getCompoundTag( "color" );
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
if ( oldColor != null )
if( oldColor != null )
return oldColor;
}
@@ -255,56 +252,56 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ItemStack newColor = null;
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
if ( inv != null )
if( inv != null )
{
IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
if ( anchor == null )
if( anchor == null )
{
IAEItemStack firstItem = itemList.getFirstItem();
if ( firstItem != null )
if( firstItem != null )
newColor = firstItem.getItemStack();
}
else
{
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
for ( IAEItemStack i : itemList )
for( IAEItemStack i : itemList )
list.add( i );
Collections.sort( list, new Comparator<IAEItemStack>(){
Collections.sort( list, new Comparator<IAEItemStack>()
{
@Override
public int compare( IAEItemStack a, IAEItemStack b )
{
return ItemSorters.compareInt( a.getItemDamage(), b.getItemDamage() );
}
} );
if ( list.size() <= 0 )
if( list.size() <= 0 )
return null;
IAEItemStack where = list.getFirst();
int cycles = 1 + list.size();
while ( cycles > 0 && !where.equals( anchor ) )
while( cycles > 0 && !where.equals( anchor ) )
{
list.addLast( list.removeFirst() );
cycles--;
where = list.getFirst();
}
if ( scrollOffset > 0 )
if( scrollOffset > 0 )
list.addLast( list.removeFirst() );
if ( scrollOffset < 0 )
if( scrollOffset < 0 )
list.addFirst( list.removeLast() );
return list.get( 0 ).getItemStack();
}
}
if ( newColor != null )
if( newColor != null )
this.setColor( is, newColor );
return newColor;
@@ -313,7 +310,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public void setColor( ItemStack is, ItemStack newColor )
{
NBTTagCompound data = Platform.openNbtData( is );
if ( newColor == null )
if( newColor == null )
data.removeTag( "color" );
else
{
@@ -325,62 +322,62 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
private boolean recolourBlock( Block blk, ForgeDirection side, World w, int x, int y, int z, ForgeDirection orientation, AEColor newColor, EntityPlayer p )
{
if ( blk == Blocks.carpet )
if( blk == Blocks.carpet )
{
int meta = w.getBlockMetadata( x, y, z );
if ( newColor.ordinal() == meta )
if( newColor.ordinal() == meta )
return false;
return w.setBlock( x, y, z, Blocks.carpet, newColor.ordinal(), 3 );
}
if ( blk == Blocks.glass )
if( blk == Blocks.glass )
{
return w.setBlock( x, y, z, Blocks.stained_glass, newColor.ordinal(), 3 );
}
if ( blk == Blocks.stained_glass )
if( blk == Blocks.stained_glass )
{
int meta = w.getBlockMetadata( x, y, z );
if ( newColor.ordinal() == meta )
if( newColor.ordinal() == meta )
return false;
return w.setBlock( x, y, z, Blocks.stained_glass, newColor.ordinal(), 3 );
}
if ( blk == Blocks.glass_pane )
if( blk == Blocks.glass_pane )
{
return w.setBlock( x, y, z, Blocks.stained_glass_pane, newColor.ordinal(), 3 );
}
if ( blk == Blocks.stained_glass_pane )
if( blk == Blocks.stained_glass_pane )
{
int meta = w.getBlockMetadata( x, y, z );
if ( newColor.ordinal() == meta )
if( newColor.ordinal() == meta )
return false;
return w.setBlock( x, y, z, Blocks.stained_glass_pane, newColor.ordinal(), 3 );
}
if ( blk == Blocks.hardened_clay )
if( blk == Blocks.hardened_clay )
{
return w.setBlock( x, y, z, Blocks.stained_hardened_clay, newColor.ordinal(), 3 );
}
if ( blk == Blocks.stained_hardened_clay )
if( blk == Blocks.stained_hardened_clay )
{
int meta = w.getBlockMetadata( x, y, z );
if ( newColor.ordinal() == meta )
if( newColor.ordinal() == meta )
return false;
return w.setBlock( x, y, z, Blocks.stained_hardened_clay, newColor.ordinal(), 3 );
}
if ( blk instanceof BlockCableBus )
return ( ( BlockCableBus ) blk ).recolourBlock( w, x, y, z, side, newColor.ordinal(), p );
if( blk instanceof BlockCableBus )
return ( (BlockCableBus) blk ).recolourBlock( w, x, y, z, side, newColor.ordinal(), p );
return blk.recolourBlock( w, x, y, z, side, newColor.ordinal() );
}
public void cycleColors( ItemStack is, ItemStack paintBall, int i )
{
if ( paintBall == null )
if( paintBall == null )
{
this.setColor( is, this.getColor( is ) );
}
@@ -397,10 +394,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if ( cdi instanceof CellInventoryHandler )
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
@@ -429,17 +426,17 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
{
if ( requestedAddition != null )
if( requestedAddition != null )
{
int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
for ( int x : id )
for( int x : id )
{
if ( ORE_TO_COLOR.containsKey( x ) )
if( ORE_TO_COLOR.containsKey( x ) )
return false;
}
if ( requestedAddition.getItem() instanceof ItemSnowball )
if( requestedAddition.getItem() instanceof ItemSnowball )
return false;
return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
@@ -497,7 +494,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
return FuzzyMode.valueOf( fz );
}
catch ( Throwable t )
catch( Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
@@ -514,5 +511,4 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
this.cycleColors( is, this.getColor( is ), up ? 1 : -1 );
}
}
@@ -113,9 +113,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
@Override
public boolean equals( Object obj )
{
if ( obj == null )
if( obj == null )
return false;
if ( this.getClass() != obj.getClass() )
if( this.getClass() != obj.getClass() )
return false;
InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
return this.blockID == other.blockID && this.metadata == other.metadata;
@@ -126,12 +126,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if ( r == null )
if( r == null )
{
r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
}
if ( r.BlockItem != null )
if( r.BlockItem != null )
{
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
}
@@ -140,7 +140,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
}
if ( r.Drops != null )
if( r.Drops != null )
{
Platform.spawnDrops( w, x, y, z, r.Drops );
}
@@ -150,7 +150,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if ( r == null )
if( r == null )
{
r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
}
@@ -162,12 +162,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if ( r == null )
if( r == null )
{
r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
}
if ( r.BlockItem != null )
if( r.BlockItem != null )
{
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
}
@@ -176,7 +176,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
}
if ( r.Drops != null )
if( r.Drops != null )
{
Platform.spawnDrops( w, x, y, z, r.Drops );
}
@@ -186,7 +186,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
if ( r == null )
if( r == null )
{
r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
}
@@ -197,7 +197,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
@Override
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
{
if ( this.getAECurrentPower( item ) > 1600 )
if( this.getAECurrentPower( item ) > 1600 )
{
this.extractAEPower( item, 1600 );
target.setFire( 8 );
@@ -211,19 +211,19 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
if ( target == null )
if( target == null )
return item;
else
{
if ( target.typeOfHit == MovingObjectType.BLOCK )
if( target.typeOfHit == MovingObjectType.BLOCK )
{
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
if( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
{
if ( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
if( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
this.onItemUse( item, p, w, x, y, z, 0, 0.0F, 0.0F, 0.0F );
}
@@ -237,17 +237,17 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
@Override
public boolean onItemUse( ItemStack item, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( this.getAECurrentPower( item ) > 1600 )
if( this.getAECurrentPower( item ) > 1600 )
{
if ( !p.canPlayerEdit( x, y, z, side, item ) )
if( !p.canPlayerEdit( x, y, z, side, item ) )
return false;
Block blockID = w.getBlock( x, y, z );
int metadata = w.getBlockMetadata( x, y, z );
if ( p.isSneaking() )
if( p.isSneaking() )
{
if ( this.canCool( blockID, metadata ) )
if( this.canCool( blockID, metadata ) )
{
this.extractAEPower( item, 1600 );
this.cool( blockID, metadata, w, x, y, z );
@@ -256,21 +256,21 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
else
{
if ( blockID instanceof BlockTNT )
if( blockID instanceof BlockTNT )
{
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
( (BlockTNT) blockID ).func_150114_a( w, x, y, z, 1, p );
return true;
}
if ( blockID instanceof BlockTinyTNT )
if( blockID instanceof BlockTinyTNT )
{
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
( (BlockTinyTNT) blockID ).startFuse( w, x, y, z, p );
return true;
}
if ( this.canHeat( blockID, metadata ) )
if( this.canHeat( blockID, metadata ) )
{
this.extractAEPower( item, 1600 );
this.heat( blockID, metadata, w, x, y, z );
@@ -282,15 +282,15 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
boolean hasFurnaceable = false;
boolean canFurnaceable = true;
for ( ItemStack i : stack )
for( ItemStack i : stack )
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult( i );
if ( result != null )
if( result != null )
{
if ( result.getItem() instanceof ItemBlock )
if( result.getItem() instanceof ItemBlock )
{
if ( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == metadata )
if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == metadata )
{
canFurnaceable = false;
}
@@ -305,13 +305,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
}
if ( hasFurnaceable && canFurnaceable )
if( hasFurnaceable && canFurnaceable )
{
this.extractAEPower( item, 1600 );
InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
if ( or.BlockItem == null )
if( or.BlockItem == null )
{
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
}
@@ -320,7 +320,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
w.setBlock( x, y, z, Block.getBlockFromItem( or.BlockItem.getItem() ), or.BlockItem.getItemDamage(), 3 );
}
if ( or.Drops != null )
if( or.Drops != null )
{
Platform.spawnDrops( w, x, y, z, or.Drops );
}
@@ -334,10 +334,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
y += dir.offsetY;
z += dir.offsetZ;
if ( !p.canPlayerEdit( x, y, z, side, item ) )
if( !p.canPlayerEdit( x, y, z, side, item ) )
return false;
if ( w.isAirBlock( x, y, z ) )
if( w.isAirBlock( x, y, z ) )
{
this.extractAEPower( item, 1600 );
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
@@ -83,7 +83,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
public ToolMassCannon()
{
super( AEConfig.instance.matterCannonBattery, Optional.<String> absent() );
super( AEConfig.instance.matterCannonBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
}
@@ -101,10 +101,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if ( cdi instanceof CellInventoryHandler )
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
@@ -115,37 +115,37 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
{
if ( this.getAECurrentPower( item ) > 1600 )
if( this.getAECurrentPower( item ) > 1600 )
{
int shots = 1;
CellUpgrades cu = ( CellUpgrades ) this.getUpgradesInventory( item );
if ( cu != null )
CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
if( cu != null )
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
if ( inv != null )
if( inv != null )
{
IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
IAEStack aeAmmo = itemList.getFirstItem();
if ( aeAmmo instanceof IAEItemStack )
if( aeAmmo instanceof IAEItemStack )
{
shots = Math.min( shots, ( int ) aeAmmo.getStackSize() );
for ( int sh = 0; sh < shots; sh++ )
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
for( int sh = 0; sh < shots; sh++ )
{
this.extractAEPower( item, 1600 );
if ( Platform.isClient() )
if( Platform.isClient() )
return item;
aeAmmo.setStackSize( 1 );
ItemStack ammo = ( ( IAEItemStack ) aeAmmo ).getItemStack();
if ( ammo == null )
ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null )
return item;
ammo.stackSize = 1;
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if ( aeAmmo == null )
if( aeAmmo == null )
return item;
float f = 1.0F;
@@ -155,8 +155,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
double d1 = p.prevPosY + ( p.posY - p.prevPosY ) * f + 1.62D - p.yOffset;
double d2 = p.prevPosZ + ( p.posZ - p.prevPosZ ) * f;
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
float f3 = MathHelper.cos( -f2 * 0.017453292F - ( float ) Math.PI );
float f4 = MathHelper.sin( -f2 * 0.017453292F - ( float ) Math.PI );
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
float f5 = -MathHelper.cos( -f1 * 0.017453292F );
float f6 = MathHelper.sin( -f1 * 0.017453292F );
float f7 = f4 * f5;
@@ -168,10 +168,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
direction.normalize();
float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if ( penetration <= 0 )
if( penetration <= 0 )
{
ItemStack type = ( ( IAEItemStack ) aeAmmo ).getItemStack();
if ( type.getItem() instanceof ItemPaintBall )
ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
if( type.getItem() instanceof ItemPaintBall )
{
this.shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
}
@@ -181,12 +181,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
this.standardAmmo( penetration, w, p, vec3, vec31, direction, d0, d1, d2 );
}
}
}
else
{
if ( Platform.isServer() )
if( Platform.isServer() )
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
return item;
}
@@ -197,25 +196,23 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
private void shootPaintBalls( ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
{
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ),
Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
Entity entity = null;
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
int l;
for ( l = 0; l < list.size(); ++l )
for( l = 0; l < list.size(); ++l )
{
Entity entity1 = ( Entity ) list.get( l );
Entity entity1 = (Entity) list.get( l );
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
if ( entity1.isEntityAlive() )
if( entity1.isEntityAlive() )
{
// prevent killing / flying of mounts.
if ( entity1.riddenByEntity == p )
if( entity1.riddenByEntity == p )
continue;
float f1 = 0.3F;
@@ -223,11 +220,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
if ( movingObjectPosition != null )
if( movingObjectPosition != null )
{
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
if ( nd < closest )
if( nd < closest )
{
entity = entity1;
closest = nd;
@@ -240,49 +237,47 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, false );
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
{
pos = new MovingObjectPosition( entity );
}
else if ( entity != null && pos == null )
else if( entity != null && pos == null )
{
pos = new MovingObjectPosition( entity );
}
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, ( float ) direction.xCoord,
( float ) direction.yCoord, ( float ) direction.zCoord, ( byte ) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch ( Exception err )
catch( Exception err )
{
AELog.error( err );
}
if ( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
{
ItemPaintBall ipb = ( ItemPaintBall ) type.getItem();
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
if ( pos.typeOfHit == MovingObjectType.ENTITY )
if( pos.typeOfHit == MovingObjectType.ENTITY )
{
int id = pos.entityHit.getEntityId();
PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
if ( pos.entityHit instanceof EntitySheep )
if( pos.entityHit instanceof EntitySheep )
{
EntitySheep sh = ( EntitySheep ) pos.entityHit;
EntitySheep sh = (EntitySheep) pos.entityHit;
sh.setFleeceColor( col.ordinal() );
}
pos.entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
NetworkHandler.instance.sendToAll( marker.getPacket() );
}
else if ( pos.typeOfHit == MovingObjectType.BLOCK )
else if( pos.typeOfHit == MovingObjectType.BLOCK )
{
ForgeDirection side = ForgeDirection.getOrientation( pos.sideHit );
@@ -290,57 +285,54 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
int y = pos.blockY + side.offsetY;
int z = pos.blockZ + side.offsetZ;
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return;
Block whatsThere = w.getBlock( x, y, z );
if ( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
if( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
{
for ( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
for( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
{
w.setBlock( x, y, z, paintBlock, 0, 3 );
}
}
TileEntity te = w.getTileEntity( x, y, z );
if ( te instanceof TilePaint )
if( te instanceof TilePaint )
{
pos.hitVec.xCoord -= x;
pos.hitVec.yCoord -= y;
pos.hitVec.zCoord -= z;
( ( TilePaint ) te ).addBlot( type, side.getOpposite(), pos.hitVec );
( (TilePaint) te ).addBlot( type, side.getOpposite(), pos.hitVec );
}
}
}
}
private void standardAmmo( float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
{
boolean hasDestroyedSomething = true;
while ( penetration > 0 && hasDestroyedSomething )
while( penetration > 0 && hasDestroyedSomething )
{
hasDestroyedSomething = false;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ),
Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
Entity entity = null;
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
int l;
for ( l = 0; l < list.size(); ++l )
for( l = 0; l < list.size(); ++l )
{
Entity entity1 = ( Entity ) list.get( l );
Entity entity1 = (Entity) list.get( l );
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
if ( entity1.isEntityAlive() )
if( entity1.isEntityAlive() )
{
// prevent killing / flying of mounts.
if ( entity1.riddenByEntity == p )
if( entity1.riddenByEntity == p )
continue;
float f1 = 0.3F;
@@ -348,11 +340,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
if ( movingObjectPosition != null )
if( movingObjectPosition != null )
{
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
if ( nd < closest )
if( nd < closest )
{
entity = entity1;
closest = nd;
@@ -364,58 +356,56 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
{
pos = new MovingObjectPosition( entity );
}
else if ( entity != null && pos == null )
else if( entity != null && pos == null )
{
pos = new MovingObjectPosition( entity );
}
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, ( float ) direction.xCoord,
( float ) direction.yCoord, ( float ) direction.zCoord, ( byte ) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch ( Exception err )
catch( Exception err )
{
AELog.error( err );
}
if ( pos != null )
if( pos != null )
{
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
dmgSrc.damageType = "masscannon";
if ( pos.typeOfHit == MovingObjectType.ENTITY )
if( pos.typeOfHit == MovingObjectType.ENTITY )
{
int dmg = ( int ) Math.ceil( penetration / 20.0f );
if ( pos.entityHit instanceof EntityLivingBase )
int dmg = (int) Math.ceil( penetration / 20.0f );
if( pos.entityHit instanceof EntityLivingBase )
{
EntityLivingBase el = ( EntityLivingBase ) pos.entityHit;
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
penetration -= dmg;
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
// el.knockBack( p, 0, vec3.xCoord,
// vec3.zCoord );
el.attackEntityFrom( dmgSrc, dmg );
if ( !el.isEntityAlive() )
if( !el.isEntityAlive() )
hasDestroyedSomething = true;
}
else if ( pos.entityHit instanceof EntityItem )
else if( pos.entityHit instanceof EntityItem )
{
hasDestroyedSomething = true;
pos.entityHit.setDead();
}
else if ( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
{
hasDestroyedSomething = true;
}
}
else if ( pos.typeOfHit == MovingObjectType.BLOCK )
else if( pos.typeOfHit == MovingObjectType.BLOCK )
{
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
if( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
penetration = 0;
else
{
@@ -424,9 +414,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
// pos.blockX, pos.blockY, pos.blockZ );
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
if ( hardness >= 0.0 )
if( hardness >= 0.0 )
{
if ( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
{
hasDestroyedSomething = true;
penetration -= hardness;
@@ -467,7 +457,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
return FuzzyMode.valueOf( fz );
}
catch ( Throwable t )
catch( Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
@@ -501,10 +491,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
{
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
if ( pen > 0 )
if( pen > 0 )
return false;
if ( requestedAddition.getItem() instanceof ItemPaintBall )
if( requestedAddition.getItem() instanceof ItemPaintBall )
return false;
return true;
@@ -61,17 +61,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
{
public ToolPortableCell()
{
super( AEConfig.instance.portableCellBattery, Optional.<String> absent() );
super( AEConfig.instance.portableCellBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) );
}
@SideOnly(Side.CLIENT)
@Override
public boolean isFull3D()
{
return false;
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
{
@@ -79,6 +72,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
return item;
}
@SideOnly( Side.CLIENT )
@Override
public boolean isFull3D()
{
return false;
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
@@ -86,10 +86,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if ( cdi instanceof CellInventoryHandler )
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
@@ -171,7 +171,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
{
return FuzzyMode.valueOf( fz );
}
catch ( Throwable t )
catch( Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
@@ -54,17 +54,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
public ToolWirelessTerminal()
{
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String> absent() );
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools ) );
}
@SideOnly(Side.CLIENT)
@Override
public boolean isFull3D()
{
return false;
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
{
@@ -72,19 +65,26 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
return item;
}
@SideOnly( Side.CLIENT )
@Override
public boolean isFull3D()
{
return false;
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
if ( stack.hasTagCompound() )
if( stack.hasTagCompound() )
{
NBTTagCompound tag = Platform.openNbtData( stack );
if ( tag != null )
if( tag != null )
{
String encKey = tag.getString( "encryptionKey" );
if ( encKey == null || encKey.isEmpty() )
if( encKey == null || encKey.isEmpty() )
lines.add( GuiText.Unlinked.getLocal() );
else
lines.add( GuiText.Linked.getLocal() );
@@ -115,7 +115,8 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public IConfigManager getConfigManager( final ItemStack target )
{
final ConfigManager out = new ConfigManager( new IConfigManagerHost(){
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
{
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
@@ -123,14 +124,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
}
} );
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( ( NBTTagCompound ) Platform.openNbtData( target ).copy() );
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
return out;
}
@@ -148,5 +148,4 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
tag.setString( "encryptionKey", encKey );
tag.setString( "name", name );
}
}
@@ -60,16 +60,14 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
double internalCurrentPower = 0;
double internalMaxPower = this.getAEMaxPower( stack );
if ( tag != null )
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
}
double percent = internalCurrentPower / internalMaxPower;
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
@Override
@@ -114,15 +112,50 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
{
NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
switch( op )
{
case INJECT:
currentStorage += adjustment;
if( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
data.setDouble( this.POWER_NBT_KEY, maxStorage );
return diff;
}
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return 0;
case EXTRACT:
if( currentStorage > adjustment )
{
currentStorage -= adjustment;
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return adjustment;
}
data.setDouble( this.POWER_NBT_KEY, 0 );
return currentStorage;
default:
break;
}
return currentStorage;
}
/**
* inject external
*/
double injectExternalPower( PowerUnits input, ItemStack is, double amount, boolean simulate )
{
if ( simulate )
if( simulate )
{
int requiredEU = ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if ( amount < requiredEU )
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if( amount < requiredEU )
return 0;
return amount - requiredEU;
}
@@ -145,41 +178,6 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
}
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
{
NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
switch ( op )
{
case INJECT:
currentStorage += adjustment;
if ( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
data.setDouble( this.POWER_NBT_KEY, maxStorage );
return diff;
}
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return 0;
case EXTRACT:
if ( currentStorage > adjustment )
{
currentStorage -= adjustment;
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return adjustment;
}
data.setDouble( this.POWER_NBT_KEY, 0 );
return currentStorage;
default:
break;
}
return currentStorage;
}
@Override
public double getAEMaxPower( ItemStack is )
{
@@ -202,5 +200,4 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
{
STORAGE, INJECT, EXTRACT
}
}
@@ -33,8 +33,7 @@ import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
{
public IC2( double powerCapacity, Optional<String> subName )
@@ -48,10 +47,10 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
double addedAmt = amount;
double limit = this.getTransferLimit( is );
if ( !ignoreTransferLimit && amount > limit )
if( !ignoreTransferLimit && amount > limit )
addedAmt = limit;
return addedAmt - ( ( int ) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
}
@Override
@@ -63,7 +62,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
@Override
public double getCharge( ItemStack is )
{
return ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
}
@Override
@@ -75,7 +74,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
@Override
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
{
if ( this.canUse( is, amount ) )
if( this.canUse( is, amount ) )
{
// use the power..
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
@@ -138,5 +137,4 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
{
return this;
}
}
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -54,7 +54,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
@Override
public boolean onItemUse( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int s, float hitX, float hitY, float hitZ )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
return true;
}
@@ -62,7 +62,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
@Override
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
p.swingItem();
return it;
@@ -104,5 +104,4 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
return new QuartzKnifeObj( is );
}
}
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -55,13 +55,13 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
public boolean onItemUseFirst( ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
Block b = world.getBlock( x, y, z );
if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
{
if ( Platform.isClient() )
if( Platform.isClient() )
return !world.isRemote;
ForgeDirection mySide = ForgeDirection.getOrientation( side );
if ( b.rotateBlock( world, x, y, z, mySide ) )
if( b.rotateBlock( world, x, y, z, mySide ) )
{
b.onNeighborBlockChange( world, x, y, z, Platform.AIR );
player.swingItem();
@@ -95,5 +95,4 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
{
player.swingItem();
}
}