Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -38,8 +38,9 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
public abstract class AppEngPacket implements Packet
|
||||
{
|
||||
|
||||
AppEngPacketHandlerBase.PacketTypes id;
|
||||
private AppEngPacketHandlerBase.PacketTypes id;
|
||||
private PacketBuffer p;
|
||||
private PacketCallState caller;
|
||||
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
@@ -59,7 +60,7 @@ public abstract class AppEngPacket implements Packet
|
||||
protected void configureWrite( final ByteBuf data )
|
||||
{
|
||||
data.capacity( data.readableBytes() );
|
||||
this.p = new PacketBuffer(data);
|
||||
this.p = new PacketBuffer( data );
|
||||
}
|
||||
|
||||
public FMLProxyPacket getProxy()
|
||||
@@ -78,28 +79,28 @@ public abstract class AppEngPacket implements Packet
|
||||
|
||||
return pp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketData( final PacketBuffer buf) throws IOException
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData( final PacketBuffer buf) throws IOException
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
public void readPacketData( final PacketBuffer buf ) throws IOException
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
|
||||
PacketCallState caller;
|
||||
|
||||
public void setCallParam( final PacketCallState call ){
|
||||
this.caller = call;}
|
||||
|
||||
@Override
|
||||
public void processPacket( final INetHandler handler)
|
||||
{
|
||||
public void writePacketData( final PacketBuffer buf ) throws IOException
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
|
||||
public void setCallParam( final PacketCallState call )
|
||||
{
|
||||
this.caller = call;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket( final INetHandler handler )
|
||||
{
|
||||
this.caller.call( this );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class AppEngPacketHandlerBase
|
||||
return ( values() )[id];
|
||||
}
|
||||
|
||||
public static PacketTypes getID( final Class<? extends AppEngPacket> c )
|
||||
static PacketTypes getID( final Class<? extends AppEngPacket> c )
|
||||
{
|
||||
return REVERSE_LOOKUP.get( c );
|
||||
}
|
||||
|
||||
@@ -323,12 +323,12 @@ public enum GuiBridge implements IGuiHandler
|
||||
if( newContainer instanceof AEBaseContainer )
|
||||
{
|
||||
final AEBaseContainer bc = (AEBaseContainer) newContainer;
|
||||
bc.openContext = new ContainerOpenContext( myItem );
|
||||
bc.openContext.w = w;
|
||||
bc.openContext.x = x;
|
||||
bc.openContext.y = y;
|
||||
bc.openContext.z = z;
|
||||
bc.openContext.side = side;
|
||||
bc.setOpenContext( new ContainerOpenContext( myItem ) );
|
||||
bc.getOpenContext().setWorld( w );
|
||||
bc.getOpenContext().setX( x );
|
||||
bc.getOpenContext().setY( y );
|
||||
bc.getOpenContext().setZ( z );
|
||||
bc.getOpenContext().setSide( side );
|
||||
}
|
||||
|
||||
return newContainer;
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum GuiHostType
|
||||
return this != WORLD;
|
||||
}
|
||||
|
||||
public boolean isTile()
|
||||
boolean isTile()
|
||||
{
|
||||
return this != ITEM;
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ public class NetworkHandler
|
||||
{
|
||||
public static NetworkHandler instance;
|
||||
|
||||
final FMLEventChannel ec;
|
||||
final String myChannelName;
|
||||
private final FMLEventChannel ec;
|
||||
private final String myChannelName;
|
||||
|
||||
final IPacketHandler clientHandler;
|
||||
final IPacketHandler serveHandler;
|
||||
private final IPacketHandler clientHandler;
|
||||
private final IPacketHandler serveHandler;
|
||||
|
||||
public NetworkHandler( final String channelName )
|
||||
{
|
||||
|
||||
@@ -39,9 +39,9 @@ import appeng.util.item.AEItemStack;
|
||||
public class PacketAssemblerAnimation extends AppEngPacket
|
||||
{
|
||||
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
public final byte rate;
|
||||
public final IAEItemStack is;
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ import appeng.items.tools.powered.ToolColorApplicator;
|
||||
public class PacketClick extends AppEngPacket
|
||||
{
|
||||
|
||||
final int x;
|
||||
final int y;
|
||||
final int z;
|
||||
final int side;
|
||||
final float hitX;
|
||||
final float hitY;
|
||||
final float hitZ;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private final int side;
|
||||
private final float hitX;
|
||||
private final float hitY;
|
||||
private final float hitZ;
|
||||
|
||||
// automatic.
|
||||
public PacketClick( final ByteBuf stream )
|
||||
|
||||
@@ -34,12 +34,12 @@ import appeng.services.compass.ICompassCallback;
|
||||
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
|
||||
{
|
||||
|
||||
public final long attunement;
|
||||
public final int cx;
|
||||
public final int cz;
|
||||
public final int cdy;
|
||||
final long attunement;
|
||||
final int cx;
|
||||
final int cz;
|
||||
final int cdy;
|
||||
|
||||
EntityPlayer talkBackTo;
|
||||
private EntityPlayer talkBackTo;
|
||||
|
||||
// automatic.
|
||||
public PacketCompassRequest( final ByteBuf stream )
|
||||
|
||||
@@ -31,12 +31,12 @@ import appeng.hooks.CompassResult;
|
||||
public class PacketCompassResponse extends AppEngPacket
|
||||
{
|
||||
|
||||
public final long attunement;
|
||||
public final int cx;
|
||||
public final int cz;
|
||||
public final int cdy;
|
||||
private final long attunement;
|
||||
private final int cx;
|
||||
private final int cz;
|
||||
private final int cdy;
|
||||
|
||||
public CompassResult cr;
|
||||
private CompassResult cr;
|
||||
|
||||
// automatic.
|
||||
public PacketCompassResponse( final ByteBuf stream )
|
||||
|
||||
@@ -46,12 +46,10 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
{
|
||||
|
||||
// input.
|
||||
final NBTTagCompound in;
|
||||
private final NBTTagCompound in;
|
||||
// output...
|
||||
private final ByteBuf data;
|
||||
private final GZIPOutputStream compressFrame;
|
||||
int writtenBytes = 0;
|
||||
boolean empty = true;
|
||||
|
||||
// automatic.
|
||||
public PacketCompressedNBT( final ByteBuf stream ) throws IOException
|
||||
|
||||
@@ -45,8 +45,8 @@ import appeng.util.Platform;
|
||||
public class PacketCraftRequest extends AppEngPacket
|
||||
{
|
||||
|
||||
public final long amount;
|
||||
public final boolean heldShift;
|
||||
private final long amount;
|
||||
private final boolean heldShift;
|
||||
|
||||
// automatic.
|
||||
public PacketCraftRequest( final ByteBuf stream )
|
||||
@@ -86,30 +86,30 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
}
|
||||
|
||||
final IGrid g = gn.getGrid();
|
||||
if( g == null || cca.whatToMake == null )
|
||||
if( g == null || cca.getItemToCraft() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cca.whatToMake.setStackSize( this.amount );
|
||||
cca.getItemToCraft().setStackSize( this.amount );
|
||||
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try
|
||||
{
|
||||
final ICraftingGrid cg = g.getCache( ICraftingGrid.class );
|
||||
futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.whatToMake, null );
|
||||
futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null );
|
||||
|
||||
final ContainerOpenContext context = cca.openContext;
|
||||
final ContainerOpenContext context = cca.getOpenContext();
|
||||
if( context != null )
|
||||
{
|
||||
final TileEntity te = context.getTile();
|
||||
Platform.openGUI( player, te, cca.openContext.side, GuiBridge.GUI_CRAFTING_CONFIRM );
|
||||
Platform.openGUI( player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM );
|
||||
|
||||
if( player.openContainer instanceof ContainerCraftConfirm )
|
||||
{
|
||||
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
|
||||
ccc.autoStart = this.heldShift;
|
||||
ccc.job = futureJob;
|
||||
ccc.setAutoStart( this.heldShift );
|
||||
ccc.setJob( futureJob );
|
||||
cca.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ import appeng.util.item.AEItemStack;
|
||||
public class PacketInventoryAction extends AppEngPacket
|
||||
{
|
||||
|
||||
public final InventoryAction action;
|
||||
public final int slot;
|
||||
public final long id;
|
||||
public final IAEItemStack slotItem;
|
||||
private final InventoryAction action;
|
||||
private final int slot;
|
||||
private final long id;
|
||||
private final IAEItemStack slotItem;
|
||||
|
||||
// automatic.
|
||||
public PacketInventoryAction( final ByteBuf stream ) throws IOException
|
||||
@@ -127,11 +127,11 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
|
||||
if( this.action == InventoryAction.AUTO_CRAFT )
|
||||
{
|
||||
final ContainerOpenContext context = baseContainer.openContext;
|
||||
final ContainerOpenContext context = baseContainer.getOpenContext();
|
||||
if( context != null )
|
||||
{
|
||||
final TileEntity te = context.getTile();
|
||||
Platform.openGUI( sender, te, baseContainer.openContext.side, GuiBridge.GUI_CRAFTING_AMOUNT );
|
||||
Platform.openGUI( sender, te, baseContainer.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_AMOUNT );
|
||||
|
||||
if( sender.openContainer instanceof ContainerCraftAmount )
|
||||
{
|
||||
@@ -139,8 +139,8 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
|
||||
if( baseContainer.getTargetStack() != null )
|
||||
{
|
||||
cca.craftingItem.putStack( baseContainer.getTargetStack().getItemStack() );
|
||||
cca.whatToMake = baseContainer.getTargetStack();
|
||||
cca.getCraftingItem().putStack( baseContainer.getTargetStack().getItemStack() );
|
||||
cca.setItemToCraft( baseContainer.getTargetStack() );
|
||||
}
|
||||
|
||||
cca.detectAndSendChanges();
|
||||
|
||||
@@ -36,9 +36,9 @@ import appeng.util.Platform;
|
||||
public class PacketLightning extends AppEngPacket
|
||||
{
|
||||
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
|
||||
// automatic.
|
||||
public PacketLightning( final ByteBuf stream )
|
||||
|
||||
@@ -36,13 +36,13 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketMatterCannon extends AppEngPacket
|
||||
{
|
||||
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
final double dx;
|
||||
final double dy;
|
||||
final double dz;
|
||||
final byte len;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
private final double dx;
|
||||
private final double dy;
|
||||
private final double dz;
|
||||
private final byte len;
|
||||
|
||||
// automatic.
|
||||
public PacketMatterCannon( final ByteBuf stream )
|
||||
|
||||
@@ -34,9 +34,9 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketMockExplosion extends AppEngPacket
|
||||
{
|
||||
|
||||
public final double x;
|
||||
public final double y;
|
||||
public final double z;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
|
||||
// automatic.
|
||||
public PacketMockExplosion( final ByteBuf stream )
|
||||
|
||||
@@ -64,7 +64,7 @@ import appeng.util.prioitylist.IPartitionList;
|
||||
public class PacketNEIRecipe extends AppEngPacket
|
||||
{
|
||||
|
||||
ItemStack[][] recipe;
|
||||
private ItemStack[][] recipe;
|
||||
|
||||
// automatic.
|
||||
public PacketNEIRecipe( final ByteBuf stream ) throws IOException
|
||||
@@ -171,7 +171,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
if( in != null )
|
||||
{
|
||||
final 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.getActionSource() );
|
||||
if( out != null )
|
||||
{
|
||||
craftMatrix.setInventorySlotContents( x, out.getItemStack() );
|
||||
@@ -190,7 +190,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
if( patternItem != null && currentItem == null )
|
||||
{
|
||||
// Grab from network by recipe
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter );
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter );
|
||||
|
||||
// If that doesn't get it, grab exact items from network (?)
|
||||
// TODO see if this code is necessary
|
||||
@@ -204,7 +204,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
if( filter == null || filter.isListed( request ) )
|
||||
{
|
||||
request.setStackSize( 1 );
|
||||
final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getSource() );
|
||||
final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
|
||||
if( out != null )
|
||||
{
|
||||
whichItem = out.getItemStack();
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketNewStorageDimension extends AppEngPacket
|
||||
{
|
||||
|
||||
final int newDim;
|
||||
private final int newDim;
|
||||
|
||||
// automatic.
|
||||
public PacketNewStorageDimension( final ByteBuf stream )
|
||||
|
||||
@@ -34,11 +34,11 @@ import appeng.parts.PartPlacement;
|
||||
public class PacketPartPlacement extends AppEngPacket
|
||||
{
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int face;
|
||||
float eyeHeight;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int face;
|
||||
private float eyeHeight;
|
||||
|
||||
// automatic.
|
||||
public PacketPartPlacement( final ByteBuf stream )
|
||||
@@ -70,8 +70,8 @@ public class PacketPartPlacement extends AppEngPacket
|
||||
{
|
||||
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 );
|
||||
PartPlacement.setEyeHeight( 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 );
|
||||
CommonHelper.proxy.updateRenderMode( null );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketPartialItem extends AppEngPacket
|
||||
{
|
||||
|
||||
final short pageNum;
|
||||
final byte[] data;
|
||||
private final short pageNum;
|
||||
private final byte[] data;
|
||||
|
||||
// automatic.
|
||||
public PacketPartialItem( final ByteBuf stream )
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
}
|
||||
}
|
||||
|
||||
public IAEItemStack readItem( final ByteBuf stream ) throws IOException
|
||||
private IAEItemStack readItem( final ByteBuf stream ) throws IOException
|
||||
{
|
||||
final boolean hasItem = stream.readBoolean();
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketProgressBar extends AppEngPacket
|
||||
{
|
||||
|
||||
final short id;
|
||||
final long value;
|
||||
private final short id;
|
||||
private final long value;
|
||||
|
||||
// automatic.
|
||||
public PacketProgressBar( final ByteBuf stream )
|
||||
|
||||
@@ -30,8 +30,8 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketSwapSlots extends AppEngPacket
|
||||
{
|
||||
|
||||
final int slotA;
|
||||
final int slotB;
|
||||
private final int slotA;
|
||||
private final int slotB;
|
||||
|
||||
// automatic.
|
||||
public PacketSwapSlots( final ByteBuf stream )
|
||||
|
||||
@@ -36,7 +36,7 @@ import appeng.util.Platform;
|
||||
public class PacketSwitchGuis extends AppEngPacket
|
||||
{
|
||||
|
||||
final GuiBridge newGui;
|
||||
private final GuiBridge newGui;
|
||||
|
||||
// automatic.
|
||||
public PacketSwitchGuis( final ByteBuf stream )
|
||||
@@ -51,7 +51,7 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
AEBaseGui.switchingGuis = true;
|
||||
AEBaseGui.setSwitchingGuis( true );
|
||||
}
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
@@ -69,11 +69,11 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
if( c instanceof AEBaseContainer )
|
||||
{
|
||||
final AEBaseContainer bc = (AEBaseContainer) c;
|
||||
final ContainerOpenContext context = bc.openContext;
|
||||
final ContainerOpenContext context = bc.getOpenContext();
|
||||
if( context != null )
|
||||
{
|
||||
final TileEntity te = context.getTile();
|
||||
Platform.openGUI( player, te, context.side, this.newGui );
|
||||
Platform.openGUI( player, te, context.getSide(), this.newGui );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,6 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
AEBaseGui.switchingGuis = true;
|
||||
AEBaseGui.setSwitchingGuis( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ import appeng.util.Platform;
|
||||
public class PacketTransitionEffect extends AppEngPacket
|
||||
{
|
||||
|
||||
public final boolean mode;
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
final AEPartLocation d;
|
||||
private final boolean mode;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
private final AEPartLocation d;
|
||||
|
||||
// automatic.
|
||||
public PacketTransitionEffect( final ByteBuf stream )
|
||||
|
||||
@@ -147,7 +147,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
final ContainerPatternTerm cpt = (ContainerPatternTerm) c;
|
||||
if( this.Name.equals( "PatternTerminal.CraftMode" ) )
|
||||
{
|
||||
cpt.ct.setCraftingRecipe( this.Value.equals( "1" ) );
|
||||
cpt.getPatternTerminal().setCraftingRecipe( this.Value.equals( "1" ) );
|
||||
}
|
||||
else if( this.Name.equals( "PatternTerminal.Encode" ) )
|
||||
{
|
||||
@@ -159,7 +159,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
else if( this.Name.equals( "PatternTerminal.Substitute" ) )
|
||||
{
|
||||
cpt.ct.setSubstitution( this.Value.equals( "1" ) );
|
||||
cpt.getPatternTerminal().setSubstitution( this.Value.equals( "1" ) );
|
||||
}
|
||||
}
|
||||
else if( this.Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus )
|
||||
@@ -184,7 +184,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
if( this.Value.equals( "CopyMode" ) )
|
||||
{
|
||||
ccw.nextCopyMode();
|
||||
ccw.nextWorkBenchCopyMode();
|
||||
}
|
||||
else if( this.Value.equals( "Partition" ) )
|
||||
{
|
||||
@@ -239,7 +239,7 @@ public class PacketValueConfig extends AppEngPacket
|
||||
|
||||
if( this.Name.equals( "CustomName" ) && c instanceof AEBaseContainer )
|
||||
{
|
||||
( (AEBaseContainer) c ).customName = this.Value;
|
||||
( (AEBaseContainer) c ).setCustomName( this.Value );
|
||||
}
|
||||
else if( this.Name.startsWith( "SyncDat." ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user