Use qualified method and field access

This commit is contained in:
yueh
2017-08-11 21:43:47 +02:00
parent cdcab7d91c
commit e39855b48f
30 changed files with 207 additions and 205 deletions
+6 -6
View File
@@ -87,7 +87,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
@Override
public void getDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
final IItemHandler inv = getInternalInventory();
final IItemHandler inv = this.getInternalInventory();
for( int l = 0; l < inv.getSlots(); l++ )
{
@@ -114,7 +114,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull EnumFacing side )
{
return getInternalInventory();
return this.getInternalInventory();
}
@Override
@@ -124,11 +124,11 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
{
if( facing == null )
{
return getInternalInventory() != EmptyHandler.INSTANCE;
return this.getInternalInventory() != EmptyHandler.INSTANCE;
}
else
{
return getItemHandlerForSide( facing ) != EmptyHandler.INSTANCE;
return this.getItemHandlerForSide( facing ) != EmptyHandler.INSTANCE;
}
}
return super.hasCapability( capability, facing );
@@ -142,11 +142,11 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
{
if( facing == null )
{
return (T) getInternalInventory();
return (T) this.getInternalInventory();
}
else
{
return (T) getItemHandlerForSide( facing );
return (T) this.getItemHandlerForSide( facing );
}
}
return super.getCapability( capability, facing );
@@ -86,8 +86,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private final InventoryCrafting craftingInv;
private final AppEngInternalInventory gridInv = new AppEngInternalInventory( this, 9 + 1, 1 );
private final AppEngInternalInventory patternInv = new AppEngInternalInventory( this, 1, 1 );
private final IItemHandler gridInvExt = new WrapperFilteredItemHandler( gridInv, new CraftingGridFilter() );
private final IItemHandler internalInv = new WrapperChainedItemHandler( gridInv, patternInv );
private final IItemHandler gridInvExt = new WrapperFilteredItemHandler( this.gridInv, new CraftingGridFilter() );
private final IItemHandler internalInv = new WrapperChainedItemHandler( this.gridInv, this.patternInv );
private final IConfigManager settings;
private final UpgradeInventory upgrades;
private boolean isPowered = false;
@@ -121,7 +121,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.myPattern.isEmpty() )
{
boolean isEmpty = ItemHandlerUtil.isEmpty( gridInv ) && ItemHandlerUtil.isEmpty( patternInv );
boolean isEmpty = ItemHandlerUtil.isEmpty( this.gridInv ) && ItemHandlerUtil.isEmpty( this.patternInv );
if( isEmpty && patternDetails.isCraftable() )
{
@@ -349,7 +349,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
@Override
protected IItemHandler getItemHandlerForSide( EnumFacing side )
{
return gridInvExt;
return this.gridInvExt;
}
@Override
@@ -646,7 +646,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
return false;
}
if( hasPattern() )
if( this.hasPattern() )
{
return TileMolecularAssembler.this.myPlan.isValidItemForSlot( slot, stack, TileMolecularAssembler.this.getWorld() );
}
@@ -44,7 +44,7 @@ import appeng.util.inv.filter.IAEItemFilter;
public class TileGrinder extends AEBaseInvTile implements ICrankable
{
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
private final IItemHandler invExt = new WrapperFilteredItemHandler( inv, new GrinderFilter() );
private final IItemHandler invExt = new WrapperFilteredItemHandler( this.inv, new GrinderFilter() );
private int points;
@Override
@@ -85,7 +85,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
{
for( int x = 0; x < 3; x++ )
{
ItemStack item = inv.getStackInSlot( x );
ItemStack item = this.inv.getStackInSlot( x );
if( item.isEmpty() )
{
continue;
@@ -105,8 +105,8 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
item = ItemStack.EMPTY;
}
inv.setStackInSlot( x, item );
inv.setStackInSlot( 6, ais );
this.inv.setStackInSlot( x, item );
this.inv.setStackInSlot( 6, ais );
return true;
}
}
@@ -126,7 +126,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
this.points++;
final ItemStack processing = inv.getStackInSlot( 6 );
final ItemStack processing = this.inv.getStackInSlot( 6 );
final IGrinderRecipe r = AEApi.instance().registries().grinder().getRecipeForInput( processing );
if( r != null )
{
@@ -136,7 +136,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
this.points = 0;
final InventoryAdaptor sia = new AdaptorItemHandler( new RangedWrapper( inv, 3, 6 ) );
final InventoryAdaptor sia = new AdaptorItemHandler( new RangedWrapper( this.inv, 3, 6 ) );
this.addItem( sia, r.getOutput() );
@@ -160,7 +160,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
} );
inv.setStackInSlot( 6, ItemStack.EMPTY );
this.inv.setStackInSlot( 6, ItemStack.EMPTY );
}
}
@@ -123,7 +123,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
protected int getStackLimit( int slot, @Nonnull ItemStack stack )
{
return Math.min( getSlotLimit( slot ), stack.getMaxStackSize() );
return Math.min( this.getSlotLimit( slot ), stack.getMaxStackSize() );
}
@Override
@@ -151,8 +151,8 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
return ItemStack.EMPTY;
}
ItemStack existing = getStackInSlot( slot );
int limit = getStackLimit( slot, stack );
ItemStack existing = this.getStackInSlot( slot );
int limit = this.getStackLimit( slot, stack );
if( !existing.isEmpty() )
{
@@ -181,7 +181,8 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
{
existing.grow( reachedLimit ? limit : stack.getCount() );
}
fireOnChangeInventory( slot, InvOperation.INSERT, ItemStack.EMPTY, reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack );
this.fireOnChangeInventory( slot, InvOperation.INSERT, ItemStack.EMPTY,
reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack );
}
return reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, stack.getCount() - limit ) : ItemStack.EMPTY;
}
@@ -198,7 +199,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
if( !simulate )
{
this.inv[slot] = null;
fireOnChangeInventory( slot, InvOperation.EXTRACT, split, ItemStack.EMPTY );
this.fireOnChangeInventory( slot, InvOperation.EXTRACT, split, ItemStack.EMPTY );
}
return split;
}
@@ -207,7 +208,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
if( !simulate )
{
split.grow( -amount );
fireOnChangeInventory( slot, InvOperation.EXTRACT, ItemHandlerHelper.copyStackWithSize( split, amount ), ItemStack.EMPTY );
this.fireOnChangeInventory( slot, InvOperation.EXTRACT, ItemHandlerHelper.copyStackWithSize( split, amount ), ItemStack.EMPTY );
}
return ItemHandlerHelper.copyStackWithSize( split, amount );
}
@@ -245,7 +246,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
removed = added = ItemStack.EMPTY;
}
}
fireOnChangeInventory( slot, InvOperation.SET, removed, added );
this.fireOnChangeInventory( slot, InvOperation.SET, removed, added );
}
}
@@ -283,6 +284,6 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
@Override
public void markDirty( int slot )
{
fireOnChangeInventory( slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
this.fireOnChangeInventory( slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
}
}
@@ -70,14 +70,14 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
@Override
public int getSlotLimit( int slot )
{
return maxStack;
return this.maxStack;
}
@Override
public void setStackInSlot( int slot, @Nonnull ItemStack stack )
{
currentOp = InvOperation.SET;
previousStack = getStackInSlot( slot );
this.currentOp = InvOperation.SET;
this.previousStack = this.getStackInSlot( slot );
super.setStackInSlot( slot, stack );
}
@@ -85,13 +85,13 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
@Nonnull
public ItemStack insertItem( int slot, @Nonnull ItemStack stack, boolean simulate )
{
if( filter != null && !filter.allowInsert( this, slot, stack ) )
if( this.filter != null && !this.filter.allowInsert( this, slot, stack ) )
{
return stack;
}
currentOp = InvOperation.INSERT;
previousStack = getStackInSlot( slot ).copy();
this.currentOp = InvOperation.INSERT;
this.previousStack = this.getStackInSlot( slot ).copy();
return super.insertItem( slot, stack, simulate );
}
@@ -99,13 +99,13 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
@Nonnull
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
if( filter != null && !filter.allowExtract( this, slot, amount ) )
if( this.filter != null && !this.filter.allowExtract( this, slot, amount ) )
{
return ItemStack.EMPTY;
}
currentOp = InvOperation.EXTRACT;
previousStack = getStackInSlot( slot );
this.currentOp = InvOperation.EXTRACT;
this.previousStack = this.getStackInSlot( slot );
return super.extractItem( slot, amount, simulate );
}
@@ -114,18 +114,18 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
{
if( this.getTileEntity() != null && this.eventsEnabled() )
{
ItemStack added = getStackInSlot( slot ).copy();
ItemStack removed = previousStack.copy();
ItemStack added = this.getStackInSlot( slot ).copy();
ItemStack removed = this.previousStack.copy();
if( currentOp == InvOperation.INSERT )
if( this.currentOp == InvOperation.INSERT )
{
added.grow( -removed.getCount() );
}
else if( currentOp == InvOperation.EXTRACT )
else if( this.currentOp == InvOperation.EXTRACT )
{
removed.grow( -added.getCount() );
}
this.getTileEntity().onChangeInventory( this, slot, currentOp, removed, added );
this.getTileEntity().onChangeInventory( this, slot, this.currentOp, removed, added );
}
super.onContentsChanged( slot );
}
@@ -157,14 +157,14 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
}
if( this.filter != null )
{
return filter.allowInsert( this, slot, stack );
return this.filter.allowInsert( this, slot, stack );
}
return true;
}
public void writeToNBT( final NBTTagCompound data, final String name )
{
data.setTag( name, serializeNBT() );
data.setTag( name, this.serializeNBT() );
}
public void readFromNBT( final NBTTagCompound data, final String name )
@@ -172,13 +172,13 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
final NBTTagCompound c = data.getCompoundTag( name );
if( c != null )
{
readFromNBT( c );
this.readFromNBT( c );
}
}
public void readFromNBT( final NBTTagCompound data )
{
deserializeNBT( data );
this.deserializeNBT( data );
}
@Override
@@ -69,7 +69,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
private final IFluidHandler fluidHandler = new FluidHandler();
private final MEHandler meHandler = new MEHandler();
private final IItemHandler combinedInv = new WrapperChainedItemHandler( inputSlot, inv );
private final IItemHandler combinedInv = new WrapperChainedItemHandler( this.inputSlot, this.inv );
private double storedPower = 0;
@@ -132,7 +132,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
private boolean canAddOutput( final ItemStack output )
{
return inv.insertItem( 0, output, true ).isEmpty();
return this.inv.insertItem( 0, output, true ).isEmpty();
}
/**
@@ -142,7 +142,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
*/
private void addOutput( final ItemStack output )
{
inv.insertItem( 0, output, false );
this.inv.insertItem( 0, output, false );
}
private ItemStack getOutput()
@@ -222,7 +222,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
{
if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
{
return (T) inputSlot;
return (T) this.inputSlot;
}
else if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
@@ -101,7 +101,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
private final IItemHandler bottomItemHandlerExtern;
private final IItemHandler sideItemHandlerExtern;
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler( topItemHandler, bottomItemHandler, sideItemHandler );
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler( this.topItemHandler, this.bottomItemHandler, this.sideItemHandler );
@Reflected
public TileInscriber()
@@ -115,9 +115,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
final IAEItemFilter filter = new ItemHandlerFilter();
topItemHandlerExtern = new WrapperFilteredItemHandler( topItemHandler, filter );
bottomItemHandlerExtern = new WrapperFilteredItemHandler( bottomItemHandler, filter );
sideItemHandlerExtern = new WrapperFilteredItemHandler( sideItemHandler, filter );
this.topItemHandlerExtern = new WrapperFilteredItemHandler( this.topItemHandler, filter );
this.bottomItemHandlerExtern = new WrapperFilteredItemHandler( this.bottomItemHandler, filter );
this.sideItemHandlerExtern = new WrapperFilteredItemHandler( this.sideItemHandler, filter );
}
private int getUpgradeSlots()
@@ -236,7 +236,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public IItemHandler getInternalInventory()
{
return inv;
return this.inv;
}
@Override
@@ -463,7 +463,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( out != null )
{
final ItemStack outputCopy = out.getOutput().copy();
if( sideItemHandler.insertItem( 1, outputCopy, true ).isEmpty() )
if( this.sideItemHandler.insertItem( 1, outputCopy, true ).isEmpty() )
{
this.setSmash( true );
this.finalStep = 0;
@@ -501,17 +501,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
protected IItemHandler getItemHandlerForSide( @Nonnull EnumFacing facing )
{
if( facing == getUp() )
if( facing == this.getUp() )
{
return topItemHandlerExtern;
return this.topItemHandlerExtern;
}
else if( facing == getUp().getOpposite() )
else if( facing == this.getUp().getOpposite() )
{
return bottomItemHandlerExtern;
return this.bottomItemHandlerExtern;
}
else
{
return sideItemHandlerExtern;
return this.sideItemHandlerExtern;
}
}
@@ -576,7 +576,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return false;
}
return inv == topItemHandler || inv == bottomItemHandler || slot == 1;
return inv == TileInscriber.this.topItemHandler || inv == TileInscriber.this.bottomItemHandler || slot == 1;
}
@Override
@@ -593,7 +593,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return false;
}
if( inv == topItemHandler || inv == bottomItemHandler )
if( inv == TileInscriber.this.topItemHandler || inv == TileInscriber.this.bottomItemHandler )
{
if( AEApi.instance().definitions().materials().namePress().isSameAs( stack ) )
{
@@ -93,7 +93,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
int out = this.constructed;
if( !internalInventory.getStackInSlot( 0 ).isEmpty() && this.constructed != -1 )
if( !this.internalInventory.getStackInSlot( 0 ).isEmpty() && this.constructed != -1 )
{
out |= this.hasSingularity;
}
@@ -59,7 +59,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
public TileSpatialIOPort()
{
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
inv.setFilter( new SpatialIOFilter() );
this.inv.setFilter( new SpatialIOFilter() );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -110,7 +110,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
private final AppEngInternalInventory inputInventory = new AppEngInternalInventory( this, 1 );
private final AppEngInternalInventory cellInventory = new AppEngInternalInventory( this, 1 );
private final IItemHandler internalInventory = new WrapperChainedItemHandler( inputInventory, cellInventory );
private final IItemHandler internalInventory = new WrapperChainedItemHandler( this.inputInventory, this.cellInventory );
private final BaseActionSource mySrc = new MachineSource( this );
private final IConfigManager config = new ConfigManager( this );
@@ -144,7 +144,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
public ItemStack getCell()
{
return cellInventory.getStackInSlot( 0 );
return this.cellInventory.getStackInSlot( 0 );
}
@Override
@@ -553,7 +553,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
if( inv == cellInventory )
if( inv == this.cellInventory )
{
this.itemCell = null;
this.fluidCell = null;
@@ -578,7 +578,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
this.markForUpdate();
}
}
if( inv == inputInventory && mc == InvOperation.INSERT )
if( inv == this.inputInventory && mc == InvOperation.INSERT )
{
this.tryToStoreContents();
}
@@ -589,11 +589,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{
if( side == this.getForward() )
{
return cellInventory;
return this.cellInventory;
}
else
{
return inputInventory;
return this.inputInventory;
}
}
@@ -1010,14 +1010,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
if( isPowered() )
if( TileChest.this.isPowered() )
{
try
{
final IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cell = TileChest.this.getHandler( StorageChannel.ITEMS );
if( cell != null )
{
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, mySrc );
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE,
TileChest.this.mySrc );
return returns == null || returns.getStackSize() != stack.getCount();
}
}
@@ -84,10 +84,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private final AppEngInternalInventory inputCells = new AppEngInternalInventory( this, 6 );
private final AppEngInternalInventory outputCells = new AppEngInternalInventory( this, 6 );
private final IItemHandler combinedInventory = new WrapperChainedItemHandler( inputCells, outputCells );
private final IItemHandler combinedInventory = new WrapperChainedItemHandler( this.inputCells, this.outputCells );
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler( inputCells, AEItemFilters.INSERT_ONLY );
private final IItemHandler outputCellsExt = new WrapperFilteredItemHandler( outputCells, AEItemFilters.EXTRACT_ONLY );
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler( this.inputCells, AEItemFilters.INSERT_ONLY );
private final IItemHandler outputCellsExt = new WrapperFilteredItemHandler( this.outputCells, AEItemFilters.EXTRACT_ONLY );
private final UpgradeInventory upgrades;
private final BaseActionSource mySrc;
@@ -232,7 +232,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
if( this.isEnabled() )
{
return !ItemHandlerUtil.isEmpty( inputCells );
return !ItemHandlerUtil.isEmpty( this.inputCells );
}
return false;
@@ -256,13 +256,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
protected IItemHandler getItemHandlerForSide( final EnumFacing facing )
{
if( facing == getUp() || facing == getUp().getOpposite() )
if( facing == this.getUp() || facing == this.getUp().getOpposite() )
{
return inputCellsExt;
return this.inputCellsExt;
}
else
{
return outputCellsExt;
return this.outputCellsExt;
}
}
@@ -470,10 +470,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private boolean moveSlot( final int x )
{
final InventoryAdaptor ad = new AdaptorItemHandler( outputCells );
if( ad.addItems( inputCells.getStackInSlot( x ) ).isEmpty() )
final InventoryAdaptor ad = new AdaptorItemHandler( this.outputCells );
if( ad.addItems( this.inputCells.getStackInSlot( x ) ).isEmpty() )
{
inputCells.setStackInSlot( x, ItemStack.EMPTY );
this.inputCells.setStackInSlot( x, ItemStack.EMPTY );
return true;
}
return false;