final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
@@ -41,7 +41,7 @@ public abstract class AppEngPacket implements Packet
AppEngPacketHandlerBase.PacketTypes id;
private PacketBuffer p;
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
}
@@ -51,12 +51,12 @@ public abstract class AppEngPacket implements Packet
return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal();
}
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
}
protected void configureWrite( ByteBuf data )
protected void configureWrite( final ByteBuf data )
{
data.capacity( data.readableBytes() );
this.p = new PacketBuffer(data);
@@ -69,7 +69,7 @@ public abstract class AppEngPacket implements Packet
throw new IllegalArgumentException( "Sorry AE2 made a " + this.p.array().length + " byte packet by accident!" );
}
FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance.getChannel() );
final FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance.getChannel() );
if( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
{
@@ -80,23 +80,23 @@ public abstract class AppEngPacket implements Packet
}
@Override
public void readPacketData(PacketBuffer buf) throws IOException
public void readPacketData( final PacketBuffer buf) throws IOException
{
throw new RuntimeException( "Not Implemented" );
}
@Override
public void writePacketData(PacketBuffer buf) throws IOException
public void writePacketData( final PacketBuffer buf) throws IOException
{
throw new RuntimeException( "Not Implemented" );
}
PacketCallState caller;
public void setCallParam( PacketCallState call ){caller = call;}
public void setCallParam( final PacketCallState call ){caller = call;}
@Override
public void processPacket(INetHandler handler)
public void processPacket( final INetHandler handler)
{
caller.call(this);
}
@@ -110,7 +110,7 @@ public class AppEngPacketHandlerBase
private final Class<? extends AppEngPacket> packetClass;
private final Constructor<? extends AppEngPacket> packetConstructor;
PacketTypes( Class<? extends AppEngPacket> c )
PacketTypes( final Class<? extends AppEngPacket> c )
{
this.packetClass = c;
@@ -119,10 +119,10 @@ public class AppEngPacketHandlerBase
{
x = this.packetClass.getConstructor( ByteBuf.class );
}
catch( NoSuchMethodException ignored )
catch( final NoSuchMethodException ignored )
{
}
catch( SecurityException ignored )
catch( final SecurityException ignored )
{
}
@@ -135,17 +135,17 @@ public class AppEngPacketHandlerBase
}
}
public static PacketTypes getPacket( int id )
public static PacketTypes getPacket( final int id )
{
return ( values() )[id];
}
public static PacketTypes getID( Class<? extends AppEngPacket> c )
public static PacketTypes getID( final Class<? extends AppEngPacket> c )
{
return REVERSE_LOOKUP.get( c );
}
public AppEngPacket parsePacket( ByteBuf in ) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
public AppEngPacket parsePacket( final ByteBuf in ) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return this.packetConstructor.newInstance( in );
}
+53 -53
View File
@@ -203,7 +203,7 @@ public enum GuiBridge implements IGuiHandler
this.containerClass = null;
}
GuiBridge( Class containerClass, SecurityPermissions requiredPermission )
GuiBridge( final Class containerClass, final SecurityPermissions requiredPermission )
{
this.requiredPermission = requiredPermission;
this.containerClass = containerClass;
@@ -220,7 +220,7 @@ public enum GuiBridge implements IGuiHandler
if( Platform.isClient() )
{
final String start = this.containerClass.getName();
String guiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
final String guiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
if( start.equals( guiClass ) )
{
@@ -234,7 +234,7 @@ public enum GuiBridge implements IGuiHandler
}
}
GuiBridge( Class containerClass, Class tileClass, GuiHostType type, SecurityPermissions requiredPermission )
GuiBridge( final Class containerClass, final Class tileClass, final GuiHostType type, final SecurityPermissions requiredPermission )
{
this.requiredPermission = requiredPermission;
this.containerClass = containerClass;
@@ -244,11 +244,11 @@ public enum GuiBridge implements IGuiHandler
}
@Override
public Object getServerGuiElement( int ordinal, EntityPlayer player, World w, int x, int y, int z )
public Object getServerGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z )
{
AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
GuiBridge ID = values()[ordinal >> 4];
boolean stem = ( ( ordinal >> 3 ) & 1 ) == 1;
final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
final GuiBridge ID = values()[ordinal >> 4];
final boolean stem = ( ( ordinal >> 3 ) & 1 ) == 1;
if( ID.type.isItem() )
{
ItemStack it = null;
@@ -260,7 +260,7 @@ public enum GuiBridge implements IGuiHandler
{
it = player.inventory.getStackInSlot( x );
}
Object myItem = this.getGuiObject( it, player, w, x, y, z );
final Object myItem = this.getGuiObject( it, player, w, x, y, z );
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
{
return this.updateGui( ID.ConstructContainer( player.inventory, side, myItem ), w, x, y, z, side, myItem );
@@ -268,11 +268,11 @@ public enum GuiBridge implements IGuiHandler
}
if( ID.type.isTile() )
{
TileEntity TE = w.getTileEntity( new BlockPos(x,y,z) );
final TileEntity TE = w.getTileEntity( new BlockPos(x,y,z) );
if( TE instanceof IPartHost )
{
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
final IPart part = ( (IPartHost) TE ).getPart( side );
if( ID.CorrectTileOrPart( part ) )
{
return this.updateGui( ID.ConstructContainer( player.inventory, side, part ), w, x, y, z, side, part );
@@ -289,7 +289,7 @@ public enum GuiBridge implements IGuiHandler
return new ContainerNull();
}
private Object getGuiObject( ItemStack it, EntityPlayer player, World w, int x, int y, int z )
private Object getGuiObject( final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z )
{
if( it != null )
{
@@ -298,7 +298,7 @@ public enum GuiBridge implements IGuiHandler
return ( (IGuiItem) it.getItem() ).getGuiObject( it, w, new BlockPos(x,y,z) );
}
IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler( it );
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler( it );
if( wh != null )
{
return new WirelessTerminalGuiObject( wh, it, player, w, x, y, z );
@@ -308,7 +308,7 @@ public enum GuiBridge implements IGuiHandler
return null;
}
public boolean CorrectTileOrPart( Object tE )
public boolean CorrectTileOrPart( final Object tE )
{
if( this.tileClass == null )
{
@@ -318,11 +318,11 @@ public enum GuiBridge implements IGuiHandler
return this.tileClass.isInstance( tE );
}
private Object updateGui( Object newContainer, World w, int x, int y, int z, AEPartLocation side, Object myItem )
private Object updateGui( final Object newContainer, final World w, final int x, final int y, final int z, final AEPartLocation side, final Object myItem )
{
if( newContainer instanceof AEBaseContainer )
{
AEBaseContainer bc = (AEBaseContainer) newContainer;
final AEBaseContainer bc = (AEBaseContainer) newContainer;
bc.openContext = new ContainerOpenContext( myItem );
bc.openContext.w = w;
bc.openContext.x = x;
@@ -334,36 +334,36 @@ public enum GuiBridge implements IGuiHandler
return newContainer;
}
public Object ConstructContainer( InventoryPlayer inventory, AEPartLocation side, Object tE )
public Object ConstructContainer( final InventoryPlayer inventory, final AEPartLocation side, final Object tE )
{
try
{
Constructor[] c = this.containerClass.getConstructors();
final Constructor[] c = this.containerClass.getConstructors();
if( c.length == 0 )
{
throw new AppEngException( "Invalid Gui Class" );
}
Constructor target = this.findConstructor( c, inventory, tE );
final Constructor target = this.findConstructor( c, inventory, tE );
if( target == null )
{
throw new IllegalStateException( "Cannot find " + this.containerClass.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
}
Object o = target.newInstance( inventory, tE );
final Object o = target.newInstance( inventory, tE );
/**
* triggers achievement when the player sees presses.
*/
if( o instanceof AEBaseContainer )
{
AEBaseContainer bc = (AEBaseContainer) o;
for( Object so : bc.inventorySlots )
final AEBaseContainer bc = (AEBaseContainer) o;
for( final Object so : bc.inventorySlots )
{
if( so instanceof Slot )
{
ItemStack is = ( (Slot) so ).getStack();
final ItemStack is = ( (Slot) so ).getStack();
final IMaterials materials = AEApi.instance().definitions().materials();
this.addPressAchievementToPlayer( is, materials, inventory.player );
@@ -373,17 +373,17 @@ public enum GuiBridge implements IGuiHandler
return o;
}
catch( Throwable t )
catch( final Throwable t )
{
throw new IllegalStateException( t );
}
}
private Constructor findConstructor( Constructor[] c, InventoryPlayer inventory, Object tE )
private Constructor findConstructor( final Constructor[] c, final InventoryPlayer inventory, final Object tE )
{
for( Constructor con : c )
for( final Constructor con : c )
{
Class[] types = con.getParameterTypes();
final Class[] types = con.getParameterTypes();
if( types.length == 2 )
{
if( types[0].isAssignableFrom( inventory.getClass() ) && types[1].isAssignableFrom( tE.getClass() ) )
@@ -395,7 +395,7 @@ public enum GuiBridge implements IGuiHandler
return null;
}
private String typeName( Object inventory )
private String typeName( final Object inventory )
{
if( inventory == null )
{
@@ -405,7 +405,7 @@ public enum GuiBridge implements IGuiHandler
return inventory.getClass().getName();
}
private void addPressAchievementToPlayer( ItemStack newItem, IMaterials possibleMaterials, EntityPlayer player )
private void addPressAchievementToPlayer( final ItemStack newItem, final IMaterials possibleMaterials, final EntityPlayer player )
{
final IComparableDefinition logic = possibleMaterials.logicProcessorPress();
final IComparableDefinition eng = possibleMaterials.engProcessorPress();
@@ -414,7 +414,7 @@ public enum GuiBridge implements IGuiHandler
final List<IComparableDefinition> presses = Lists.newArrayList( logic, eng, calc, silicon );
for( IComparableDefinition press : presses )
for( final IComparableDefinition press : presses )
{
if( press.isSameAs( newItem ) )
{
@@ -426,11 +426,11 @@ public enum GuiBridge implements IGuiHandler
}
@Override
public Object getClientGuiElement( int ordinal, EntityPlayer player, World w, int x, int y, int z )
public Object getClientGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z )
{
AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
GuiBridge ID = values()[ordinal >> 4];
boolean stem = ( ( ordinal >> 3 ) & 1 ) == 1;
final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 );
final GuiBridge ID = values()[ordinal >> 4];
final boolean stem = ( ( ordinal >> 3 ) & 1 ) == 1;
if( ID.type.isItem() )
{
ItemStack it = null;
@@ -442,7 +442,7 @@ public enum GuiBridge implements IGuiHandler
{
it = player.inventory.getStackInSlot( x );
}
Object myItem = this.getGuiObject( it, player, w, x, y, z );
final Object myItem = this.getGuiObject( it, player, w, x, y, z );
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
{
return ID.ConstructGui( player.inventory, side, myItem );
@@ -450,11 +450,11 @@ public enum GuiBridge implements IGuiHandler
}
if( ID.type.isTile() )
{
TileEntity TE = w.getTileEntity( new BlockPos(x,y,z) );
final TileEntity TE = w.getTileEntity( new BlockPos(x,y,z) );
if( TE instanceof IPartHost )
{
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
final IPart part = ( (IPartHost) TE ).getPart( side );
if( ID.CorrectTileOrPart( part ) )
{
return ID.ConstructGui( player.inventory, side, part );
@@ -471,17 +471,17 @@ public enum GuiBridge implements IGuiHandler
return new GuiNull( new ContainerNull() );
}
public Object ConstructGui( InventoryPlayer inventory, AEPartLocation side, Object tE )
public Object ConstructGui( final InventoryPlayer inventory, final AEPartLocation side, final Object tE )
{
try
{
Constructor[] c = this.guiClass.getConstructors();
final Constructor[] c = this.guiClass.getConstructors();
if( c.length == 0 )
{
throw new AppEngException( "Invalid Gui Class" );
}
Constructor target = this.findConstructor( c, inventory, tE );
final Constructor target = this.findConstructor( c, inventory, tE );
if( target == null )
{
@@ -490,25 +490,25 @@ public enum GuiBridge implements IGuiHandler
return target.newInstance( inventory, tE );
}
catch( Throwable t )
catch( final Throwable t )
{
throw new IllegalStateException( t );
}
}
public boolean hasPermissions( TileEntity te, int x, int y, int z, AEPartLocation side, EntityPlayer player )
public boolean hasPermissions( final TileEntity te, final int x, final int y, final int z, final AEPartLocation side, final EntityPlayer player )
{
World w = player.getEntityWorld();
BlockPos pos = new BlockPos(x,y,z);
final World w = player.getEntityWorld();
final BlockPos pos = new BlockPos(x,y,z);
if( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.worldObj, pos ), player ) )
{
if( this.type.isItem() )
{
ItemStack it = player.inventory.getCurrentItem();
final ItemStack it = player.inventory.getCurrentItem();
if( it != null && it.getItem() instanceof IGuiItem )
{
Object myItem = ( (IGuiItem) it.getItem() ).getGuiObject( it, w, pos );
final Object myItem = ( (IGuiItem) it.getItem() ).getGuiObject( it, w, pos );
if( this.CorrectTileOrPart( myItem ) )
{
return true;
@@ -518,11 +518,11 @@ public enum GuiBridge implements IGuiHandler
if( this.type.isTile() )
{
TileEntity TE = w.getTileEntity( pos );
final TileEntity TE = w.getTileEntity( pos );
if( TE instanceof IPartHost )
{
( (IPartHost) TE ).getPart( side );
IPart part = ( (IPartHost) TE ).getPart( side );
final IPart part = ( (IPartHost) TE ).getPart( side );
if( this.CorrectTileOrPart( part ) )
{
return this.securityCheck( part, player );
@@ -540,28 +540,28 @@ public enum GuiBridge implements IGuiHandler
return false;
}
private boolean securityCheck( Object te, EntityPlayer player )
private boolean securityCheck( final Object te, final EntityPlayer player )
{
if( te instanceof IActionHost && this.requiredPermission != null )
{
IGridNode gn = ( (IActionHost) te ).getActionableNode();
final IGridNode gn = ( (IActionHost) te ).getActionableNode();
if( gn != null )
{
IGrid g = gn.getGrid();
final IGrid g = gn.getGrid();
if( g != null )
{
boolean requirePower = false;
final boolean requirePower = false;
if( requirePower )
{
IEnergyGrid eg = g.getCache( IEnergyGrid.class );
final IEnergyGrid eg = g.getCache( IEnergyGrid.class );
if( !eg.isNetworkPowered() )
{
return false;
}
}
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
final ISecurityGrid sg = g.getCache( ISecurityGrid.class );
if( sg.hasPermission( player, this.requiredPermission ) )
{
return true;
@@ -40,23 +40,23 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
@Override
public void onPacketData(
final INetworkInfo manager,
INetHandler handler,
FMLProxyPacket packet,
final INetHandler handler,
final FMLProxyPacket packet,
final EntityPlayer player )
{
ByteBuf stream = packet.payload();
final ByteBuf stream = packet.payload();
try
{
int packetType = stream.readInt();
AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
final int packetType = stream.readInt();
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
PacketCallState callState =
final PacketCallState callState =
new PacketCallState(){
@Override
public void call(
AppEngPacket appEngPacket )
final AppEngPacket appEngPacket )
{
appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getMinecraft().thePlayer );
}
@@ -66,19 +66,19 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, Minecraft.getMinecraft() );
callState.call( pack );
}
catch( InstantiationException e )
catch( final InstantiationException e )
{
AELog.error( e );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
AELog.error( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
AELog.error( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
AELog.error( e );
}
@@ -38,22 +38,21 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
{
@Override
public void onPacketData( final INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, final EntityPlayer player )
public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final EntityPlayer player )
{
ByteBuf stream = packet.payload();
int packetType = -1;
final ByteBuf stream = packet.payload();
try
{
packetType = stream.readInt();
AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
final int packetType = stream.readInt();
final AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
PacketCallState callState =
final PacketCallState callState =
new PacketCallState(){
@Override
public void call(
AppEngPacket appEngPacket )
final AppEngPacket appEngPacket )
{
appEngPacket.serverPacketData( manager, appEngPacket, player);
}
@@ -63,19 +62,19 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp
PacketThreadUtil.checkThreadAndEnqueue( pack, handler, ((EntityPlayerMP)player).getServerForPlayer() );
callState.call( pack );
}
catch( InstantiationException e )
catch( final InstantiationException e )
{
AELog.error( e );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
AELog.error( e );
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
AELog.error( e );
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
AELog.error( e );
}
@@ -44,7 +44,7 @@ public class NetworkHandler
final IPacketHandler clientHandler;
final IPacketHandler serveHandler;
public NetworkHandler( String channelName )
public NetworkHandler( final String channelName )
{
FMLCommonHandler.instance().bus().register( this );
this.ec = NetworkRegistry.INSTANCE.newEventDrivenChannel( this.myChannelName = channelName );
@@ -60,7 +60,7 @@ public class NetworkHandler
{
return new AppEngClientPacketHandler();
}
catch( Throwable t )
catch( final Throwable t )
{
return null;
}
@@ -72,20 +72,20 @@ public class NetworkHandler
{
return new AppEngServerPacketHandler();
}
catch( Throwable t )
catch( final Throwable t )
{
return null;
}
}
@SubscribeEvent
public void newConnection( ServerConnectionFromClientEvent ev )
public void newConnection( final ServerConnectionFromClientEvent ev )
{
WorldData.instance().dimensionData().sendToPlayer( ev.manager );
}
@SubscribeEvent
public void newConnection( PlayerLoggedInEvent loginEvent )
public void newConnection( final PlayerLoggedInEvent loginEvent )
{
if( loginEvent.player instanceof EntityPlayerMP )
{
@@ -94,9 +94,9 @@ public class NetworkHandler
}
@SubscribeEvent
public void serverPacket( ServerCustomPacketEvent ev )
public void serverPacket( final ServerCustomPacketEvent ev )
{
NetHandlerPlayServer srv = (NetHandlerPlayServer) ev.packet.handler();
final NetHandlerPlayServer srv = (NetHandlerPlayServer) ev.packet.handler();
if( this.serveHandler != null )
{
try
@@ -111,7 +111,7 @@ public class NetworkHandler
}
@SubscribeEvent
public void clientPacket( ClientCustomPacketEvent ev )
public void clientPacket( final ClientCustomPacketEvent ev )
{
if( this.clientHandler != null )
{
@@ -131,27 +131,27 @@ public class NetworkHandler
return this.myChannelName;
}
public void sendToAll( AppEngPacket message )
public void sendToAll( final AppEngPacket message )
{
this.ec.sendToAll( message.getProxy() );
}
public void sendTo( AppEngPacket message, EntityPlayerMP player )
public void sendTo( final AppEngPacket message, final EntityPlayerMP player )
{
this.ec.sendTo( message.getProxy(), player );
}
public void sendToAllAround( AppEngPacket message, NetworkRegistry.TargetPoint point )
public void sendToAllAround( final AppEngPacket message, final NetworkRegistry.TargetPoint point )
{
this.ec.sendToAllAround( message.getProxy(), point );
}
public void sendToDimension( AppEngPacket message, int dimensionId )
public void sendToDimension( final AppEngPacket message, final int dimensionId )
{
this.ec.sendToDimension( message.getProxy(), dimensionId );
}
public void sendToServer( AppEngPacket message )
public void sendToServer( final AppEngPacket message )
{
this.ec.sendToServer( message.getProxy() );
}
@@ -46,7 +46,7 @@ public class PacketAssemblerAnimation extends AppEngPacket
public final IAEItemStack is;
// automatic.
public PacketAssemblerAnimation( ByteBuf stream ) throws IOException
public PacketAssemblerAnimation( final ByteBuf stream ) throws IOException
{
this.x = stream.readInt();
this.y = stream.readInt();
@@ -56,10 +56,10 @@ public class PacketAssemblerAnimation extends AppEngPacket
}
// api
public PacketAssemblerAnimation( BlockPos pos, byte rate, IAEItemStack is ) throws IOException
public PacketAssemblerAnimation( final BlockPos pos, final byte rate, final IAEItemStack is ) throws IOException
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( this.x = pos.getX() );
@@ -74,11 +74,11 @@ public class PacketAssemblerAnimation extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
double d0 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
double d2 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
final double d0 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
final double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
final double d2 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
CommonHelper.proxy.spawnEffect( EffectType.Assembler, player.getEntityWorld(), this.x + d0, this.y + d1, this.z + d2, this );
}
@@ -48,7 +48,7 @@ public class PacketClick extends AppEngPacket
final float hitZ;
// automatic.
public PacketClick( ByteBuf stream )
public PacketClick( final ByteBuf stream )
{
this.x = stream.readInt();
this.y = stream.readInt();
@@ -60,10 +60,10 @@ public class PacketClick extends AppEngPacket
}
// api
public PacketClick( BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ )
public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( this.x = pos.getX() );
@@ -78,9 +78,9 @@ public class PacketClick extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
ItemStack is = player.inventory.getCurrentItem();
final ItemStack is = player.inventory.getCurrentItem();
final IItems items = AEApi.instance().definitions().items();
final IComparableDefinition maybeMemoryCard = items.memoryCard();
final IComparableDefinition maybeColorApplicator = items.colorApplicator();
@@ -89,20 +89,20 @@ public class PacketClick extends AppEngPacket
{
if( is.getItem() instanceof ToolNetworkTool )
{
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
final ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
tnt.serverSideToolLogic( is, player, player.worldObj, new BlockPos( this.x, this.y, this.z), EnumFacing.VALUES[ this.side ], this.hitX, this.hitY, this.hitZ );
}
else if( maybeMemoryCard.isSameAs( is ) )
{
IMemoryCard mem = (IMemoryCard) is.getItem();
final IMemoryCard mem = (IMemoryCard) is.getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
is.setTagCompound( null );
}
else if( maybeColorApplicator.isSameAs( is ) )
{
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
final ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
mem.cycleColors( is, mem.getColor( is ), 1 );
}
}
@@ -42,7 +42,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
EntityPlayer talkBackTo;
// automatic.
public PacketCompassRequest( ByteBuf stream )
public PacketCompassRequest( final ByteBuf stream )
{
this.attunement = stream.readLong();
this.cx = stream.readInt();
@@ -51,10 +51,10 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
}
// api
public PacketCompassRequest( long attunement, int cx, int cz, int cdy )
public PacketCompassRequest( final long attunement, final int cx, final int cz, final int cdy )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeLong( this.attunement = attunement );
@@ -66,17 +66,17 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
}
@Override
public void calculatedDirection( boolean hasResult, boolean spin, double radians, double dist )
public void calculatedDirection( final boolean hasResult, final boolean spin, final double radians, final double dist )
{
NetworkHandler.instance.sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo );
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
this.talkBackTo = player;
DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
final DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
}
}
@@ -39,7 +39,7 @@ public class PacketCompassResponse extends AppEngPacket
public CompassResult cr;
// automatic.
public PacketCompassResponse( ByteBuf stream )
public PacketCompassResponse( final ByteBuf stream )
{
this.attunement = stream.readLong();
this.cx = stream.readInt();
@@ -50,10 +50,10 @@ public class PacketCompassResponse extends AppEngPacket
}
// api
public PacketCompassResponse( PacketCompassRequest req, boolean hasResult, boolean spin, double radians )
public PacketCompassResponse( final PacketCompassRequest req, final boolean hasResult, final boolean spin, final double radians )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeLong( this.attunement = req.attunement );
@@ -69,7 +69,7 @@ public class PacketCompassResponse extends AppEngPacket
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
}
@@ -59,7 +59,7 @@ public class PacketCompressedNBT extends AppEngPacket
this.data = null;
this.compressFrame = null;
GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
{
@Override
@@ -74,13 +74,13 @@ public class PacketCompressedNBT extends AppEngPacket
}
} );
DataInputStream inStream = new DataInputStream( gzReader );
final DataInputStream inStream = new DataInputStream( gzReader );
this.in = CompressedStreamTools.read( inStream );
inStream.close();
}
// api
public PacketCompressedNBT( NBTTagCompound din ) throws IOException
public PacketCompressedNBT( final NBTTagCompound din ) throws IOException
{
this.data = Unpooled.buffer( 2048 );
@@ -92,7 +92,7 @@ public class PacketCompressedNBT extends AppEngPacket
{
@Override
public void write( int value ) throws IOException
public void write( final int value ) throws IOException
{
PacketCompressedNBT.this.data.writeByte( value );
}
@@ -106,9 +106,9 @@ public class PacketCompressedNBT extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiInterfaceTerminal )
{
@@ -40,19 +40,19 @@ public final class PacketConfigButton extends AppEngPacket
// automatic.
@Reflected
public PacketConfigButton( ByteBuf stream )
public PacketConfigButton( final ByteBuf stream )
{
this.option = Settings.values()[stream.readInt()];
this.rotationDirection = stream.readBoolean();
}
// api
public PacketConfigButton( Settings option, boolean rotationDirection )
public PacketConfigButton( final Settings option, final boolean rotationDirection )
{
this.option = option;
this.rotationDirection = rotationDirection;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( option.ordinal() );
@@ -62,16 +62,16 @@ public final class PacketConfigButton extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
final EntityPlayerMP sender = (EntityPlayerMP) player;
if ( sender.openContainer instanceof AEBaseContainer )
{
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
if( baseContainer.getTarget() instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
final IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
final Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
cm.putSetting( this.option, newState );
}
}
@@ -49,18 +49,18 @@ public class PacketCraftRequest extends AppEngPacket
public final boolean heldShift;
// automatic.
public PacketCraftRequest( ByteBuf stream )
public PacketCraftRequest( final ByteBuf stream )
{
this.heldShift = stream.readBoolean();
this.amount = stream.readLong();
}
public PacketCraftRequest( int craftAmt, boolean shift )
public PacketCraftRequest( final int craftAmt, final boolean shift )
{
this.amount = craftAmt;
this.heldShift = shift;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeBoolean( shift );
@@ -70,22 +70,22 @@ public class PacketCraftRequest extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
if( player.openContainer instanceof ContainerCraftAmount )
{
ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
Object target = cca.getTarget();
final ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
final Object target = cca.getTarget();
if( target instanceof IGridHost )
{
IGridHost gh = (IGridHost) target;
IGridNode gn = gh.getGridNode( AEPartLocation.INTERNAL );
final IGridHost gh = (IGridHost) target;
final IGridNode gn = gh.getGridNode( AEPartLocation.INTERNAL );
if( gn == null )
{
return;
}
IGrid g = gn.getGrid();
final IGrid g = gn.getGrid();
if( g == null || cca.whatToMake == null )
{
return;
@@ -96,25 +96,25 @@ public class PacketCraftRequest extends AppEngPacket
Future<ICraftingJob> futureJob = null;
try
{
ICraftingGrid cg = g.getCache( ICraftingGrid.class );
final ICraftingGrid cg = g.getCache( ICraftingGrid.class );
futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.whatToMake, null );
ContainerOpenContext context = cca.openContext;
final ContainerOpenContext context = cca.openContext;
if( context != null )
{
TileEntity te = context.getTile();
final TileEntity te = context.getTile();
Platform.openGUI( player, te, cca.openContext.side, GuiBridge.GUI_CRAFTING_CONFIRM );
if( player.openContainer instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
ccc.autoStart = this.heldShift;
ccc.job = futureJob;
cca.detectAndSendChanges();
}
}
}
catch( Throwable e )
catch( final Throwable e )
{
if( futureJob != null )
{
@@ -49,12 +49,12 @@ public class PacketInventoryAction extends AppEngPacket
public final IAEItemStack slotItem;
// automatic.
public PacketInventoryAction( ByteBuf stream ) throws IOException
public PacketInventoryAction( final ByteBuf stream ) throws IOException
{
this.action = InventoryAction.values()[stream.readInt()];
this.slot = stream.readInt();
this.id = stream.readLong();
boolean hasItem = stream.readBoolean();
final boolean hasItem = stream.readBoolean();
if( hasItem )
{
this.slotItem = AEItemStack.loadItemStackFromPacket( stream );
@@ -66,7 +66,7 @@ public class PacketInventoryAction extends AppEngPacket
}
// api
public PacketInventoryAction( InventoryAction action, int slot, IAEItemStack slotItem ) throws IOException
public PacketInventoryAction( final InventoryAction action, final int slot, final IAEItemStack slotItem ) throws IOException
{
if( Platform.isClient() )
@@ -79,7 +79,7 @@ public class PacketInventoryAction extends AppEngPacket
this.id = 0;
this.slotItem = slotItem;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( action.ordinal() );
@@ -100,14 +100,14 @@ public class PacketInventoryAction extends AppEngPacket
}
// api
public PacketInventoryAction( InventoryAction action, int slot, long id )
public PacketInventoryAction( final InventoryAction action, final int slot, final long id )
{
this.action = action;
this.slot = slot;
this.id = id;
this.slotItem = null;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( action.ordinal() );
@@ -119,23 +119,23 @@ public class PacketInventoryAction extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
final EntityPlayerMP sender = (EntityPlayerMP) player;
if( sender.openContainer instanceof AEBaseContainer )
{
AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
if( this.action == InventoryAction.AUTO_CRAFT )
{
ContainerOpenContext context = baseContainer.openContext;
final ContainerOpenContext context = baseContainer.openContext;
if( context != null )
{
TileEntity te = context.getTile();
final TileEntity te = context.getTile();
Platform.openGUI( sender, te, baseContainer.openContext.side, GuiBridge.GUI_CRAFTING_AMOUNT );
if( sender.openContainer instanceof ContainerCraftAmount )
{
ContainerCraftAmount cca = (ContainerCraftAmount) sender.openContainer;
final ContainerCraftAmount cca = (ContainerCraftAmount) sender.openContainer;
if( baseContainer.getTargetStack() != null )
{
@@ -155,7 +155,7 @@ public class PacketInventoryAction extends AppEngPacket
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
if( this.action == InventoryAction.UPDATE_HAND )
{
@@ -41,7 +41,7 @@ public class PacketLightning extends AppEngPacket
final double z;
// automatic.
public PacketLightning( ByteBuf stream )
public PacketLightning( final ByteBuf stream )
{
this.x = stream.readFloat();
this.y = stream.readFloat();
@@ -49,13 +49,13 @@ public class PacketLightning extends AppEngPacket
}
// api
public PacketLightning( double x, double y, double z )
public PacketLightning( final double x, final double y, final double z )
{
this.x = x;
this.y = y;
this.z = z;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
@@ -67,17 +67,17 @@ public class PacketLightning extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
try
{
if( Platform.isClient() && AEConfig.instance.enableEffects )
{
LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f );
final LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
catch( Exception ignored )
catch( final Exception ignored )
{
}
}
@@ -81,7 +81,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// int originalBytes = stream.readableBytes();
GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
{
@Override
public int read() throws IOException
@@ -95,11 +95,11 @@ public class PacketMEInventoryUpdate extends AppEngPacket
}
} );
ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
byte[] tmp = new byte[TEMP_BUFFER_SIZE];
final ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
final byte[] tmp = new byte[TEMP_BUFFER_SIZE];
while( gzReader.available() != 0 )
{
int bytes = gzReader.read( tmp );
final int bytes = gzReader.read( tmp );
if( bytes > 0 )
{
uncompressed.writeBytes( tmp, 0, bytes );
@@ -125,7 +125,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
}
// api
public PacketMEInventoryUpdate( byte ref ) throws IOException
public PacketMEInventoryUpdate( final byte ref ) throws IOException
{
this.ref = ref;
this.data = Unpooled.buffer( OPERATION_BYTE_LIMIT );
@@ -135,7 +135,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
this.compressFrame = new GZIPOutputStream( new OutputStream()
{
@Override
public void write( int value ) throws IOException
public void write( final int value ) throws IOException
{
PacketMEInventoryUpdate.this.data.writeByte( value );
}
@@ -146,9 +146,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiCraftConfirm )
{
@@ -182,7 +182,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
this.configureWrite( this.data );
return super.getProxy();
}
catch( IOException e )
catch( final IOException e )
{
AELog.error( e );
}
@@ -190,9 +190,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
return null;
}
public void appendItem( IAEItemStack is ) throws IOException, BufferOverflowException
public void appendItem( final IAEItemStack is ) throws IOException, BufferOverflowException
{
ByteBuf tmp = Unpooled.buffer( OPERATION_BYTE_LIMIT );
final ByteBuf tmp = Unpooled.buffer( OPERATION_BYTE_LIMIT );
is.writeToPacket( tmp );
this.compressFrame.flush();
@@ -45,7 +45,7 @@ public class PacketMatterCannon extends AppEngPacket
final byte len;
// automatic.
public PacketMatterCannon( ByteBuf stream )
public PacketMatterCannon( final ByteBuf stream )
{
this.x = stream.readFloat();
this.y = stream.readFloat();
@@ -57,10 +57,10 @@ public class PacketMatterCannon extends AppEngPacket
}
// api
public PacketMatterCannon( double x, double y, double z, float dx, float dy, float dz, byte len )
public PacketMatterCannon( final double x, final double y, final double z, final float dx, final float dy, final float dz, final byte len )
{
float dl = dx * dx + dy * dy + dz * dz;
float dlz = (float) Math.sqrt( dl );
final float dl = dx * dx + dy * dy + dz * dz;
final float dlz = (float) Math.sqrt( dl );
this.x = x;
this.y = y;
@@ -70,7 +70,7 @@ public class PacketMatterCannon extends AppEngPacket
this.dz = dz / dlz;
this.len = len;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
@@ -86,20 +86,20 @@ public class PacketMatterCannon extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
try
{
World world = FMLClientHandler.instance().getClient().theWorld;
final World world = FMLClientHandler.instance().getClient().theWorld;
for( int a = 1; a < this.len; a++ )
{
MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, Items.diamond );
final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, Items.diamond );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
catch( Exception ignored )
catch( final Exception ignored )
{
}
}
@@ -39,7 +39,7 @@ public class PacketMockExplosion extends AppEngPacket
public final double z;
// automatic.
public PacketMockExplosion( ByteBuf stream )
public PacketMockExplosion( final ByteBuf stream )
{
this.x = stream.readDouble();
this.y = stream.readDouble();
@@ -47,13 +47,13 @@ public class PacketMockExplosion extends AppEngPacket
}
// api
public PacketMockExplosion( double x, double y, double z )
public PacketMockExplosion( final double x, final double y, final double z )
{
this.x = x;
this.y = y;
this.z = z;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeDouble( x );
@@ -65,9 +65,9 @@ public class PacketMockExplosion extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
World world = CommonHelper.proxy.getWorld();
final World world = CommonHelper.proxy.getWorld();
world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] );
}
}
@@ -35,14 +35,14 @@ public class PacketMultiPart extends AppEngPacket
{
// automatic.
public PacketMultiPart( ByteBuf stream )
public PacketMultiPart( final ByteBuf stream )
{
}
// api
public PacketMultiPart()
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
@@ -50,12 +50,12 @@ public class PacketMultiPart extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
IFMP fmp = (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP );
final IFMP fmp = (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP );
if( fmp != null )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
final EntityPlayerMP sender = (EntityPlayerMP) player;
MinecraftForge.EVENT_BUS.post( fmp.newFMPPacketEvent( sender ) ); // when received it just posts this event.
}
}
@@ -67,17 +67,17 @@ public class PacketNEIRecipe extends AppEngPacket
ItemStack[][] recipe;
// automatic.
public PacketNEIRecipe( ByteBuf stream ) throws IOException
public PacketNEIRecipe( final ByteBuf stream ) throws IOException
{
ByteArrayInputStream bytes = new ByteArrayInputStream( stream.array() );
final ByteArrayInputStream bytes = new ByteArrayInputStream( stream.array() );
bytes.skip( stream.readerIndex() );
NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes );
final NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes );
if( comp != null )
{
this.recipe = new ItemStack[9][];
for( int x = 0; x < this.recipe.length; x++ )
{
NBTTagList list = comp.getTagList( "#" + x, 10 );
final NBTTagList list = comp.getTagList( "#" + x, 10 );
if( list.tagCount() > 0 )
{
this.recipe[x] = new ItemStack[list.tagCount()];
@@ -91,12 +91,12 @@ public class PacketNEIRecipe extends AppEngPacket
}
// api
public PacketNEIRecipe( NBTTagCompound recipe ) throws IOException
public PacketNEIRecipe( final NBTTagCompound recipe ) throws IOException
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream outputStream = new DataOutputStream( bytes );
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
final DataOutputStream outputStream = new DataOutputStream( bytes );
data.writeInt( this.getPacketID() );
@@ -107,34 +107,34 @@ public class PacketNEIRecipe extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
EntityPlayerMP pmp = (EntityPlayerMP) player;
Container con = pmp.openContainer;
final EntityPlayerMP pmp = (EntityPlayerMP) player;
final Container con = pmp.openContainer;
if( con instanceof IContainerCraftingPacket )
{
IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
IGridNode node = cct.getNetworkNode();
final IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
final IGridNode node = cct.getNetworkNode();
if( node != null )
{
IGrid grid = node.getGrid();
final IGrid grid = node.getGrid();
if( grid == null )
{
return;
}
IStorageGrid inv = grid.getCache( IStorageGrid.class );
IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
ISecurityGrid security = grid.getCache( ISecurityGrid.class );
IInventory craftMatrix = cct.getInventoryByName( "crafting" );
IInventory playerInventory = cct.getInventoryByName( "player" );
final IStorageGrid inv = grid.getCache( IStorageGrid.class );
final IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
final ISecurityGrid security = grid.getCache( ISecurityGrid.class );
final IInventory craftMatrix = cct.getInventoryByName( "crafting" );
final IInventory playerInventory = cct.getInventoryByName( "player" );
Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;
final Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;
if( inv != null && this.recipe != null && security != null )
{
InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
final InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
for( int x = 0; x < 9; x++ )
{
if( this.recipe[x] != null && this.recipe[x].length > 0 )
@@ -143,35 +143,35 @@ public class PacketNEIRecipe extends AppEngPacket
}
}
IRecipe r = Platform.findMatchingRecipe( testInv, pmp.worldObj );
final IRecipe r = Platform.findMatchingRecipe( testInv, pmp.worldObj );
if( r != null && security.hasPermission( player, SecurityPermissions.EXTRACT ) )
{
ItemStack is = r.getCraftingResult( testInv );
final ItemStack is = r.getCraftingResult( testInv );
if( is != null )
{
IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
IItemList all = storage.getStorageList();
IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
final IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
final IItemList all = storage.getStorageList();
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
for( int x = 0; x < craftMatrix.getSizeInventory(); x++ )
{
ItemStack patternItem = testInv.getStackInSlot( x );
final ItemStack patternItem = testInv.getStackInSlot( x );
ItemStack currentItem = craftMatrix.getStackInSlot( x );
if( currentItem != null )
{
testInv.setInventorySlotContents( x, currentItem );
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
final ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
testInv.setInventorySlotContents( x, patternItem );
if( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
{
IAEItemStack in = AEItemStack.create( currentItem );
final IAEItemStack in = AEItemStack.create( currentItem );
if( in != null )
{
IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getSource() );
final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getSource() );
if( out != null )
{
craftMatrix.setInventorySlotContents( x, out.getItemStack() );
@@ -198,13 +198,13 @@ public class PacketNEIRecipe extends AppEngPacket
{
for( int y = 0; y < this.recipe[x].length; y++ )
{
IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
final IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
if( request != null )
{
if( filter == null || filter.isListed( request ) )
{
request.setStackSize( 1 );
IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getSource() );
final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getSource() );
if( out != null )
{
whichItem = out.getItemStack();
@@ -240,7 +240,7 @@ public class PacketNEIRecipe extends AppEngPacket
* @param patternItem which {@link ItemStack} to extract
* @return null or a found {@link ItemStack}
*/
private ItemStack extractItemFromPlayerInventory( EntityPlayer player, Actionable mode, ItemStack patternItem )
private ItemStack extractItemFromPlayerInventory( final EntityPlayer player, final Actionable mode, final ItemStack patternItem )
{
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
final AEItemStack request = AEItemStack.create( patternItem );
@@ -36,17 +36,17 @@ public class PacketNewStorageDimension extends AppEngPacket
final int newDim;
// automatic.
public PacketNewStorageDimension( ByteBuf stream )
public PacketNewStorageDimension( final ByteBuf stream )
{
this.newDim = stream.readInt();
}
// api
public PacketNewStorageDimension( int newDim )
public PacketNewStorageDimension( final int newDim )
{
this.newDim = newDim;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( newDim );
@@ -56,13 +56,13 @@ public class PacketNewStorageDimension extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
try
{
DimensionManager.registerDimension( this.newDim, AEConfig.instance.storageProviderID );
}
catch( IllegalArgumentException iae )
catch( final IllegalArgumentException iae )
{
// ok!
}
@@ -37,7 +37,7 @@ public class PacketPaintedEntity extends AppEngPacket
private int ticks;
// automatic.
public PacketPaintedEntity( ByteBuf stream )
public PacketPaintedEntity( final ByteBuf stream )
{
this.entityId = stream.readInt();
this.myColor = AEColor.values()[stream.readByte()];
@@ -45,10 +45,10 @@ public class PacketPaintedEntity extends AppEngPacket
}
// api
public PacketPaintedEntity( int myEntity, AEColor myColor, int ticksLeft )
public PacketPaintedEntity( final int myEntity, final AEColor myColor, final int ticksLeft )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( this.entityId = myEntity );
@@ -59,9 +59,9 @@ public class PacketPaintedEntity extends AppEngPacket
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
PlayerColor pc = new PlayerColor( this.entityId, this.myColor, this.ticks );
final PlayerColor pc = new PlayerColor( this.entityId, this.myColor, this.ticks );
TickHandler.INSTANCE.getPlayerColors().put( this.entityId, pc );
}
}
@@ -41,7 +41,7 @@ public class PacketPartPlacement extends AppEngPacket
float eyeHeight;
// automatic.
public PacketPartPlacement( ByteBuf stream )
public PacketPartPlacement( final ByteBuf stream )
{
this.x = stream.readInt();
this.y = stream.readInt();
@@ -51,9 +51,9 @@ public class PacketPartPlacement extends AppEngPacket
}
// api
public PacketPartPlacement( BlockPos pos, EnumFacing face, float eyeHeight )
public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( pos.getX() );
@@ -66,9 +66,9 @@ public class PacketPartPlacement extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
final EntityPlayerMP sender = (EntityPlayerMP) player;
CommonHelper.proxy.updateRenderMode( sender );
PartPlacement.eyeHeight = this.eyeHeight;
PartPlacement.place( sender.getHeldItem(), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[ this.face ], sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
@@ -34,17 +34,17 @@ public class PacketPartialItem extends AppEngPacket
final byte[] data;
// automatic.
public PacketPartialItem( ByteBuf stream )
public PacketPartialItem( final ByteBuf stream )
{
this.pageNum = stream.readShort();
stream.readBytes( this.data = new byte[stream.readableBytes()] );
}
// api
public PacketPartialItem( int page, int maxPages, byte[] buf )
public PacketPartialItem( final int page, final int maxPages, final byte[] buf )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
this.pageNum = (short) ( page | ( maxPages << 8 ) );
this.data = buf;
@@ -56,7 +56,7 @@ public class PacketPartialItem extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
if( player.openContainer instanceof AEBaseContainer )
{
@@ -74,7 +74,7 @@ public class PacketPartialItem extends AppEngPacket
return this.data.length;
}
public int write( byte[] buffer, int cursor )
public int write( final byte[] buffer, final int cursor )
{
System.arraycopy( this.data, 0, buffer, cursor, this.data.length );
return cursor + this.data.length;
@@ -45,7 +45,7 @@ public class PacketPatternSlot extends AppEngPacket
public final boolean shift;
// automatic.
public PacketPatternSlot( ByteBuf stream ) throws IOException
public PacketPatternSlot( final ByteBuf stream ) throws IOException
{
this.shift = stream.readBoolean();
@@ -58,9 +58,9 @@ public class PacketPatternSlot extends AppEngPacket
}
}
public IAEItemStack readItem( ByteBuf stream ) throws IOException
public IAEItemStack readItem( final ByteBuf stream ) throws IOException
{
boolean hasItem = stream.readBoolean();
final boolean hasItem = stream.readBoolean();
if( hasItem )
{
@@ -71,13 +71,13 @@ public class PacketPatternSlot extends AppEngPacket
}
// api
public PacketPatternSlot( IInventory pat, IAEItemStack slotItem, boolean shift ) throws IOException
public PacketPatternSlot( final IInventory pat, final IAEItemStack slotItem, final boolean shift ) throws IOException
{
this.slotItem = slotItem;
this.shift = shift;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
@@ -93,7 +93,7 @@ public class PacketPatternSlot extends AppEngPacket
this.configureWrite( data );
}
private void writeItem( IAEItemStack slotItem, ByteBuf data ) throws IOException
private void writeItem( final IAEItemStack slotItem, final ByteBuf data ) throws IOException
{
if( slotItem == null )
{
@@ -107,12 +107,12 @@ public class PacketPatternSlot extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
final EntityPlayerMP sender = (EntityPlayerMP) player;
if( sender.openContainer instanceof ContainerPatternTerm )
{
ContainerPatternTerm patternTerminal = (ContainerPatternTerm) sender.openContainer;
final ContainerPatternTerm patternTerminal = (ContainerPatternTerm) sender.openContainer;
patternTerminal.craftOrGetItem( this );
}
}
@@ -35,19 +35,19 @@ public class PacketProgressBar extends AppEngPacket
final long value;
// automatic.
public PacketProgressBar( ByteBuf stream )
public PacketProgressBar( final ByteBuf stream )
{
this.id = stream.readShort();
this.value = stream.readLong();
}
// api
public PacketProgressBar( int shortID, long value )
public PacketProgressBar( final int shortID, final long value )
{
this.id = (short) shortID;
this.value = value;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeShort( shortID );
@@ -57,9 +57,9 @@ public class PacketProgressBar extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
Container c = player.openContainer;
final Container c = player.openContainer;
if( c instanceof AEBaseContainer )
{
( (AEBaseContainer) c ).updateFullProgressBar( this.id, this.value );
@@ -67,9 +67,9 @@ public class PacketProgressBar extends AppEngPacket
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
Container c = player.openContainer;
final Container c = player.openContainer;
if( c instanceof AEBaseContainer )
{
( (AEBaseContainer) c ).updateFullProgressBar( this.id, this.value );
@@ -34,16 +34,16 @@ public class PacketSwapSlots extends AppEngPacket
final int slotB;
// automatic.
public PacketSwapSlots( ByteBuf stream )
public PacketSwapSlots( final ByteBuf stream )
{
this.slotA = stream.readInt();
this.slotB = stream.readInt();
}
// api
public PacketSwapSlots( int slotA, int slotB )
public PacketSwapSlots( final int slotA, final int slotB )
{
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( this.slotA = slotA );
@@ -53,7 +53,7 @@ public class PacketSwapSlots extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
if( player != null && player.openContainer instanceof AEBaseContainer )
{
@@ -39,13 +39,13 @@ public class PacketSwitchGuis extends AppEngPacket
final GuiBridge newGui;
// automatic.
public PacketSwitchGuis( ByteBuf stream )
public PacketSwitchGuis( final ByteBuf stream )
{
this.newGui = GuiBridge.values()[stream.readInt()];
}
// api
public PacketSwitchGuis( GuiBridge newGui )
public PacketSwitchGuis( final GuiBridge newGui )
{
this.newGui = newGui;
@@ -54,7 +54,7 @@ public class PacketSwitchGuis extends AppEngPacket
AEBaseGui.switchingGuis = true;
}
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeInt( newGui.ordinal() );
@@ -63,23 +63,23 @@ public class PacketSwitchGuis extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
Container c = player.openContainer;
final Container c = player.openContainer;
if( c instanceof AEBaseContainer )
{
AEBaseContainer bc = (AEBaseContainer) c;
ContainerOpenContext context = bc.openContext;
final AEBaseContainer bc = (AEBaseContainer) c;
final ContainerOpenContext context = bc.openContext;
if( context != null )
{
TileEntity te = context.getTile();
final TileEntity te = context.getTile();
Platform.openGUI( player, te, context.side, this.newGui );
}
}
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
AEBaseGui.switchingGuis = true;
}
@@ -50,7 +50,7 @@ public class PacketTransitionEffect extends AppEngPacket
final AEPartLocation d;
// automatic.
public PacketTransitionEffect( ByteBuf stream )
public PacketTransitionEffect( final ByteBuf stream )
{
this.x = stream.readFloat();
this.y = stream.readFloat();
@@ -60,7 +60,7 @@ public class PacketTransitionEffect extends AppEngPacket
}
// api
public PacketTransitionEffect( double x, double y, double z, AEPartLocation dir, boolean wasBlock )
public PacketTransitionEffect( final double x, final double y, final double z, final AEPartLocation dir, final boolean wasBlock )
{
this.x = x;
this.y = y;
@@ -68,7 +68,7 @@ public class PacketTransitionEffect extends AppEngPacket
this.d = dir;
this.mode = wasBlock;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
@@ -82,15 +82,15 @@ public class PacketTransitionEffect extends AppEngPacket
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
World world = ClientHelper.proxy.getWorld();
final World world = ClientHelper.proxy.getWorld();
for( int zz = 0; zz < ( this.mode ? 32 : 8 ); zz++ )
{
if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
{
EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.diamond );
final EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.diamond );
if( !this.mode )
{
@@ -107,7 +107,7 @@ public class PacketTransitionEffect extends AppEngPacket
if( this.mode )
{
Block block = world.getBlockState( new BlockPos( (int) this.x, (int) this.y, (int) this.z ) ).getBlock();
final Block block = world.getBlockState( new BlockPos( (int) this.x, (int) this.y, (int) this.z ) ).getBlock();
Minecraft.getMinecraft().getSoundHandler().playSound( new PositionedSoundRecord( new ResourceLocation( block.stepSound.getBreakSound() ), ( block.stepSound.getVolume() + 1.0F ) / 2.0F, block.stepSound.getFrequency() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
}
@@ -62,26 +62,26 @@ public class PacketValueConfig extends AppEngPacket
public final String Value;
// automatic.
public PacketValueConfig( ByteBuf stream ) throws IOException
public PacketValueConfig( final ByteBuf stream ) throws IOException
{
DataInputStream dis = new DataInputStream( new ByteArrayInputStream( stream.array(), stream.readerIndex(), stream.readableBytes() ) );
final DataInputStream dis = new DataInputStream( new ByteArrayInputStream( stream.array(), stream.readerIndex(), stream.readableBytes() ) );
this.Name = dis.readUTF();
this.Value = dis.readUTF();
// dis.close();
}
// api
public PacketValueConfig( String name, String value ) throws IOException
public PacketValueConfig( final String name, final String value ) throws IOException
{
this.Name = name;
this.Value = value;
ByteBuf data = Unpooled.buffer();
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream( bos );
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream( bos );
dos.writeUTF( name );
dos.writeUTF( value );
// dos.close();
@@ -92,59 +92,59 @@ public class PacketValueConfig extends AppEngPacket
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
Container c = player.openContainer;
final Container c = player.openContainer;
if( this.Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
{
ItemStack is = player.getHeldItem();
IMouseWheelItem si = (IMouseWheelItem) is.getItem();
final ItemStack is = player.getHeldItem();
final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
si.onWheel( is, this.Value.equals( "WheelUp" ) );
}
else if( this.Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftingStatus )
{
ContainerCraftingStatus qk = (ContainerCraftingStatus) c;
final ContainerCraftingStatus qk = (ContainerCraftingStatus) c;
qk.cycleCpu( this.Value.equals( "Next" ) );
}
else if( this.Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
final ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
qk.cycleCpu( this.Value.equals( "Next" ) );
}
else if( this.Name.equals( "Terminal.Start" ) && c instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
final ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
qk.startJob();
}
else if( this.Name.equals( "TileCrafting.Cancel" ) && c instanceof ContainerCraftingCPU )
{
ContainerCraftingCPU qk = (ContainerCraftingCPU) c;
final ContainerCraftingCPU qk = (ContainerCraftingCPU) c;
qk.cancelCrafting();
}
else if( this.Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
{
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
final ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
qk.setName( this.Value );
}
else if( this.Name.equals( "TileSecurity.ToggleOption" ) && c instanceof ContainerSecurity )
{
ContainerSecurity sc = (ContainerSecurity) c;
final ContainerSecurity sc = (ContainerSecurity) c;
sc.toggleSetting( this.Value, player );
}
else if( this.Name.equals( "PriorityHost.Priority" ) && c instanceof ContainerPriority )
{
ContainerPriority pc = (ContainerPriority) c;
final ContainerPriority pc = (ContainerPriority) c;
pc.setPriority( Integer.parseInt( this.Value ), player );
}
else if( this.Name.equals( "LevelEmitter.Value" ) && c instanceof ContainerLevelEmitter )
{
ContainerLevelEmitter lvc = (ContainerLevelEmitter) c;
final ContainerLevelEmitter lvc = (ContainerLevelEmitter) c;
lvc.setLevel( Long.parseLong( this.Value ), player );
}
else if( this.Name.startsWith( "PatternTerminal." ) && c instanceof ContainerPatternTerm )
{
ContainerPatternTerm cpt = (ContainerPatternTerm) c;
final ContainerPatternTerm cpt = (ContainerPatternTerm) c;
if( this.Name.equals( "PatternTerminal.CraftMode" ) )
{
cpt.ct.setCraftingRecipe( this.Value.equals( "1" ) );
@@ -160,7 +160,7 @@ public class PacketValueConfig extends AppEngPacket
}
else if( this.Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus )
{
ContainerStorageBus ccw = (ContainerStorageBus) c;
final ContainerStorageBus ccw = (ContainerStorageBus) c;
if( this.Name.equals( "StorageBus.Action" ) )
{
if( this.Value.equals( "Partition" ) )
@@ -175,7 +175,7 @@ public class PacketValueConfig extends AppEngPacket
}
else if( this.Name.startsWith( "CellWorkbench." ) && c instanceof ContainerCellWorkbench )
{
ContainerCellWorkbench ccw = (ContainerCellWorkbench) c;
final ContainerCellWorkbench ccw = (ContainerCellWorkbench) c;
if( this.Name.equals( "CellWorkbench.Action" ) )
{
if( this.Value.equals( "CopyMode" ) )
@@ -205,19 +205,19 @@ public class PacketValueConfig extends AppEngPacket
}
else if( c instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) c ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) c ).getConfigManager();
for( Settings e : cm.getSettings() )
for( final Settings e : cm.getSettings() )
{
if( e.name().equals( this.Name ) )
{
Enum<?> def = cm.getSetting( e );
final Enum<?> def = cm.getSetting( e );
try
{
cm.putSetting( e, Enum.valueOf( def.getClass(), this.Value ) );
}
catch( IllegalArgumentException err )
catch( final IllegalArgumentException err )
{
// :P
}
@@ -229,9 +229,9 @@ public class PacketValueConfig extends AppEngPacket
}
@Override
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
Container c = player.openContainer;
final Container c = player.openContainer;
if( this.Name.equals( "CustomName" ) && c instanceof AEBaseContainer )
{
@@ -243,7 +243,7 @@ public class PacketValueConfig extends AppEngPacket
}
else if( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiCraftingCPU )
{
( (GuiCraftingCPU) gs ).clearItems();
@@ -251,19 +251,19 @@ public class PacketValueConfig extends AppEngPacket
}
else if( c instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) c ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) c ).getConfigManager();
for( Settings e : cm.getSettings() )
for( final Settings e : cm.getSettings() )
{
if( e.name().equals( this.Name ) )
{
Enum<?> def = cm.getSetting( e );
final Enum<?> def = cm.getSetting( e );
try
{
cm.putSetting( e, Enum.valueOf( def.getClass(), this.Value ) );
}
catch( IllegalArgumentException err )
catch( final IllegalArgumentException err )
{
// :P
}