Changed access to use this qualifier

This commit is contained in:
yueh
2014-12-29 15:13:47 +01:00
parent 2a5e57a59b
commit f471513bd0
604 changed files with 11573 additions and 11573 deletions
@@ -41,29 +41,29 @@ public abstract class AppEngPacket
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
throw new RuntimeException( "This packet ( " + getPacketID() + " does not implement a server side handler." );
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
}
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
throw new RuntimeException( "This packet ( " + getPacketID() + " does not implement a client side handler." );
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
}
protected void configureWrite(ByteBuf data)
{
data.capacity( data.readableBytes() );
p = data;
this.p = data;
}
public FMLProxyPacket getProxy()
{
if ( p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
throw new IllegalArgumentException( "Sorry AE2 made a " + p.array().length + " byte packet by accident!" );
if ( this.p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
throw new IllegalArgumentException( "Sorry AE2 made a " + this.p.array().length + " byte packet by accident!" );
FMLProxyPacket pp = new FMLProxyPacket( p, NetworkHandler.instance.getChannel() );
FMLProxyPacket pp = new FMLProxyPacket( this.p, NetworkHandler.instance.getChannel() );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
AELog.info( getClass().getName() + " : " + pp.payload().readableBytes() );
AELog.info( this.getClass().getName() + " : " + pp.payload().readableBytes() );
return pp;
}
@@ -109,12 +109,12 @@ public class AppEngPacketHandlerBase
final public Constructor con;
private PacketTypes(Class c) {
pc = c;
this.pc = c;
Constructor x = null;
try
{
x = pc.getConstructor( ByteBuf.class );
x = this.pc.getConstructor( ByteBuf.class );
}
catch (NoSuchMethodException ignored)
{
@@ -123,16 +123,16 @@ public class AppEngPacketHandlerBase
{
}
con = x;
AppEngPacketHandlerBase.reverseLookup.put( pc, this );
this.con = x;
AppEngPacketHandlerBase.reverseLookup.put( this.pc, this );
if ( con == null )
if ( this.con == null )
throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" );
}
public AppEngPacket parsePacket(ByteBuf in) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return (AppEngPacket) con.newInstance( in );
return (AppEngPacket) this.con.newInstance( in );
}
public static PacketTypes getPacket(int id)
+35 -35
View File
@@ -194,9 +194,9 @@ public enum GuiBridge implements IGuiHandler
private SecurityPermissions requiredPermission;
private GuiBridge() {
Tile = null;
Gui = null;
Container = null;
this.Tile = null;
this.Gui = null;
this.Container = null;
}
/**
@@ -207,52 +207,52 @@ public enum GuiBridge implements IGuiHandler
{
if ( Platform.isClient() )
{
String start = Container.getName();
String start = this.Container.getName();
String GuiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
if ( start.equals( GuiClass ) )
throw new RuntimeException( "Unable to find gui class" );
Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), GuiClass );
if ( Gui == null )
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), GuiClass );
if ( this.Gui == null )
throw new RuntimeException( "Cannot Load class: " + GuiClass );
}
}
private GuiBridge(Class _Container, SecurityPermissions requiredPermission) {
this.requiredPermission = requiredPermission;
Container = _Container;
Tile = null;
getGui();
this.Container = _Container;
this.Tile = null;
this.getGui();
}
private GuiBridge(Class _Container, Class _Tile, GuiHostType type, SecurityPermissions requiredPermission) {
this.requiredPermission = requiredPermission;
Container = _Container;
this.Container = _Container;
this.type = type;
Tile = _Tile;
getGui();
this.Tile = _Tile;
this.getGui();
}
public boolean CorrectTileOrPart(Object tE)
{
if ( Tile == null )
if ( this.Tile == null )
throw new RuntimeException( "This Gui Cannot use the standard Handler." );
return Tile.isInstance( tE );
return this.Tile.isInstance( tE );
}
public Object ConstructContainer(InventoryPlayer inventory, ForgeDirection side, Object tE)
{
try
{
Constructor[] c = Container.getConstructors();
Constructor[] c = this.Container.getConstructors();
if ( c.length == 0 )
throw new AppEngException( "Invalid Gui Class" );
Constructor target = findConstructor( c, inventory, tE );
Constructor target = this.findConstructor( c, inventory, tE );
if ( target == null )
{
throw new RuntimeException( "Cannot find " + Container.getName() + "( " + typeName( inventory ) + ", " + typeName( tE ) + " )" );
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
}
Object o = target.newInstance( inventory, tE );
@@ -291,15 +291,15 @@ public enum GuiBridge implements IGuiHandler
{
try
{
Constructor[] c = Gui.getConstructors();
Constructor[] c = this.Gui.getConstructors();
if ( c.length == 0 )
throw new AppEngException( "Invalid Gui Class" );
Constructor target = findConstructor( c, inventory, tE );
Constructor target = this.findConstructor( c, inventory, tE );
if ( target == null )
{
throw new RuntimeException( "Cannot find " + Container.getName() + "( " + typeName( inventory ) + ", " + typeName( tE ) + " )" );
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
}
return target.newInstance( inventory, tE );
@@ -358,9 +358,9 @@ public enum GuiBridge implements IGuiHandler
if ( ID.type.isItem() && stem )
{
ItemStack it = player.inventory.getCurrentItem();
Object myItem = getGuiObject( it, player, w, x, y, z );
Object myItem = this.getGuiObject( it, player, w, x, y, z );
if ( myItem != null && ID.CorrectTileOrPart( myItem ) )
return updateGui( ID.ConstructContainer( player.inventory, side, myItem ), w, x, y, z, side, myItem );
return this.updateGui( ID.ConstructContainer( player.inventory, side, myItem ), w, x, y, z, side, myItem );
}
if ( ID.type.isTile() )
@@ -371,12 +371,12 @@ public enum GuiBridge implements IGuiHandler
((IPartHost) TE).getPart( side );
IPart part = ((IPartHost) TE).getPart( side );
if ( ID.CorrectTileOrPart( part ) )
return updateGui( ID.ConstructContainer( player.inventory, side, part ), w, x, y, z, side, part );
return this.updateGui( ID.ConstructContainer( player.inventory, side, part ), w, x, y, z, side, part );
}
else
{
if ( ID.CorrectTileOrPart( TE ) )
return updateGui( ID.ConstructContainer( player.inventory, side, TE ), w, x, y, z, side, TE );
return this.updateGui( ID.ConstructContainer( player.inventory, side, TE ), w, x, y, z, side, TE );
}
}
@@ -410,7 +410,7 @@ public enum GuiBridge implements IGuiHandler
if ( ID.type.isItem() && stem )
{
ItemStack it = player.inventory.getCurrentItem();
Object myItem = getGuiObject( it, player, w, x, y, z );
Object myItem = this.getGuiObject( it, player, w, x, y, z );
if ( ID.CorrectTileOrPart( myItem ) )
return ID.ConstructGui( player.inventory, side, myItem );
}
@@ -442,33 +442,33 @@ public enum GuiBridge implements IGuiHandler
if ( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.worldObj, x, y, z ), player ) )
{
if ( type.isItem() )
if ( this.type.isItem() )
{
ItemStack it = player.inventory.getCurrentItem();
if ( it != null && it.getItem() instanceof IGuiItem )
{
Object myItem = ((IGuiItem) it.getItem()).getGuiObject( it, w, x, y, z );
if ( CorrectTileOrPart( myItem ) )
if ( this.CorrectTileOrPart( myItem ) )
{
return true;
}
}
}
if ( type.isTile() )
if ( this.type.isTile() )
{
TileEntity TE = w.getTileEntity( x, y, z );
if ( TE instanceof IPartHost )
{
((IPartHost) TE).getPart( side );
IPart part = ((IPartHost) TE).getPart( side );
if ( CorrectTileOrPart( part ) )
return securityCheck( part, player );
if ( this.CorrectTileOrPart( part ) )
return this.securityCheck( part, player );
}
else
{
if ( CorrectTileOrPart( TE ) )
return securityCheck( TE, player );
if ( this.CorrectTileOrPart( TE ) )
return this.securityCheck( TE, player );
}
}
}
@@ -477,7 +477,7 @@ public enum GuiBridge implements IGuiHandler
private boolean securityCheck(Object te, EntityPlayer player)
{
if ( te instanceof IActionHost && requiredPermission != null )
if ( te instanceof IActionHost && this.requiredPermission != null )
{
boolean requirePower = false;
@@ -497,7 +497,7 @@ public enum GuiBridge implements IGuiHandler
}
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
if ( sg.hasPermission( player, requiredPermission ) )
if ( sg.hasPermission( player, this.requiredPermission ) )
return true;
}
}
@@ -509,7 +509,7 @@ public enum GuiBridge implements IGuiHandler
public GuiHostType getType()
{
return type;
return this.type;
}
}
@@ -47,11 +47,11 @@ public class NetworkHandler
public NetworkHandler(String channelName) {
FMLCommonHandler.instance().bus().register( this );
ec = NetworkRegistry.INSTANCE.newEventDrivenChannel( myChannelName = channelName );
ec.register( this );
this.ec = NetworkRegistry.INSTANCE.newEventDrivenChannel( this.myChannelName = channelName );
this.ec.register( this );
clientHandler = createClientSide();
serveHandler = createServerSide();
this.clientHandler = this.createClientSide();
this.serveHandler = this.createServerSide();
}
private IPacketHandler createServerSide()
@@ -95,45 +95,45 @@ public class NetworkHandler
public void serverPacket(ServerCustomPacketEvent ev)
{
NetHandlerPlayServer srv = (NetHandlerPlayServer) ev.packet.handler();
if ( serveHandler != null )
serveHandler.onPacketData( null, ev.packet, srv.playerEntity );
if ( this.serveHandler != null )
this.serveHandler.onPacketData( null, ev.packet, srv.playerEntity );
}
@SubscribeEvent
public void clientPacket(ClientCustomPacketEvent ev)
{
if ( clientHandler != null )
clientHandler.onPacketData( null, ev.packet, null );
if ( this.clientHandler != null )
this.clientHandler.onPacketData( null, ev.packet, null );
}
public String getChannel()
{
return myChannelName;
return this.myChannelName;
}
public void sendToAll(AppEngPacket message)
{
ec.sendToAll( message.getProxy() );
this.ec.sendToAll( message.getProxy() );
}
public void sendTo(AppEngPacket message, EntityPlayerMP player)
{
ec.sendTo( message.getProxy(), player );
this.ec.sendTo( message.getProxy(), player );
}
public void sendToAllAround(AppEngPacket message, NetworkRegistry.TargetPoint point)
{
ec.sendToAllAround( message.getProxy(), point );
this.ec.sendToAllAround( message.getProxy(), point );
}
public void sendToDimension(AppEngPacket message, int dimensionId)
{
ec.sendToDimension( message.getProxy(), dimensionId );
this.ec.sendToDimension( message.getProxy(), dimensionId );
}
public void sendToServer(AppEngPacket message)
{
ec.sendToServer( message.getProxy() );
this.ec.sendToServer( message.getProxy() );
}
}
@@ -42,11 +42,11 @@ public class PacketAssemblerAnimation extends AppEngPacket
// automatic.
public PacketAssemblerAnimation(ByteBuf stream) throws IOException {
x = stream.readInt();
y = stream.readInt();
z = stream.readInt();
rate = stream.readByte();
is = AEItemStack.loadItemStackFromPacket( stream );
this.x = stream.readInt();
this.y = stream.readInt();
this.z = stream.readInt();
this.rate = stream.readByte();
this.is = AEItemStack.loadItemStackFromPacket( stream );
}
@Override
@@ -57,7 +57,7 @@ public class PacketAssemblerAnimation extends AppEngPacket
double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
double d2 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
CommonHelper.proxy.spawnEffect( EffectType.Assembler, player.getEntityWorld(), x + d0, y + d1, z + d2, this );
CommonHelper.proxy.spawnEffect( EffectType.Assembler, player.getEntityWorld(), this.x + d0, this.y + d1, this.z + d2, this );
}
// api
@@ -65,7 +65,7 @@ public class PacketAssemblerAnimation extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( this.x = x );
data.writeInt( this.y = y );
data.writeInt( this.z = z );
@@ -73,6 +73,6 @@ public class PacketAssemblerAnimation extends AppEngPacket
is.writeToPacket( data );
this.is = is;
configureWrite( data );
this.configureWrite( data );
}
}
@@ -44,13 +44,13 @@ public class PacketClick extends AppEngPacket
// automatic.
public PacketClick(ByteBuf stream) {
x = stream.readInt();
y = stream.readInt();
z = stream.readInt();
side = stream.readInt();
hitX = stream.readFloat();
hitY = stream.readFloat();
hitZ = stream.readFloat();
this.x = stream.readInt();
this.y = stream.readInt();
this.z = stream.readInt();
this.side = stream.readInt();
this.hitX = stream.readFloat();
this.hitY = stream.readFloat();
this.hitZ = stream.readFloat();
}
@Override
@@ -60,7 +60,7 @@ public class PacketClick extends AppEngPacket
if ( is != null && is.getItem() instanceof ToolNetworkTool )
{
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
tnt.serverSideToolLogic( is, player, player.worldObj, x, y, z, side, hitX, hitY, hitZ );
tnt.serverSideToolLogic( is, player, player.worldObj, this.x, this.y, this.z, this.side, this.hitX, this.hitY, this.hitZ );
}
else if ( is != null && AEApi.instance().items().itemMemoryCard.sameAsStack( is ) )
{
@@ -80,7 +80,7 @@ public class PacketClick extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( this.x = x );
data.writeInt( this.y = y );
data.writeInt( this.z = z );
@@ -89,6 +89,6 @@ public class PacketClick extends AppEngPacket
data.writeFloat( this.hitY = hitY );
data.writeFloat( this.hitZ = hitZ );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -40,22 +40,22 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
// automatic.
public PacketCompassRequest(ByteBuf stream) {
attunement = stream.readLong();
cx = stream.readInt();
cz = stream.readInt();
cdy = stream.readInt();
this.attunement = stream.readLong();
this.cx = stream.readInt();
this.cz = stream.readInt();
this.cdy = stream.readInt();
}
@Override
public void calculatedDirection(boolean hasResult, boolean spin, double radians, double dist)
{
NetworkHandler.instance.sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) talkBackTo );
NetworkHandler.instance.sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo );
}
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
talkBackTo = player;
this.talkBackTo = player;
DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
WorldSettings.getInstance().getCompass().getCompassDirection( loc, 174, this );
@@ -66,13 +66,13 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeLong( this.attunement = attunement );
data.writeInt( this.cx = cx );
data.writeInt( this.cz = cz );
data.writeInt( this.cdy = cdy );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -37,18 +37,18 @@ public class PacketCompassResponse extends AppEngPacket
// automatic.
public PacketCompassResponse(ByteBuf stream) {
attunement = stream.readLong();
cx = stream.readInt();
cz = stream.readInt();
cdy = stream.readInt();
this.attunement = stream.readLong();
this.cx = stream.readInt();
this.cz = stream.readInt();
this.cdy = stream.readInt();
cr = new CompassResult( stream.readBoolean(), stream.readBoolean(), stream.readDouble() );
this.cr = new CompassResult( stream.readBoolean(), stream.readBoolean(), stream.readDouble() );
}
@Override
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
CompassManager.instance.postResult( attunement, cx << 4, cdy << 5, cz << 4, cr );
CompassManager.instance.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
}
// api
@@ -56,7 +56,7 @@ public class PacketCompassResponse extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeLong( this.attunement = req.attunement );
data.writeInt( this.cx = req.cx );
data.writeInt( this.cz = req.cz );
@@ -66,7 +66,7 @@ public class PacketCompassResponse extends AppEngPacket
data.writeBoolean( spin );
data.writeDouble( radians );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -56,8 +56,8 @@ public class PacketCompressedNBT extends AppEngPacket
// automatic.
public PacketCompressedNBT(final ByteBuf stream) throws IOException {
data = null;
compressFrame = null;
this.data = null;
this.compressFrame = null;
GZIPInputStream gzReader = new GZIPInputStream( new InputStream() {
@@ -73,7 +73,7 @@ public class PacketCompressedNBT extends AppEngPacket
} );
DataInputStream inStream = new DataInputStream( gzReader );
in = CompressedStreamTools.read( inStream );
this.in = CompressedStreamTools.read( inStream );
inStream.close();
}
@@ -84,32 +84,32 @@ public class PacketCompressedNBT extends AppEngPacket
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiInterfaceTerminal )
((GuiInterfaceTerminal) gs).postUpdate( in );
((GuiInterfaceTerminal) gs).postUpdate( this.in );
}
// api
public PacketCompressedNBT(NBTTagCompound din) throws IOException {
data = Unpooled.buffer( 2048 );
data.writeInt( getPacketID() );
this.data = Unpooled.buffer( 2048 );
this.data.writeInt( this.getPacketID() );
in = din;
this.in = din;
compressFrame = new GZIPOutputStream( new OutputStream() {
this.compressFrame = new GZIPOutputStream( new OutputStream() {
@Override
public void write(int value) throws IOException
{
data.writeByte( value );
PacketCompressedNBT.this.data.writeByte( value );
}
} );
CompressedStreamTools.write( din, new DataOutputStream( compressFrame ) );
compressFrame.close();
CompressedStreamTools.write( din, new DataOutputStream( this.compressFrame ) );
this.compressFrame.close();
configureWrite( data );
this.configureWrite( this.data );
}
}
@@ -39,8 +39,8 @@ public class PacketConfigButton extends AppEngPacket
// automatic.
public PacketConfigButton(ByteBuf stream) {
option = Settings.values()[stream.readInt()];
rotationDirection = stream.readBoolean();
this.option = Settings.values()[stream.readInt()];
this.rotationDirection = stream.readBoolean();
}
@Override
@@ -51,8 +51,8 @@ public class PacketConfigButton extends AppEngPacket
if ( baseContainer.getTarget() instanceof IConfigurableObject )
{
IConfigManager cm = ((IConfigurableObject) baseContainer.getTarget()).getConfigManager();
Enum newState = Platform.rotateEnum( cm.getSetting( option ), rotationDirection, option.getPossibleValues() );
cm.putSetting( option, newState );
Enum newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
cm.putSetting( this.option, newState );
}
}
@@ -63,10 +63,10 @@ public class PacketConfigButton extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( option.ordinal() );
data.writeBoolean( rotationDirection );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -49,8 +49,8 @@ public class PacketCraftRequest extends AppEngPacket
// automatic.
public PacketCraftRequest(ByteBuf stream)
{
heldShift = stream.readBoolean();
amount = stream.readLong();
this.heldShift = stream.readBoolean();
this.amount = stream.readLong();
}
@Override
@@ -73,7 +73,7 @@ public class PacketCraftRequest extends AppEngPacket
Future<ICraftingJob> futureJob = null;
cca.whatToMake.setStackSize( amount );
cca.whatToMake.setStackSize( this.amount );
try
{
@@ -89,7 +89,7 @@ public class PacketCraftRequest extends AppEngPacket
if ( player.openContainer instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
ccc.autoStart = heldShift;
ccc.autoStart = this.heldShift;
ccc.job = futureJob;
cca.detectAndSendChanges();
}
@@ -113,11 +113,11 @@ public class PacketCraftRequest extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeBoolean( shift );
data.writeLong( amount );
data.writeLong( this.amount );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -48,14 +48,14 @@ public class PacketInventoryAction extends AppEngPacket
// automatic.
public PacketInventoryAction(ByteBuf stream) throws IOException {
action = InventoryAction.values()[stream.readInt()];
slot = stream.readInt();
id = stream.readLong();
this.action = InventoryAction.values()[stream.readInt()];
this.slot = stream.readInt();
this.id = stream.readLong();
boolean hasItem = stream.readBoolean();
if ( hasItem )
slotItem = AEItemStack.loadItemStackFromPacket( stream );
this.slotItem = AEItemStack.loadItemStackFromPacket( stream );
else
slotItem = null;
this.slotItem = null;
}
@Override
@@ -65,7 +65,7 @@ public class PacketInventoryAction extends AppEngPacket
if ( sender.openContainer instanceof AEBaseContainer )
{
AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
if ( action == InventoryAction.AUTO_CRAFT )
if ( this.action == InventoryAction.AUTO_CRAFT )
{
ContainerOpenContext context = baseContainer.openContext;
if ( context != null )
@@ -89,7 +89,7 @@ public class PacketInventoryAction extends AppEngPacket
}
else
{
baseContainer.doAction( sender, action, slot, id );
baseContainer.doAction( sender, this.action, this.slot, this.id );
}
}
}
@@ -97,12 +97,12 @@ public class PacketInventoryAction extends AppEngPacket
@Override
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
if ( action == InventoryAction.UPDATE_HAND )
if ( this.action == InventoryAction.UPDATE_HAND )
{
if ( slotItem == null )
if ( this.slotItem == null )
ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( null );
else
ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( slotItem.getItemStack() );
ClientHelper.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.getItemStack() );
}
}
@@ -119,10 +119,10 @@ public class PacketInventoryAction extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( action.ordinal() );
data.writeInt( slot );
data.writeLong( id );
data.writeLong( this.id );
if ( slotItem == null )
data.writeBoolean( false );
@@ -132,7 +132,7 @@ public class PacketInventoryAction extends AppEngPacket
slotItem.writeToPacket( data );
}
configureWrite( data );
this.configureWrite( data );
}
// api
@@ -145,12 +145,12 @@ public class PacketInventoryAction extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( action.ordinal() );
data.writeInt( slot );
data.writeLong( id );
data.writeBoolean( false );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -41,9 +41,9 @@ public class PacketLightning extends AppEngPacket
// automatic.
public PacketLightning(ByteBuf stream) {
x = stream.readFloat();
y = stream.readFloat();
z = stream.readFloat();
this.x = stream.readFloat();
this.y = stream.readFloat();
this.z = stream.readFloat();
}
@Override
@@ -54,7 +54,7 @@ public class PacketLightning extends AppEngPacket
{
if ( Platform.isClient() && AEConfig.instance.enableEffects )
{
LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), x, y, z, 0.0f, 0.0f, 0.0f );
LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
@@ -72,12 +72,12 @@ public class PacketLightning extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
data.writeFloat( (float) y );
data.writeFloat( (float) z );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -63,10 +63,10 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// automatic.
public PacketMEInventoryUpdate(final ByteBuf stream) throws IOException {
data = null;
compressFrame = null;
list = new LinkedList<IAEItemStack>();
ref = stream.readByte();
this.data = null;
this.compressFrame = null;
this.list = new LinkedList<IAEItemStack>();
this.ref = stream.readByte();
// int originalBytes = stream.readableBytes();
@@ -97,9 +97,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// AELog.info( "Receiver: " + originalBytes + " -> " + uncompressedBytes );
while (uncompressed.readableBytes() > 0)
list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
empty = list.isEmpty();
this.empty = this.list.isEmpty();
}
@Override
@@ -109,16 +109,16 @@ public class PacketMEInventoryUpdate extends AppEngPacket
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiCraftConfirm )
((GuiCraftConfirm) gs).postUpdate( list, ref );
((GuiCraftConfirm) gs).postUpdate( this.list, this.ref );
if ( gs instanceof GuiCraftingCPU )
((GuiCraftingCPU) gs).postUpdate( list, ref );
((GuiCraftingCPU) gs).postUpdate( this.list, this.ref );
if ( gs instanceof GuiMEMonitorable )
((GuiMEMonitorable) gs).postUpdate( list );
((GuiMEMonitorable) gs).postUpdate( this.list );
if ( gs instanceof GuiNetworkStatus )
((GuiNetworkStatus) gs).postUpdate( list );
((GuiNetworkStatus) gs).postUpdate( this.list );
}
@@ -127,9 +127,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
try
{
compressFrame.close();
this.compressFrame.close();
configureWrite( data );
this.configureWrite( this.data );
return super.getProxy();
}
catch (IOException e)
@@ -147,21 +147,21 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// api
public PacketMEInventoryUpdate(byte ref) throws IOException {
data = Unpooled.buffer( 2048 );
data.writeInt( getPacketID() );
data.writeByte( this.ref = ref );
this.data = Unpooled.buffer( 2048 );
this.data.writeInt( this.getPacketID() );
this.data.writeByte( this.ref = ref );
compressFrame = new GZIPOutputStream( new OutputStream() {
this.compressFrame = new GZIPOutputStream( new OutputStream() {
@Override
public void write(int value) throws IOException
{
data.writeByte( value );
PacketMEInventoryUpdate.this.data.writeByte( value );
}
} );
list = null;
this.list = null;
}
public void appendItem(IAEItemStack is) throws IOException, BufferOverflowException
@@ -169,25 +169,25 @@ public class PacketMEInventoryUpdate extends AppEngPacket
ByteBuf tmp = Unpooled.buffer( 2048 );
is.writeToPacket( tmp );
compressFrame.flush();
if ( writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
this.compressFrame.flush();
if ( this.writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
throw new BufferOverflowException();
else
{
writtenBytes += tmp.readableBytes();
compressFrame.write( tmp.array(), 0, tmp.readableBytes() );
empty = false;
this.writtenBytes += tmp.readableBytes();
this.compressFrame.write( tmp.array(), 0, tmp.readableBytes() );
this.empty = false;
}
}
public int getLength()
{
return data.readableBytes();
return this.data.readableBytes();
}
public boolean isEmpty()
{
return empty;
return this.empty;
}
}
@@ -46,13 +46,13 @@ public class PacketMatterCannon extends AppEngPacket
// automatic.
public PacketMatterCannon(ByteBuf stream)
{
x = stream.readFloat();
y = stream.readFloat();
z = stream.readFloat();
dx = stream.readFloat();
dy = stream.readFloat();
dz = stream.readFloat();
len = stream.readByte();
this.x = stream.readFloat();
this.y = stream.readFloat();
this.z = stream.readFloat();
this.dx = stream.readFloat();
this.dy = stream.readFloat();
this.dz = stream.readFloat();
this.len = stream.readByte();
}
@Override
@@ -63,9 +63,9 @@ public class PacketMatterCannon extends AppEngPacket
{
World world = FMLClientHandler.instance().getClient().theWorld;
for (int a = 1; a < len; a++)
for (int a = 1; a < this.len; a++)
{
MatterCannonFX fx = new MatterCannonFX( world, x + dx * a, y + dy * a, z + dz * a, Items.diamond );
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 );
}
@@ -91,7 +91,7 @@ public class PacketMatterCannon extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
data.writeFloat( (float) y );
data.writeFloat( (float) z );
@@ -100,7 +100,7 @@ public class PacketMatterCannon extends AppEngPacket
data.writeFloat( (float) this.dz );
data.writeByte( len );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -47,9 +47,9 @@ public class PacketMockExplosion extends AppEngPacket
// automatic.
public PacketMockExplosion(ByteBuf stream)
{
x = stream.readDouble();
y = stream.readDouble();
z = stream.readDouble();
this.x = stream.readDouble();
this.y = stream.readDouble();
this.z = stream.readDouble();
}
// api
@@ -61,12 +61,12 @@ public class PacketMockExplosion extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeDouble( x );
data.writeDouble( y );
data.writeDouble( z );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -54,9 +54,9 @@ public class PacketMultiPart extends AppEngPacket
{
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -68,16 +68,16 @@ public class PacketNEIRecipe extends AppEngPacket
NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes );
if ( comp != null )
{
recipe = new ItemStack[9][];
for (int x = 0; x < recipe.length; x++)
this.recipe = new ItemStack[9][];
for (int x = 0; x < this.recipe.length; x++)
{
NBTTagList list = comp.getTagList( "#" + x, 10 );
if ( list.tagCount() > 0 )
{
recipe[x] = new ItemStack[list.tagCount()];
this.recipe[x] = new ItemStack[list.tagCount()];
for (int y = 0; y < list.tagCount(); y++)
{
recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) );
this.recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) );
}
}
}
@@ -108,14 +108,14 @@ public class PacketNEIRecipe extends AppEngPacket
Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;
if ( inv != null && recipe != null && security != null )
if ( inv != null && this.recipe != null && security != null )
{
InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
for (int x = 0; x < 9; x++)
{
if ( recipe[x] != null && recipe[x].length > 0 )
if ( this.recipe[x] != null && this.recipe[x].length > 0 )
{
testInv.setInventorySlotContents(x, recipe[x][0]);
testInv.setInventorySlotContents(x, this.recipe[x][0]);
}
}
@@ -170,9 +170,9 @@ public class PacketNEIRecipe extends AppEngPacket
// TODO see if this code is necessary
if ( whichItem == null )
{
for (int y = 0; y < recipe[x].length; y++)
for (int y = 0; y < this.recipe[x].length; y++)
{
IAEItemStack request = AEItemStack.create( recipe[x][y] );
IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
if ( request != null )
{
if ( filter == null || filter.isListed( request ) )
@@ -228,11 +228,11 @@ public class PacketNEIRecipe extends AppEngPacket
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream outputStream = new DataOutputStream( bytes );
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
CompressedStreamTools.writeCompressed( recipe, outputStream );
data.writeBytes( bytes.toByteArray() );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -37,7 +37,7 @@ public class PacketNewStorageDimension extends AppEngPacket
// automatic.
public PacketNewStorageDimension(ByteBuf stream)
{
newDim = stream.readInt();
this.newDim = stream.readInt();
}
@Override
@@ -46,7 +46,7 @@ public class PacketNewStorageDimension extends AppEngPacket
{
try
{
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
DimensionManager.registerDimension( this.newDim, AEConfig.instance.storageProviderID );
}
catch (IllegalArgumentException iae)
{
@@ -61,10 +61,10 @@ public class PacketNewStorageDimension extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( newDim );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -38,16 +38,16 @@ public class PacketPaintedEntity extends AppEngPacket
// automatic.
public PacketPaintedEntity(ByteBuf stream)
{
entityId = stream.readInt();
myColor = AEColor.values()[stream.readByte()];
ticks = stream.readInt();
this.entityId = stream.readInt();
this.myColor = AEColor.values()[stream.readByte()];
this.ticks = stream.readInt();
}
@Override
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
PlayerColor pc = new PlayerColor( entityId, myColor, ticks );
TickHandler.instance.getPlayerColors().put( entityId, pc );
PlayerColor pc = new PlayerColor( this.entityId, this.myColor, this.ticks );
TickHandler.instance.getPlayerColors().put( this.entityId, pc );
}
// api
@@ -55,11 +55,11 @@ public class PacketPaintedEntity extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( this.entityId = myEntity );
data.writeByte( (this.myColor = myColor).ordinal() );
data.writeInt( ticksLeft );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -37,11 +37,11 @@ public class PacketPartPlacement extends AppEngPacket
// automatic.
public PacketPartPlacement(ByteBuf stream)
{
x = stream.readInt();
y = stream.readInt();
z = stream.readInt();
face = stream.readByte();
eyeHeight = stream.readFloat();
this.x = stream.readInt();
this.y = stream.readInt();
this.z = stream.readInt();
this.face = stream.readByte();
this.eyeHeight = stream.readFloat();
}
@Override
@@ -49,8 +49,8 @@ public class PacketPartPlacement extends AppEngPacket
{
EntityPlayerMP sender = (EntityPlayerMP) player;
CommonHelper.proxy.updateRenderMode( sender );
PartPlacement.eyeHeight = eyeHeight;
PartPlacement.place( sender.getHeldItem(), x, y, z, face, sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
PartPlacement.eyeHeight = this.eyeHeight;
PartPlacement.place( sender.getHeldItem(), this.x, this.y, this.z, this.face, sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 );
CommonHelper.proxy.updateRenderMode( null );
}
@@ -59,14 +59,14 @@ public class PacketPartPlacement extends AppEngPacket
{
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( x );
data.writeInt( y );
data.writeInt( z );
data.writeByte( face );
data.writeFloat( eyeHeight );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -35,8 +35,8 @@ public class PacketPartialItem extends AppEngPacket
// automatic.
public PacketPartialItem(ByteBuf stream)
{
pageNum = stream.readShort();
stream.readBytes( data = new byte[stream.readableBytes()] );
this.pageNum = stream.readShort();
stream.readBytes( this.data = new byte[stream.readableBytes()] );
}
@Override
@@ -54,28 +54,28 @@ public class PacketPartialItem extends AppEngPacket
ByteBuf data = Unpooled.buffer();
pageNum = (short) (page | (maxPages << 8));
this.pageNum = (short) (page | (maxPages << 8));
this.data = buf;
data.writeInt( getPacketID() );
data.writeShort( pageNum );
data.writeInt( this.getPacketID() );
data.writeShort( this.pageNum );
data.writeBytes( buf );
configureWrite( data );
this.configureWrite( data );
}
public int getPageCount()
{
return pageNum >> 8;
return this.pageNum >> 8;
}
public int getSize()
{
return data.length;
return this.data.length;
}
public int write(byte[] buffer, int cursor)
{
System.arraycopy( data, 0, buffer, cursor, data.length );
return cursor + data.length;
System.arraycopy( this.data, 0, buffer, cursor, this.data.length );
return cursor + this.data.length;
}
}
@@ -55,12 +55,12 @@ public class PacketPatternSlot extends AppEngPacket
// automatic.
public PacketPatternSlot(ByteBuf stream) throws IOException {
shift = stream.readBoolean();
this.shift = stream.readBoolean();
slotItem = readItem( stream );
this.slotItem = this.readItem( stream );
for (int x = 0; x < 9; x++)
pattern[x] = readItem( stream );
this.pattern[x] = this.readItem( stream );
}
@Override
@@ -93,18 +93,18 @@ public class PacketPatternSlot extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeBoolean( shift );
writeItem( slotItem, data );
this.writeItem( slotItem, data );
for (int x = 0; x < 9; x++)
{
pattern[x] = AEApi.instance().storage().createItemStack( pat.getStackInSlot( x ) );
writeItem( pattern[x], data );
this.pattern[x] = AEApi.instance().storage().createItemStack( pat.getStackInSlot( x ) );
this.writeItem( this.pattern[x], data );
}
configureWrite( data );
this.configureWrite( data );
}
}
@@ -36,8 +36,8 @@ public class PacketProgressBar extends AppEngPacket
// automatic.
public PacketProgressBar(ByteBuf stream)
{
id = stream.readShort();
value = stream.readLong();
this.id = stream.readShort();
this.value = stream.readLong();
}
@Override
@@ -45,7 +45,7 @@ public class PacketProgressBar extends AppEngPacket
{
Container c = player.openContainer;
if ( c instanceof AEBaseContainer )
((AEBaseContainer) c).updateFullProgressBar( id, value );
((AEBaseContainer) c).updateFullProgressBar( this.id, this.value );
}
@Override
@@ -53,7 +53,7 @@ public class PacketProgressBar extends AppEngPacket
{
Container c = player.openContainer;
if ( c instanceof AEBaseContainer )
((AEBaseContainer) c).updateFullProgressBar( id, value );
((AEBaseContainer) c).updateFullProgressBar( this.id, this.value );
}
// api
@@ -64,10 +64,10 @@ public class PacketProgressBar extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeShort( short_id );
data.writeLong( value );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -35,8 +35,8 @@ public class PacketSwapSlots extends AppEngPacket
// automatic.
public PacketSwapSlots(ByteBuf stream)
{
slotA = stream.readInt();
slotB = stream.readInt();
this.slotA = stream.readInt();
this.slotB = stream.readInt();
}
@Override
@@ -44,7 +44,7 @@ public class PacketSwapSlots extends AppEngPacket
{
if ( player != null && player.openContainer instanceof AEBaseContainer )
{
((AEBaseContainer) player.openContainer).swapSlotContents( slotA, slotB );
((AEBaseContainer) player.openContainer).swapSlotContents( this.slotA, this.slotB );
}
}
@@ -53,10 +53,10 @@ public class PacketSwapSlots extends AppEngPacket
{
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( this.slotA = slotA );
data.writeInt( this.slotB = slotB );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -40,7 +40,7 @@ public class PacketSwitchGuis extends AppEngPacket
// automatic.
public PacketSwitchGuis(ByteBuf stream)
{
newGui = GuiBridge.values()[stream.readInt()];
this.newGui = GuiBridge.values()[stream.readInt()];
}
@Override
@@ -54,7 +54,7 @@ public class PacketSwitchGuis extends AppEngPacket
if ( context != null )
{
TileEntity te = context.getTile();
Platform.openGUI( player, te, context.side, newGui );
Platform.openGUI( player, te, context.side, this.newGui );
}
}
}
@@ -75,9 +75,9 @@ public class PacketSwitchGuis extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeInt( newGui.ordinal() );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -50,11 +50,11 @@ public class PacketTransitionEffect extends AppEngPacket
// automatic.
public PacketTransitionEffect(ByteBuf stream)
{
x = stream.readFloat();
y = stream.readFloat();
z = stream.readFloat();
d = ForgeDirection.getOrientation( stream.readByte() );
mode = stream.readBoolean();
this.x = stream.readFloat();
this.y = stream.readFloat();
this.z = stream.readFloat();
this.d = ForgeDirection.getOrientation( stream.readByte() );
this.mode = stream.readBoolean();
}
@Override
@@ -63,33 +63,33 @@ public class PacketTransitionEffect extends AppEngPacket
{
World world = ClientHelper.proxy.getWorld();
for (int zz = 0; zz < (mode ? 32 : 8); zz++)
for (int zz = 0; zz < (this.mode ? 32 : 8); zz++)
if ( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
{
EnergyFx fx = new EnergyFx( world, x + (mode ? (Platform.getRandomInt() % 100) * 0.01 : (Platform.getRandomInt() % 100) * 0.005 - 0.25), y
+ (mode ? (Platform.getRandomInt() % 100) * 0.01 : (Platform.getRandomInt() % 100) * 0.005 - 0.25), z
+ (mode ? (Platform.getRandomInt() % 100) * 0.01 : (Platform.getRandomInt() % 100) * 0.005 - 0.25), Items.diamond );
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 ( !mode )
fx.fromItem( d );
if ( !this.mode )
fx.fromItem( this.d );
fx.motionX = -0.1 * d.offsetX;
fx.motionY = -0.1 * d.offsetY;
fx.motionZ = -0.1 * d.offsetZ;
fx.motionX = -0.1 * this.d.offsetX;
fx.motionY = -0.1 * this.d.offsetY;
fx.motionZ = -0.1 * this.d.offsetZ;
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
if ( mode )
if ( this.mode )
{
Block block = world.getBlock( (int) x, (int) y, (int) z );
Block block = world.getBlock( (int) this.x, (int) this.y, (int) this.z );
Minecraft
.getMinecraft()
.getSoundHandler()
.playSound(
new PositionedSoundRecord( new ResourceLocation( block.stepSound.getBreakSound() ), (block.stepSound.getVolume() + 1.0F) / 2.0F,
block.stepSound.getPitch() * 0.8F, (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F ) );
block.stepSound.getPitch() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
}
}
@@ -104,14 +104,14 @@ public class PacketTransitionEffect extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
data.writeFloat( (float) x );
data.writeFloat( (float) y );
data.writeFloat( (float) z );
data.writeByte( this.d.ordinal() );
data.writeBoolean( wasBlock );
configureWrite( data );
this.configureWrite( data );
}
}
@@ -61,8 +61,8 @@ public class PacketValueConfig extends AppEngPacket
// automatic.
public PacketValueConfig(ByteBuf stream) throws IOException {
DataInputStream dis = new DataInputStream( new ByteArrayInputStream( stream.array(), stream.readerIndex(), stream.readableBytes() ) );
Name = dis.readUTF();
Value = dis.readUTF();
this.Name = dis.readUTF();
this.Value = dis.readUTF();
// dis.close();
}
@@ -71,109 +71,109 @@ public class PacketValueConfig extends AppEngPacket
{
Container c = player.openContainer;
if ( Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
if ( this.Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
{
ItemStack is = player.getHeldItem();
IMouseWheelItem si = (IMouseWheelItem) is.getItem();
si.onWheel( is, Value.equals( "WheelUp" ) );
si.onWheel( is, this.Value.equals( "WheelUp" ) );
}
else if ( Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftingStatus )
else if ( this.Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftingStatus )
{
ContainerCraftingStatus qk = (ContainerCraftingStatus) c;
qk.cycleCpu( Value.equals( "Next" ) );
qk.cycleCpu( this.Value.equals( "Next" ) );
}
else if ( Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftConfirm )
else if ( this.Name.equals( "Terminal.Cpu" ) && c instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
qk.cycleCpu( Value.equals( "Next" ) );
qk.cycleCpu( this.Value.equals( "Next" ) );
}
else if ( Name.equals( "Terminal.Start" ) && c instanceof ContainerCraftConfirm )
else if ( this.Name.equals( "Terminal.Start" ) && c instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
qk.startJob();
}
else if ( Name.equals( "TileCrafting.Cancel" ) && c instanceof ContainerCraftingCPU )
else if ( this.Name.equals( "TileCrafting.Cancel" ) && c instanceof ContainerCraftingCPU )
{
ContainerCraftingCPU qk = (ContainerCraftingCPU) c;
qk.cancelCrafting();
}
else if ( Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
else if ( this.Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
{
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
qk.setName( Value );
qk.setName( this.Value );
}
else if ( Name.equals( "TileSecurity.ToggleOption" ) && c instanceof ContainerSecurity )
else if ( this.Name.equals( "TileSecurity.ToggleOption" ) && c instanceof ContainerSecurity )
{
ContainerSecurity sc = (ContainerSecurity) c;
sc.toggleSetting( Value, player );
sc.toggleSetting( this.Value, player );
}
else if ( Name.equals( "PriorityHost.Priority" ) && c instanceof ContainerPriority )
else if ( this.Name.equals( "PriorityHost.Priority" ) && c instanceof ContainerPriority )
{
ContainerPriority pc = (ContainerPriority) c;
pc.setPriority( Integer.parseInt( Value ), player );
pc.setPriority( Integer.parseInt( this.Value ), player );
}
else if ( Name.equals( "LevelEmitter.Value" ) && c instanceof ContainerLevelEmitter )
else if ( this.Name.equals( "LevelEmitter.Value" ) && c instanceof ContainerLevelEmitter )
{
ContainerLevelEmitter lvc = (ContainerLevelEmitter) c;
lvc.setLevel( Long.parseLong( Value ), player );
lvc.setLevel( Long.parseLong( this.Value ), player );
}
else if ( Name.startsWith( "PatternTerminal." ) && c instanceof ContainerPatternTerm )
else if ( this.Name.startsWith( "PatternTerminal." ) && c instanceof ContainerPatternTerm )
{
ContainerPatternTerm cpt = (ContainerPatternTerm) c;
if ( Name.equals( "PatternTerminal.CraftMode" ) )
if ( this.Name.equals( "PatternTerminal.CraftMode" ) )
{
cpt.ct.setCraftingRecipe( Value.equals( "1" ) );
cpt.ct.setCraftingRecipe( this.Value.equals( "1" ) );
}
else if ( Name.equals( "PatternTerminal.Encode" ) )
else if ( this.Name.equals( "PatternTerminal.Encode" ) )
{
cpt.encode();
}
else if ( Name.equals( "PatternTerminal.Clear" ) )
else if ( this.Name.equals( "PatternTerminal.Clear" ) )
{
cpt.clear();
}
}
else if ( Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus )
else if ( this.Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus )
{
ContainerStorageBus ccw = (ContainerStorageBus) c;
if ( Name.equals( "StorageBus.Action" ) )
if ( this.Name.equals( "StorageBus.Action" ) )
{
if ( Value.equals( "Partition" ) )
if ( this.Value.equals( "Partition" ) )
{
ccw.partition();
}
else if ( Value.equals( "Clear" ) )
else if ( this.Value.equals( "Clear" ) )
{
ccw.clear();
}
}
}
else if ( Name.startsWith( "CellWorkbench." ) && c instanceof ContainerCellWorkbench )
else if ( this.Name.startsWith( "CellWorkbench." ) && c instanceof ContainerCellWorkbench )
{
ContainerCellWorkbench ccw = (ContainerCellWorkbench) c;
if ( Name.equals( "CellWorkbench.Action" ) )
if ( this.Name.equals( "CellWorkbench.Action" ) )
{
if ( Value.equals( "CopyMode" ) )
if ( this.Value.equals( "CopyMode" ) )
{
ccw.nextCopyMode();
}
else if ( Value.equals( "Partition" ) )
else if ( this.Value.equals( "Partition" ) )
{
ccw.partition();
}
else if ( Value.equals( "Clear" ) )
else if ( this.Value.equals( "Clear" ) )
{
ccw.clear();
}
}
else if ( Name.equals( "CellWorkbench.Fuzzy" ) )
else if ( this.Name.equals( "CellWorkbench.Fuzzy" ) )
{
ccw.setFuzzy( FuzzyMode.valueOf( Value ) );
ccw.setFuzzy( FuzzyMode.valueOf( this.Value ) );
}
}
else if ( c instanceof ContainerNetworkTool )
{
if ( Name.equals( "NetworkTool" ) && Value.equals( "Toggle" ) )
if ( this.Name.equals( "NetworkTool" ) && this.Value.equals( "Toggle" ) )
{
((ContainerNetworkTool) c).toggleFacadeMode();
}
@@ -184,13 +184,13 @@ public class PacketValueConfig extends AppEngPacket
for (Enum e : cm.getSettings())
{
if ( e.name().equals( Name ) )
if ( e.name().equals( this.Name ) )
{
Enum def = cm.getSetting( e );
try
{
cm.putSetting( e, Enum.valueOf( def.getClass(), Value ) );
cm.putSetting( e, Enum.valueOf( def.getClass(), this.Value ) );
}
catch (IllegalArgumentException err)
{
@@ -209,15 +209,15 @@ public class PacketValueConfig extends AppEngPacket
{
Container c = player.openContainer;
if ( Name.equals( "CustomName" ) && c instanceof AEBaseContainer )
if ( this.Name.equals( "CustomName" ) && c instanceof AEBaseContainer )
{
((AEBaseContainer) c).customName = Value;
((AEBaseContainer) c).customName = this.Value;
}
else if ( Name.startsWith( "SyncDat." ) )
else if ( this.Name.startsWith( "SyncDat." ) )
{
((AEBaseContainer) c).stringSync( Integer.parseInt( Name.substring( 8 ) ), Value );
((AEBaseContainer) c).stringSync( Integer.parseInt( this.Name.substring( 8 ) ), this.Value );
}
else if ( Name.equals( "CraftingStatus" ) && Value.equals( "Clear" ) )
else if ( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiCraftingCPU )
@@ -229,13 +229,13 @@ public class PacketValueConfig extends AppEngPacket
for (Enum e : cm.getSettings())
{
if ( e.name().equals( Name ) )
if ( e.name().equals( this.Name ) )
{
Enum def = cm.getSetting( e );
try
{
cm.putSetting( e, Enum.valueOf( def.getClass(), Value ) );
cm.putSetting( e, Enum.valueOf( def.getClass(), this.Value ) );
}
catch (IllegalArgumentException err)
{
@@ -256,7 +256,7 @@ public class PacketValueConfig extends AppEngPacket
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.getPacketID() );
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream( bos );
@@ -266,6 +266,6 @@ public class PacketValueConfig extends AppEngPacket
data.writeBytes( bos.toByteArray() );
configureWrite( data );
this.configureWrite( data );
}
}