pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.util.inv;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -27,94 +26,77 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
public class WrapperRangeItemHandler implements IItemHandlerModifiable {
|
||||
private final IItemHandler compose;
|
||||
private final int minSlot;
|
||||
private final int maxSlot;
|
||||
|
||||
public class WrapperRangeItemHandler implements IItemHandlerModifiable
|
||||
{
|
||||
private final IItemHandler compose;
|
||||
private final int minSlot;
|
||||
private final int maxSlot;
|
||||
public WrapperRangeItemHandler(IItemHandler compose, int minSlot, int maxSlotExclusive) {
|
||||
this.compose = compose;
|
||||
this.minSlot = minSlot;
|
||||
this.maxSlot = maxSlotExclusive;
|
||||
}
|
||||
|
||||
public WrapperRangeItemHandler( IItemHandler compose, int minSlot, int maxSlotExclusive )
|
||||
{
|
||||
this.compose = compose;
|
||||
this.minSlot = minSlot;
|
||||
this.maxSlot = maxSlotExclusive;
|
||||
}
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return this.maxSlot - this.minSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots()
|
||||
{
|
||||
return this.maxSlot - this.minSlot;
|
||||
}
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
if (this.checkSlot(slot)) {
|
||||
return this.compose.getStackInSlot(slot + this.minSlot);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStackInSlot( int slot )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return this.compose.getStackInSlot( slot + this.minSlot );
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
if (this.checkSlot(slot)) {
|
||||
return this.compose.insertItem(slot + this.minSlot, stack, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack insertItem( int slot, @Nonnull ItemStack stack, boolean simulate )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return this.compose.insertItem( slot + this.minSlot, stack, simulate );
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
if (this.checkSlot(slot)) {
|
||||
return this.compose.extractItem(slot + this.minSlot, amount, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack extractItem( int slot, int amount, boolean simulate )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return this.compose.extractItem( slot + this.minSlot, amount, simulate );
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@Override
|
||||
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
|
||||
if (this.checkSlot(slot)) {
|
||||
ItemHandlerUtil.setStackInSlot(this.compose, slot + this.minSlot, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStackInSlot( int slot, @Nonnull ItemStack stack )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( this.compose, slot + this.minSlot, stack );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
if (this.checkSlot(slot)) {
|
||||
return this.compose.getSlotLimit(slot + this.minSlot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotLimit( int slot )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return this.compose.getSlotLimit( slot + this.minSlot );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
private boolean checkSlot(int localSlot) {
|
||||
return localSlot + this.minSlot < this.maxSlot;
|
||||
}
|
||||
|
||||
private boolean checkSlot( int localSlot )
|
||||
{
|
||||
return localSlot + this.minSlot < this.maxSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return this.compose.isItemValid( slot + this.minSlot, stack );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValid(int slot, ItemStack stack) {
|
||||
if (this.checkSlot(slot)) {
|
||||
return this.compose.isItemValid(slot + this.minSlot, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user