Use qualified method and field access
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user