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:
@@ -106,26 +106,26 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
public static final int NUMBER_OF_PATTERN_SLOTS = 9;
|
||||
|
||||
private static final Collection<Block> BAD_BLOCKS = new HashSet<Block>( 100 );
|
||||
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null };
|
||||
final MultiCraftingTracker craftingTracker;
|
||||
final AENetworkProxy gridProxy;
|
||||
final IInterfaceHost iHost;
|
||||
final BaseActionSource mySource;
|
||||
final BaseActionSource interfaceRequestSource;
|
||||
final ConfigManager cm = new ConfigManager( this );
|
||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
|
||||
final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
|
||||
final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
|
||||
final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage );
|
||||
final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
|
||||
final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<IAEFluidStack>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS );
|
||||
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
private final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null };
|
||||
private final MultiCraftingTracker craftingTracker;
|
||||
private final AENetworkProxy gridProxy;
|
||||
private final IInterfaceHost iHost;
|
||||
private final BaseActionSource mySource;
|
||||
private final BaseActionSource interfaceRequestSource;
|
||||
private final ConfigManager cm = new ConfigManager( this );
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
|
||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
|
||||
private final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage );
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<IAEFluidStack>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS );
|
||||
private final UpgradeInventory upgrades;
|
||||
boolean hasConfig = false;
|
||||
int priority;
|
||||
List<ICraftingPatternDetails> craftingList = null;
|
||||
List<ItemStack> waitingToSend = null;
|
||||
IMEInventory<IAEItemStack> destination;
|
||||
private boolean hasConfig = false;
|
||||
private int priority;
|
||||
private List<ICraftingPatternDetails> craftingList = null;
|
||||
private List<ItemStack> waitingToSend = null;
|
||||
private IMEInventory<IAEItemStack> destination;
|
||||
private boolean isWorking = false;
|
||||
|
||||
public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih )
|
||||
@@ -139,7 +139,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
this.iHost = ih;
|
||||
this.craftingTracker = new MultiCraftingTracker( this.iHost, 9 );
|
||||
this.mySource = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
|
||||
|
||||
final MachineSource actionSource = new MachineSource( this.iHost );
|
||||
this.mySource = actionSource;
|
||||
this.fluids.setChangeSource( actionSource );
|
||||
this.items.setChangeSource( actionSource );
|
||||
|
||||
this.interfaceRequestSource = new InterfaceRequestSource( this.iHost );
|
||||
}
|
||||
|
||||
@@ -245,7 +250,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.updateCraftingList();
|
||||
}
|
||||
|
||||
public void addToSendList( final ItemStack is )
|
||||
private void addToSendList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -313,7 +318,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
public void updateCraftingList()
|
||||
private void updateCraftingList()
|
||||
{
|
||||
final Boolean[] accountedFor = { false, false, false, false, false, false, false, false, false }; // 9...
|
||||
|
||||
@@ -455,7 +460,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public void addToCraftingList( final ItemStack is )
|
||||
private void addToCraftingList( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
@@ -479,7 +484,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasItemsToSend()
|
||||
private boolean hasItemsToSend()
|
||||
{
|
||||
return this.waitingToSend != null && !this.waitingToSend.isEmpty();
|
||||
}
|
||||
@@ -556,7 +561,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
return new TickingRequest( TickRates.Interface.min, TickRates.Interface.max, !this.hasWorkToDo(), true );
|
||||
return new TickingRequest( TickRates.Interface.getMin(), TickRates.Interface.getMax(), !this.hasWorkToDo(), true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -788,7 +793,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public boolean hasConfig()
|
||||
private boolean hasConfig()
|
||||
{
|
||||
return this.hasConfig;
|
||||
}
|
||||
@@ -886,7 +891,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
|
||||
{
|
||||
if( this.hasItemsToSend() || !this.gridProxy.isActive() )
|
||||
if( this.hasItemsToSend() || !this.gridProxy.isActive() || !this.craftingList.contains( patternDetails ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1089,7 +1094,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPart getPart()
|
||||
private IPart getPart()
|
||||
{
|
||||
return (IPart) ( this.iHost instanceof IPart ? this.iHost : null );
|
||||
}
|
||||
@@ -1271,7 +1276,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
public InterfaceInventory( final DualityInterface tileInterface )
|
||||
{
|
||||
super( new AdaptorIInventory( tileInterface.storage ) );
|
||||
this.mySource = new MachineSource( DualityInterface.this.iHost );
|
||||
this.setActionSource( new MachineSource( DualityInterface.this.iHost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface IContainerCraftingPacket
|
||||
/**
|
||||
* @return who are we?
|
||||
*/
|
||||
BaseActionSource getSource();
|
||||
BaseActionSource getActionSource();
|
||||
|
||||
/**
|
||||
* @return consume items?
|
||||
|
||||
@@ -27,10 +27,10 @@ import appeng.api.util.IOrientable;
|
||||
public class LocationRotation implements IOrientable
|
||||
{
|
||||
|
||||
final IBlockAccess w;
|
||||
final int x;
|
||||
final int y;
|
||||
final int z;
|
||||
private final IBlockAccess w;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
public LocationRotation( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
|
||||
@@ -33,9 +33,9 @@ import appeng.block.AEBaseBlock;
|
||||
public class MetaRotation implements IOrientable
|
||||
{
|
||||
|
||||
final boolean useFacing;
|
||||
final IBlockAccess w;
|
||||
final BlockPos pos;
|
||||
private final boolean useFacing;
|
||||
private final IBlockAccess w;
|
||||
private final BlockPos pos;
|
||||
|
||||
public MetaRotation( final IBlockAccess world, final BlockPos pos, final boolean FullFacing )
|
||||
{
|
||||
@@ -64,18 +64,18 @@ public class MetaRotation implements IOrientable
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
final IBlockState state = this.w.getBlockState( this.pos );
|
||||
|
||||
if ( this.useFacing )
|
||||
|
||||
if( this.useFacing )
|
||||
{
|
||||
final EnumFacing f = state == null ? EnumFacing.UP : (EnumFacing) state.getValue( BlockTorch.FACING );
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
Axis a = state == null ? null : (Axis) state.getValue( AEBaseBlock.AXIS_ORIENTATION );
|
||||
|
||||
if ( a == null )
|
||||
|
||||
if( a == null )
|
||||
a = Axis.Y;
|
||||
|
||||
|
||||
switch( a )
|
||||
{
|
||||
case X:
|
||||
@@ -93,7 +93,7 @@ public class MetaRotation implements IOrientable
|
||||
{
|
||||
if( this.w instanceof World )
|
||||
{
|
||||
if ( this.useFacing )
|
||||
if( this.useFacing )
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockTorch.FACING, up ) );
|
||||
else
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) );
|
||||
|
||||
@@ -174,7 +174,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public int getSlot( final ICraftingLink link )
|
||||
int getSlot( final ICraftingLink link )
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
@@ -190,7 +190,7 @@ public class MultiCraftingTracker
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
void cancel()
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
@@ -219,7 +219,7 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBusy( final int slot )
|
||||
boolean isBusy( final int slot )
|
||||
{
|
||||
return this.getLink( slot ) != null || this.getJob( slot ) != null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import appeng.api.networking.security.ISecurityRegistry;
|
||||
public class PlayerSecurityWrapper implements ISecurityRegistry
|
||||
{
|
||||
|
||||
final Map<Integer, EnumSet<SecurityPermissions>> target;
|
||||
private final Map<Integer, EnumSet<SecurityPermissions>> target;
|
||||
|
||||
public PlayerSecurityWrapper( final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms )
|
||||
{
|
||||
|
||||
@@ -28,9 +28,9 @@ import appeng.api.util.AEColor;
|
||||
public class Splotch
|
||||
{
|
||||
|
||||
public final EnumFacing side;
|
||||
public final boolean lumen;
|
||||
public final AEColor color;
|
||||
private final EnumFacing side;
|
||||
private final boolean lumen;
|
||||
private final AEColor color;
|
||||
private final int pos;
|
||||
|
||||
public Splotch( final AEColor col, final boolean lit, final EnumFacing side, final Vec3 position )
|
||||
@@ -72,7 +72,7 @@ public class Splotch
|
||||
this.pos = data.readByte();
|
||||
final int val = data.readByte();
|
||||
|
||||
this.side = EnumFacing.VALUES[ val & 0x07 ];
|
||||
this.side = EnumFacing.VALUES[val & 0x07];
|
||||
this.color = AEColor.values()[( val >> 3 ) & 0x0F];
|
||||
this.lumen = ( ( val >> 7 ) & 0x01 ) > 0;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class Splotch
|
||||
public void writeToStream( final ByteBuf stream )
|
||||
{
|
||||
stream.writeByte( this.pos );
|
||||
final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
|
||||
stream.writeByte( val );
|
||||
}
|
||||
|
||||
@@ -96,7 +96,22 @@ public class Splotch
|
||||
|
||||
public int getSeed()
|
||||
{
|
||||
final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 );
|
||||
final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
|
||||
return Math.abs( this.pos + val );
|
||||
}
|
||||
|
||||
public EnumFacing getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
public AEColor getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public boolean isLumen()
|
||||
{
|
||||
return this.lumen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,16 +54,16 @@ import appeng.tile.networking.TileWireless;
|
||||
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware
|
||||
{
|
||||
|
||||
public final ItemStack effectiveItem;
|
||||
final IWirelessTermHandler wth;
|
||||
final String encryptionKey;
|
||||
final EntityPlayer myPlayer;
|
||||
IGrid targetGrid;
|
||||
IStorageGrid sg;
|
||||
IMEMonitor<IAEItemStack> itemStorage;
|
||||
IWirelessAccessPoint myWap;
|
||||
double sqRange = Double.MAX_VALUE;
|
||||
double myRange = Double.MAX_VALUE;
|
||||
private final ItemStack effectiveItem;
|
||||
private final IWirelessTermHandler wth;
|
||||
private final String encryptionKey;
|
||||
private final EntityPlayer myPlayer;
|
||||
private IGrid targetGrid;
|
||||
private IStorageGrid sg;
|
||||
private IMEMonitor<IAEItemStack> itemStorage;
|
||||
private IWirelessAccessPoint myWap;
|
||||
private double sqRange = Double.MAX_VALUE;
|
||||
private double myRange = Double.MAX_VALUE;
|
||||
private final int inventorySlot;
|
||||
|
||||
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z )
|
||||
|
||||
Reference in New Issue
Block a user