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
@@ -110,7 +110,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
@Override
public ItemStack getStack()
{
final IItemHandler baseInv = getItemHandler();
final IItemHandler baseInv = this.getItemHandler();
final ItemStack input = baseInv.getStackInSlot( 0 );
if( input == ItemStack.EMPTY )
{
@@ -137,10 +137,10 @@ public class ContainerQuartzKnife extends AEBaseContainer
@Nonnull
public ItemStack decrStackSize( int amount )
{
ItemStack ret = getStack();
ItemStack ret = this.getStack();
if( !ret.isEmpty() )
{
makePlate();
this.makePlate();
}
return ret;
}
@@ -150,21 +150,21 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
if( stack.isEmpty() )
{
makePlate();
this.makePlate();
}
}
private void makePlate()
{
if( !getItemHandler().extractItem( 0, 1, false ).isEmpty() )
if( !this.getItemHandler().extractItem( 0, 1, false ).isEmpty() )
{
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
item.damageItem( 1, getPlayerInv().player );
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
if( item.getCount() == 0 )
{
getPlayerInv().mainInventory.add( getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item, null ) );
ContainerQuartzKnife.this.getPlayerInv().mainInventory.add( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, item, null ) );
}
}
}
@@ -112,7 +112,7 @@ public class AppEngSlot extends Slot
return this.getDisplayStack();
}
return this.itemHandler.getStackInSlot( index );
return this.itemHandler.getStackInSlot( this.index );
}
@Override
@@ -120,7 +120,7 @@ public class AppEngSlot extends Slot
{
if( this.isSlotEnabled() )
{
ItemHandlerUtil.setStackInSlot( this.itemHandler, index, stack );
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
this.onSlotChanged();
if( this.getContainer() != null )
@@ -151,7 +151,7 @@ public class AppEngSlot extends Slot
@Override
public int getItemStackLimit( @Nonnull ItemStack stack )
{
return Math.min( getSlotStackLimit(), stack.getMaxStackSize() );
return Math.min( this.getSlotStackLimit(), stack.getMaxStackSize() );
}
@Override
@@ -159,7 +159,7 @@ public class AppEngSlot extends Slot
{
if( this.isSlotEnabled() )
{
return !this.itemHandler.extractItem( index, 1, true ).isEmpty();
return !this.itemHandler.extractItem( this.index, 1, true ).isEmpty();
}
return false;
}
@@ -168,7 +168,7 @@ public class AppEngSlot extends Slot
@Nonnull
public ItemStack decrStackSize( int amount )
{
return this.itemHandler.extractItem( index, amount, false );
return this.itemHandler.extractItem( this.index, amount, false );
}
@Override
@@ -191,7 +191,7 @@ public class AppEngSlot extends Slot
public ItemStack getDisplayStack()
{
return this.itemHandler.getStackInSlot( index );
return this.itemHandler.getStackInSlot( this.index );
}
public float getOpacityOfIcon()
+2 -2
View File
@@ -87,7 +87,7 @@ public class TileItemGen extends AEBaseTile
{
if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability )
{
return (T) handler;
return (T) this.handler;
}
return super.getCapability( capability, facing );
}
@@ -132,7 +132,7 @@ public class TileItemGen extends AEBaseTile
return ItemStack.EMPTY;
}
return simulate ? is.copy() : getNextItem();
return simulate ? is.copy() : this.getNextItem();
}
private ItemStack getNextItem()
@@ -1264,7 +1264,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
{
return (T) storage;
return (T) this.storage;
}
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
{
@@ -55,7 +55,7 @@ public class InvalidPatternHelper
for( int i = 0; i < outTag.tagCount(); i++ )
{
outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
}
for( int i = 0; i < inTag.tagCount(); i++ )
@@ -68,7 +68,7 @@ public class InvalidPatternHelper
continue;
}
inputs.add( new PatternIngredient( in ) );
this.inputs.add( new PatternIngredient( in ) );
}
}
@@ -104,7 +104,7 @@ public class InvalidPatternHelper
{
this.stack = new ItemStack( tag );
if( stack.isEmpty() )
if( this.stack.isEmpty() )
{
this.id = tag.getString( "id" );
this.count = tag.getByte( "Count" );
@@ -114,39 +114,39 @@ public class InvalidPatternHelper
public boolean isValid()
{
return !stack.isEmpty();
return !this.stack.isEmpty();
}
public String getName()
{
return isValid() ? Platform.getItemDisplayName( stack ) : id + '@' + String.valueOf( getDamage() );
return this.isValid() ? Platform.getItemDisplayName( this.stack ) : this.id + '@' + String.valueOf( this.getDamage() );
}
public int getDamage()
{
return isValid() ? stack.getItemDamage() : damage;
return this.isValid() ? this.stack.getItemDamage() : this.damage;
}
public int getCount()
{
return isValid() ? stack.getCount() : count;
return this.isValid() ? this.stack.getCount() : this.count;
}
public ItemStack getItem()
{
if( !isValid() )
if( !this.isValid() )
{
throw new IllegalArgumentException( "There is no valid ItemStack for this PatternIngredient" );
}
return stack;
return this.stack;
}
public String getFormattedToolTip()
{
String result = String.valueOf( getCount() ) + ' ' + getName();
String result = String.valueOf( this.getCount() ) + ' ' + this.getName();
if( !isValid() )
if( !this.isValid() )
{
result = TextFormatting.RED + ( ' ' + result );
}
@@ -54,7 +54,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
@Override
public void saveChanges()
{
inv.markDirty( -1 );
this.inv.markDirty( -1 );
}
@Override
@@ -92,7 +92,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
public IItemHandler getInternalInventory()
{
return inv;
return this.inv;
}
@Override
@@ -179,7 +179,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
final Upgrades u = ( (IUpgradeModule) it ).getType( itemstack );
if( u != null )
{
return getInstalledUpgrades( u ) < getMaxInstalled( u );
return UpgradeInventory.this.getInstalledUpgrades( u ) < UpgradeInventory.this.getMaxInstalled( u );
}
}
return false;
@@ -439,7 +439,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.cached = true;
final TileEntity self = this.getHost().getTile();
final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
final int newHandlerHash = createHandlerHash( target );
final int newHandlerHash = this.createHandlerHash( target );
if( newHandlerHash != 0 && newHandlerHash == this.handlerHash )
{
@@ -124,9 +124,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
private IItemHandler getOutputInv()
{
IItemHandler ret = null;
if( !partVisited )
if( !this.partVisited )
{
partVisited = true;
this.partVisited = true;
if( this.getProxy().isActive() )
{
final EnumFacing facing = this.getSide().getFacing();
@@ -137,7 +137,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
ret = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite() );
}
}
partVisited = false;
this.partVisited = false;
}
return ret;
}
@@ -291,6 +291,6 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
@Override
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
return MODELS.getModel( this.isPowered(), this.isActive() );
}
}
+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;
+3 -3
View File
@@ -35,10 +35,10 @@ public class Lazy<T> implements Supplier<T>
@Override
public T get()
{
if( instance == null )
if( this.instance == null )
{
instance = supplier.get();
this.instance = this.supplier.get();
}
return instance;
return this.instance;
}
}
@@ -41,7 +41,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
@Override
public boolean hasSlots()
{
return itemHandler.getSlots() > 0;
return this.itemHandler.getSlots() > 0;
}
@Override
@@ -43,7 +43,7 @@ public class AdaptorList extends InventoryAdaptor
@Override
public boolean hasSlots()
{
return !i.isEmpty();
return !this.i.isEmpty();
}
@Override
@@ -38,18 +38,18 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
public WrapperChainedItemHandler( IItemHandler... itemHandler )
{
setItemHandlers( itemHandler );
this.setItemHandlers( itemHandler );
}
private void setItemHandlers( IItemHandler[] handlers )
{
this.itemHandler = handlers;
this.baseIndex = new int[itemHandler.length];
this.baseIndex = new int[this.itemHandler.length];
int index = 0;
for( int i = 0; i < itemHandler.length; i++ )
for( int i = 0; i < this.itemHandler.length; i++ )
{
index += itemHandler[i].getSlots();
baseIndex[i] = index;
index += this.itemHandler[i].getSlots();
this.baseIndex[i] = index;
}
this.slotCount = index;
}
@@ -62,9 +62,9 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
return -1;
}
for( int i = 0; i < baseIndex.length; i++ )
for( int i = 0; i < this.baseIndex.length; i++ )
{
if( slot - baseIndex[i] < 0 )
if( slot - this.baseIndex[i] < 0 )
{
return i;
}
@@ -74,20 +74,20 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
private IItemHandler getHandlerFromIndex( int index )
{
if( index < 0 || index >= itemHandler.length )
if( index < 0 || index >= this.itemHandler.length )
{
return EmptyHandler.INSTANCE;
}
return itemHandler[index];
return this.itemHandler[index];
}
private int getSlotFromIndex( int slot, int index )
{
if( index <= 0 || index >= baseIndex.length )
if( index <= 0 || index >= this.baseIndex.length )
{
return slot;
}
return slot - baseIndex[index - 1];
return slot - this.baseIndex[index - 1];
}
public void cycleOrder()
@@ -107,16 +107,16 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
@Override
public int getSlots()
{
return slotCount;
return this.slotCount;
}
@Override
@Nonnull
public ItemStack getStackInSlot( final int slot )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
return handler.getStackInSlot( targetSlot );
}
@@ -124,9 +124,9 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
@Nonnull
public ItemStack insertItem( final int slot, @Nonnull ItemStack stack, boolean simulate )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
return handler.insertItem( targetSlot, stack, simulate );
}
@@ -134,45 +134,45 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
@Nonnull
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
return handler.extractItem( targetSlot, amount, simulate );
}
@Override
public int getSlotLimit( int slot )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int localSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int localSlot = this.getSlotFromIndex( slot, index );
return handler.getSlotLimit( localSlot );
}
@Override
public void setStackInSlot( int slot, ItemStack stack )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
ItemHandlerUtil.setStackInSlot( handler, targetSlot, stack );
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
return ItemHandlerUtil.isItemValidForSlot( handler, targetSlot, stack );
}
@Override
public void markDirty( int slot )
{
int index = getIndexForSlot( slot );
IItemHandler handler = getHandlerFromIndex( index );
int targetSlot = getSlotFromIndex( slot, index );
int index = this.getIndexForSlot( slot );
IItemHandler handler = this.getHandlerFromIndex( index );
int targetSlot = this.getSlotFromIndex( slot, index );
ItemHandlerUtil.markDirty( handler, targetSlot );
}
}
@@ -32,12 +32,12 @@ public class WrapperCursorItemHandler extends ItemStackHandler
super( 1 );
this.inv = inventoryPlayer;
setStackInSlot( 0, inventoryPlayer.getItemStack() );
this.setStackInSlot( 0, inventoryPlayer.getItemStack() );
}
@Override
protected void onContentsChanged( int slot )
{
this.inv.setItemStack( getStackInSlot( slot ) );
this.inv.setItemStack( this.getStackInSlot( slot ) );
}
}
@@ -42,62 +42,62 @@ public class WrapperFilteredItemHandler implements IInternalItemHandler
@Override
public void setStackInSlot( int slot, ItemStack stack )
{
ItemHandlerUtil.setStackInSlot( handler, slot, stack );
ItemHandlerUtil.setStackInSlot( this.handler, slot, stack );
}
@Override
public int getSlots()
{
return handler.getSlots();
return this.handler.getSlots();
}
@Override
public ItemStack getStackInSlot( int slot )
{
return handler.getStackInSlot( slot );
return this.handler.getStackInSlot( slot );
}
@Override
public ItemStack insertItem( int slot, ItemStack stack, boolean simulate )
{
if( !filter.allowInsert( handler, slot, stack ) )
if( !this.filter.allowInsert( this.handler, slot, stack ) )
{
return stack;
}
return handler.insertItem( slot, stack, simulate );
return this.handler.insertItem( slot, stack, simulate );
}
@Override
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
if( !filter.allowExtract( handler, slot, amount ) )
if( !this.filter.allowExtract( this.handler, slot, amount ) )
{
return ItemStack.EMPTY;
}
return handler.extractItem( slot, amount, simulate );
return this.handler.extractItem( slot, amount, simulate );
}
@Override
public int getSlotLimit( int slot )
{
return handler.getSlotLimit( slot );
return this.handler.getSlotLimit( slot );
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
if( !filter.allowInsert( handler, slot, stack ) )
if( !this.filter.allowInsert( this.handler, slot, stack ) )
{
return false;
}
return ItemHandlerUtil.isItemValidForSlot( handler, slot, stack );
return ItemHandlerUtil.isItemValidForSlot( this.handler, slot, stack );
}
@Override
public void markDirty( int slot )
{
ItemHandlerUtil.markDirty( handler, slot );
ItemHandlerUtil.markDirty( this.handler, slot );
}
}
@@ -58,46 +58,46 @@ public class WrapperInvItemHandler implements IInventory
@Override
public int getSizeInventory()
{
return inv.getSlots();
return this.inv.getSlots();
}
@Override
public boolean isEmpty()
{
return ItemHandlerUtil.isEmpty( inv );
return ItemHandlerUtil.isEmpty( this.inv );
}
@Override
public ItemStack getStackInSlot( int index )
{
return inv.getStackInSlot( index );
return this.inv.getStackInSlot( index );
}
@Override
public ItemStack decrStackSize( int index, int count )
{
return inv.extractItem( index, count, false );
return this.inv.extractItem( index, count, false );
}
@Override
public ItemStack removeStackFromSlot( int index )
{
return inv.extractItem( index, inv.getSlotLimit( index ), false );
return this.inv.extractItem( index, this.inv.getSlotLimit( index ), false );
}
@Override
public void setInventorySlotContents( int index, ItemStack stack )
{
ItemHandlerUtil.setStackInSlot( inv, index, stack );
ItemHandlerUtil.setStackInSlot( this.inv, index, stack );
}
@Override
public int getInventoryStackLimit()
{
int max = 0;
for( int i = 0; i < inv.getSlots(); ++i )
for( int i = 0; i < this.inv.getSlots(); ++i )
{
max = Math.max( max, inv.getSlotLimit( i ) );
max = Math.max( max, this.inv.getSlotLimit( i ) );
}
return max;
}
@@ -105,7 +105,7 @@ public class WrapperInvItemHandler implements IInventory
@Override
public void markDirty()
{
ItemHandlerUtil.markDirty( inv, -1 );
ItemHandlerUtil.markDirty( this.inv, -1 );
}
@Override
@@ -129,7 +129,7 @@ public class WrapperInvItemHandler implements IInventory
@Override
public boolean isItemValidForSlot( int index, ItemStack stack )
{
return ItemHandlerUtil.isItemValidForSlot( inv, index, stack );
return ItemHandlerUtil.isItemValidForSlot( this.inv, index, stack );
}
@Override
@@ -153,7 +153,7 @@ public class WrapperInvItemHandler implements IInventory
@Override
public void clear()
{
ItemHandlerUtil.clear( inv );
ItemHandlerUtil.clear( this.inv );
}
}
@@ -40,48 +40,48 @@ public class WrapperLazyItemHandler implements IInternalItemHandler
@Override
public int getSlots()
{
return sourceHandler.get().getSlots();
return this.sourceHandler.get().getSlots();
}
@Override
public ItemStack getStackInSlot( int slot )
{
return sourceHandler.get().getStackInSlot( slot );
return this.sourceHandler.get().getStackInSlot( slot );
}
@Override
public ItemStack insertItem( int slot, ItemStack stack, boolean simulate )
{
return sourceHandler.get().insertItem( slot, stack, simulate );
return this.sourceHandler.get().insertItem( slot, stack, simulate );
}
@Override
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
return sourceHandler.get().extractItem( slot, amount, simulate );
return this.sourceHandler.get().extractItem( slot, amount, simulate );
}
@Override
public int getSlotLimit( int slot )
{
return sourceHandler.get().getSlotLimit( slot );
return this.sourceHandler.get().getSlotLimit( slot );
}
@Override
public void setStackInSlot( int slot, ItemStack stack )
{
ItemHandlerUtil.setStackInSlot( sourceHandler.get(), slot, stack );
ItemHandlerUtil.setStackInSlot( this.sourceHandler.get(), slot, stack );
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
return ItemHandlerUtil.isItemValidForSlot( sourceHandler.get(), slot, stack );
return ItemHandlerUtil.isItemValidForSlot( this.sourceHandler.get(), slot, stack );
}
@Override
public void markDirty( int slot )
{
ItemHandlerUtil.markDirty( sourceHandler.get(), slot );
ItemHandlerUtil.markDirty( this.sourceHandler.get(), slot );
}
}
@@ -43,16 +43,16 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
@Override
public int getSlots()
{
return maxSlot - minSlot;
return this.maxSlot - this.minSlot;
}
@Override
@Nonnull
public ItemStack getStackInSlot( int slot )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
return compose.getStackInSlot( slot + minSlot );
return this.compose.getStackInSlot( slot + this.minSlot );
}
return ItemStack.EMPTY;
@@ -62,9 +62,9 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
@Nonnull
public ItemStack insertItem( int slot, @Nonnull ItemStack stack, boolean simulate )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
return compose.insertItem( slot + minSlot, stack, simulate );
return this.compose.insertItem( slot + this.minSlot, stack, simulate );
}
return stack;
@@ -74,9 +74,9 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
@Nonnull
public ItemStack extractItem( int slot, int amount, boolean simulate )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
return compose.extractItem( slot + minSlot, amount, simulate );
return this.compose.extractItem( slot + this.minSlot, amount, simulate );
}
return ItemStack.EMPTY;
@@ -85,18 +85,18 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
@Override
public void setStackInSlot( int slot, @Nonnull ItemStack stack )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
ItemHandlerUtil.setStackInSlot( compose, slot + minSlot, stack );
ItemHandlerUtil.setStackInSlot( this.compose, slot + this.minSlot, stack );
}
}
@Override
public int getSlotLimit( int slot )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
return compose.getSlotLimit( slot + minSlot );
return this.compose.getSlotLimit( slot + this.minSlot );
}
return 0;
@@ -104,15 +104,15 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
private boolean checkSlot( int localSlot )
{
return localSlot + minSlot < maxSlot;
return localSlot + this.minSlot < this.maxSlot;
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
return ItemHandlerUtil.isItemValidForSlot( compose, slot + minSlot, stack );
return ItemHandlerUtil.isItemValidForSlot( this.compose, slot + this.minSlot, stack );
}
return false;
}
@@ -120,9 +120,9 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
@Override
public void markDirty( int slot )
{
if( checkSlot( slot ) )
if( this.checkSlot( slot ) )
{
ItemHandlerUtil.markDirty( compose, slot + minSlot );
ItemHandlerUtil.markDirty( this.compose, slot + this.minSlot );
}
}
@@ -43,7 +43,7 @@ public class AEItemDefinitionFilter implements IAEItemFilter
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return definition.isSameAs( stack );
return this.definition.isSameAs( stack );
}
}