Update MCP mappings to snapshot_nodoc_20161220 (#3551)

This commit is contained in:
James Mitchell authored and LexManos committed 2016-12-21 15:52:30 -08:00
1 parent 1f4007e5d8
commit 5165dc52bf
88 files changed
+445 -436

No files matched your search

@@ -37,15 +37,15 @@ public class ItemHandlerHelper
@Nonnull
public static ItemStack insertItem(IItemHandler dest, @Nonnull ItemStack stack, boolean simulate)
{
if (dest == null || stack.func_190926_b())
return ItemStack.field_190927_a;
if (dest == null || stack.isEmpty())
return ItemStack.EMPTY;
for (int i = 0; i < dest.getSlots(); i++)
{
stack = dest.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -54,7 +54,7 @@ public class ItemHandlerHelper
public static boolean canItemStacksStack(@Nonnull ItemStack a, @Nonnull ItemStack b)
{
if (a.func_190926_b() || !a.isItemEqual(b) || a.hasTagCompound() != b.hasTagCompound())
if (a.isEmpty() || !a.isItemEqual(b) || a.hasTagCompound() != b.hasTagCompound())
return false;
return (!a.hasTagCompound() || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b);
@@ -66,7 +66,7 @@ public class ItemHandlerHelper
*/
public static boolean canItemStacksStackRelaxed(@Nonnull ItemStack a, @Nonnull ItemStack b)
{
if (a.func_190926_b() || b.func_190926_b() || a.getItem() != b.getItem())
if (a.isEmpty() || b.isEmpty() || a.getItem() != b.getItem())
return false;
if (!a.isStackable())
@@ -88,9 +88,9 @@ public class ItemHandlerHelper
public static ItemStack copyStackWithSize(@Nonnull ItemStack itemStack, int size)
{
if (size == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack copy = itemStack.copy();
copy.func_190920_e(size);
copy.setCount(size);
return copy;
}
@@ -102,7 +102,7 @@ public class ItemHandlerHelper
@Nonnull
public static ItemStack insertItemStacked(IItemHandler inventory, @Nonnull ItemStack stack, boolean simulate)
{
if (inventory == null || stack.func_190926_b())
if (inventory == null || stack.isEmpty())
return stack;
// not stackable -> just insert into a new slot
@@ -121,7 +121,7 @@ public class ItemHandlerHelper
{
stack = inventory.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
break;
}
@@ -129,15 +129,15 @@ public class ItemHandlerHelper
}
// insert remainder into empty slots
if (!stack.func_190926_b())
if (!stack.isEmpty())
{
// find empty slot
for (int i = 0; i < sizeInventory; i++)
{
if (inventory.getStackInSlot(i).func_190926_b())
if (inventory.getStackInSlot(i).isEmpty())
{
stack = inventory.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
break;
}
@@ -163,7 +163,7 @@ public class ItemHandlerHelper
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack, int preferredSlot)
{
IItemHandler inventory = new PlayerMainInvWrapper(player.inventory);
World world = player.worldObj;
World world = player.world;
// try adding it into the inventory
ItemStack remainder = stack;
@@ -173,27 +173,27 @@ public class ItemHandlerHelper
remainder = inventory.insertItem(preferredSlot, stack, false);
}
// then into the inventory in general
if(!remainder.func_190926_b())
if(!remainder.isEmpty())
{
remainder = insertItemStacked(inventory, remainder, false);
}
// play sound if something got picked up
if (remainder.func_190926_b() || remainder.func_190916_E() != stack.func_190916_E())
if (remainder.isEmpty() || remainder.getCount() != stack.getCount())
{
world.playSound(player, player.posX, player.posY, player.posZ,
SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
// drop remaining itemstack into the world
if (!remainder.func_190926_b() && !world.isRemote)
if (!remainder.isEmpty() && !world.isRemote)
{
EntityItem entityitem = new EntityItem(world, player.posX, player.posY + 0.5, player.posZ, stack);
entityitem.setPickupDelay(40);
entityitem.motionX = 0;
entityitem.motionZ = 0;
world.spawnEntityInWorld(entityitem);
world.spawnEntity(entityitem);
}
}
@@ -218,15 +218,15 @@ public class ItemHandlerHelper
{
ItemStack itemstack = inv.getStackInSlot(j);
if (!itemstack.func_190926_b())
if (!itemstack.isEmpty())
{
proportion += (float)itemstack.func_190916_E() / (float)Math.min(inv.getSlotLimit(j), itemstack.getMaxStackSize());
proportion += (float)itemstack.getCount() / (float)Math.min(inv.getSlotLimit(j), itemstack.getMaxStackSize());
++itemsFound;
}
}
proportion = proportion / (float)inv.getSlots();
return MathHelper.floor_float(proportion * 14.0F) + (itemsFound > 0 ? 1 : 0);
return MathHelper.floor(proportion * 14.0F) + (itemsFound > 0 ? 1 : 0);
}
}
}
@@ -39,7 +39,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
public ItemStackHandler(int size)
{
stacks = NonNullList.func_191197_a(size, ItemStack.field_190927_a);
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
public ItemStackHandler(NonNullList<ItemStack> stacks)
@@ -49,7 +49,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
public void setSize(int size)
{
stacks = NonNullList.func_191197_a(size, ItemStack.field_190927_a);
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
@Override
@@ -80,8 +80,8 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
validateSlotIndex(slot);
@@ -89,55 +89,55 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
int limit = getStackLimit(slot, stack);
if (!existing.func_190926_b())
if (!existing.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
return stack;
limit -= existing.func_190916_E();
limit -= existing.getCount();
}
if (limit <= 0)
return stack;
boolean reachedLimit = stack.func_190916_E() > limit;
boolean reachedLimit = stack.getCount() > limit;
if (!simulate)
{
if (existing.func_190926_b())
if (existing.isEmpty())
{
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
}
else
{
existing.func_190917_f(reachedLimit ? limit : stack.func_190916_E());
existing.grow(reachedLimit ? limit : stack.getCount());
}
onContentsChanged(slot);
}
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.func_190916_E()- limit) : ItemStack.field_190927_a;
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount()- limit) : ItemStack.EMPTY;
}
@Nonnull
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
validateSlotIndex(slot);
ItemStack existing = this.stacks.get(slot);
if (existing.func_190926_b())
return ItemStack.field_190927_a;
if (existing.isEmpty())
return ItemStack.EMPTY;
int toExtract = Math.min(amount, existing.getMaxStackSize());
if (existing.func_190916_E() <= toExtract)
if (existing.getCount() <= toExtract)
{
if (!simulate)
{
this.stacks.set(slot, ItemStack.field_190927_a);
this.stacks.set(slot, ItemStack.EMPTY);
onContentsChanged(slot);
}
return existing;
@@ -146,7 +146,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
{
if (!simulate)
{
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.func_190916_E() - toExtract));
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.getCount() - toExtract));
onContentsChanged(slot);
}
@@ -171,7 +171,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
NBTTagList nbtTagList = new NBTTagList();
for (int i = 0; i < stacks.size(); i++)
{
if (!stacks.get(i).func_190926_b())
if (!stacks.get(i).isEmpty())
{
NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setInteger("Slot", i);
@@ -43,7 +43,7 @@ public class SlotItemHandler extends Slot
@Override
public boolean isItemValid(@Nonnull ItemStack stack)
{
if (stack.func_190926_b())
if (stack.isEmpty())
return false;
IItemHandler handler = this.getItemHandler();
@@ -53,7 +53,7 @@ public class SlotItemHandler extends Slot
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
remainder = handlerModifiable.insertItem(index, stack, true);
@@ -63,7 +63,7 @@ public class SlotItemHandler extends Slot
{
remainder = handler.insertItem(index, stack, true);
}
return remainder.func_190926_b() || remainder.func_190916_E() < stack.func_190916_E();
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
}
@Override
@@ -98,27 +98,27 @@ public class SlotItemHandler extends Slot
{
ItemStack maxAdd = stack.copy();
int maxInput = stack.getMaxStackSize();
maxAdd.func_190920_e(maxInput);
maxAdd.setCount(maxInput);
IItemHandler handler = this.getItemHandler();
ItemStack currentStack = handler.getStackInSlot(index);
if (handler instanceof IItemHandlerModifiable) {
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
ItemStack remainder = handlerModifiable.insertItem(index, maxAdd, true);
handlerModifiable.setStackInSlot(index, currentStack);
return maxInput - remainder.func_190916_E();
return maxInput - remainder.getCount();
}
else
{
ItemStack remainder = handler.insertItem(index, maxAdd, true);
int current = currentStack.func_190916_E();
int added = maxInput - remainder.func_190916_E();
int current = currentStack.getCount();
int added = maxInput - remainder.getCount();
return current + added;
}
}
@@ -126,7 +126,7 @@ public class SlotItemHandler extends Slot
@Override
public boolean canTakeStack(EntityPlayer playerIn)
{
return !this.getItemHandler().extractItem(index, 1, true).func_190926_b();
return !this.getItemHandler().extractItem(index, 1, true).isEmpty();
}
@Override
@@ -110,7 +110,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
boolean accessingUpperChest = slot < 27;
int targetSlot = accessingUpperChest ? slot : slot - 27;
TileEntityChest chest = getChest(accessingUpperChest);
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.field_190927_a;
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.EMPTY;
}
@Override
@@ -146,7 +146,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
boolean accessingUpperChest = slot < 27;
int targetSlot = accessingUpperChest ? slot : slot - 27;
TileEntityChest chest = getChest(accessingUpperChest);
return chest != null ? chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate) : ItemStack.field_190927_a;
return chest != null ? chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate) : ItemStack.EMPTY;
}
@Override
@@ -45,12 +45,12 @@ public class VanillaHopperItemHandler extends InvWrapper
}
else
{
boolean wasEmpty = getInv().func_191420_l();
boolean wasEmpty = getInv().isEmpty();
int originalStackSize = stack.func_190916_E();
int originalStackSize = stack.getCount();
stack = super.insertItem(slot, stack, simulate);
if (wasEmpty && originalStackSize > stack.func_190916_E())
if (wasEmpty && originalStackSize > stack.getCount())
{
if (!hopper.mayTransfer())
{
@@ -54,19 +54,19 @@ public class VanillaInventoryCodeHooks
for (int i = 0; i < handler.getSlots(); i++)
{
ItemStack extractItem = handler.extractItem(i, 1, true);
if (!extractItem.func_190926_b())
if (!extractItem.isEmpty())
{
for (int j = 0; j < dest.getSizeInventory(); j++)
{
ItemStack destStack = dest.getStackInSlot(j);
if (dest.isItemValidForSlot(j, extractItem) && (destStack.func_190926_b() || destStack.func_190916_E() < destStack.getMaxStackSize() && destStack.func_190916_E() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
if (dest.isItemValidForSlot(j, extractItem) && (destStack.isEmpty() || destStack.getCount() < destStack.getMaxStackSize() && destStack.getCount() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
{
extractItem = handler.extractItem(i, 1, false);
if (destStack.func_190926_b())
if (destStack.isEmpty())
dest.setInventorySlotContents(j, extractItem);
else
{
destStack.func_190917_f(1);
destStack.grow(1);
dest.setInventorySlotContents(j, destStack);
}
dest.markDirty();
@@ -98,10 +98,10 @@ public class VanillaInventoryCodeHooks
ItemStack dispensedStack = stack.copy().splitStack(1);
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
if (remainder.func_190926_b())
if (remainder.isEmpty())
{
remainder = stack.copy();
remainder.func_190918_g(1);
remainder.shrink(1);
}
else
{
@@ -136,13 +136,13 @@ public class VanillaInventoryCodeHooks
{
for (int i = 0; i < hopper.getSizeInventory(); ++i)
{
if (!hopper.getStackInSlot(i).func_190926_b())
if (!hopper.getStackInSlot(i).isEmpty())
{
ItemStack originalSlotContents = hopper.getStackInSlot(i).copy();
ItemStack insertStack = hopper.decrStackSize(i, 1);
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
if (remainder.func_190926_b())
if (remainder.isEmpty())
{
return true;
}
@@ -158,7 +158,7 @@ public class VanillaInventoryCodeHooks
private static ItemStack putStackInInventoryAllSlots(TileEntity source, Object destination, IItemHandler destInventory, ItemStack stack)
{
for (int slot = 0; slot < destInventory.getSlots() && !stack.func_190926_b(); slot++)
for (int slot = 0; slot < destInventory.getSlots() && !stack.isEmpty(); slot++)
{
stack = insertStack(source, destination, destInventory, stack, slot);
}
@@ -172,22 +172,22 @@ public class VanillaInventoryCodeHooks
{
ItemStack itemstack = destInventory.getStackInSlot(slot);
if (destInventory.insertItem(slot, stack, true).func_190926_b())
if (destInventory.insertItem(slot, stack, true).isEmpty())
{
boolean insertedItem = false;
boolean inventoryWasEmpty = isEmpty(destInventory);
if (itemstack.func_190926_b())
if (itemstack.isEmpty())
{
destInventory.insertItem(slot, stack, false);
stack = ItemStack.field_190927_a;
stack = ItemStack.EMPTY;
insertedItem = true;
}
else if (ItemHandlerHelper.canItemStacksStack(itemstack, stack))
{
int originalSize = stack.func_190916_E();
int originalSize = stack.getCount();
stack = destInventory.insertItem(slot, stack, false);
insertedItem = originalSize < stack.func_190916_E();
insertedItem = originalSize < stack.getCount();
}
if (insertedItem)
@@ -231,7 +231,7 @@ public class VanillaInventoryCodeHooks
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
if (stackInSlot.func_190926_b() || stackInSlot.func_190916_E() != stackInSlot.getMaxStackSize())
if (stackInSlot.isEmpty() || stackInSlot.getCount() != stackInSlot.getMaxStackSize())
{
return false;
}
@@ -244,7 +244,7 @@ public class VanillaInventoryCodeHooks
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
if (stackInSlot.func_190916_E() > 0)
if (stackInSlot.getCount() > 0)
{
return false;
}
@@ -256,9 +256,9 @@ public class VanillaInventoryCodeHooks
public static Pair<IItemHandler, Object> getItemHandler(World worldIn, double x, double y, double z, final EnumFacing side)
{
Pair<IItemHandler, Object> destination = null;
int i = MathHelper.floor_double(x);
int j = MathHelper.floor_double(y);
int k = MathHelper.floor_double(z);
int i = MathHelper.floor(x);
int j = MathHelper.floor(y);
int k = MathHelper.floor(z);
BlockPos blockpos = new BlockPos(i, j, k);
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
Block block = state.getBlock();
@@ -39,7 +39,7 @@ public class EmptyHandler implements IItemHandlerModifiable
@Nonnull
public ItemStack getStackInSlot(int slot)
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -53,7 +53,7 @@ public class EmptyHandler implements IItemHandlerModifiable
@Nonnull
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -72,8 +72,8 @@ public class InvWrapper implements IItemHandlerModifiable
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
if (!getInv().isItemValidForSlot(slot, stack))
return stack;
@@ -81,24 +81,24 @@ public class InvWrapper implements IItemHandlerModifiable
ItemStack stackInSlot = getInv().getStackInSlot(slot);
int m;
if (!stackInSlot.func_190926_b())
if (!stackInSlot.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.func_190916_E();
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
if (stack.func_190916_E() <= m)
if (stack.getCount() <= m)
{
if (!simulate)
{
ItemStack copy = stack.copy();
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
getInv().setInventorySlotContents(slot, copy);
getInv().markDirty();
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
else
{
@@ -107,14 +107,14 @@ public class InvWrapper implements IItemHandlerModifiable
if (!simulate)
{
ItemStack copy = stack.splitStack(m);
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
getInv().setInventorySlotContents(slot, copy);
getInv().markDirty();
return stack;
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -122,7 +122,7 @@ public class InvWrapper implements IItemHandlerModifiable
else
{
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
if (m < stack.func_190916_E())
if (m < stack.getCount())
{
// copy the stack to not modify the original one
stack = stack.copy();
@@ -134,7 +134,7 @@ public class InvWrapper implements IItemHandlerModifiable
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -145,7 +145,7 @@ public class InvWrapper implements IItemHandlerModifiable
getInv().setInventorySlotContents(slot, stack);
getInv().markDirty();
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -156,29 +156,29 @@ public class InvWrapper implements IItemHandlerModifiable
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack stackInSlot = getInv().getStackInSlot(slot);
if (stackInSlot.func_190926_b())
return ItemStack.field_190927_a;
if (stackInSlot.isEmpty())
return ItemStack.EMPTY;
if (simulate)
{
if (stackInSlot.func_190916_E() < amount)
if (stackInSlot.getCount() < amount)
{
return stackInSlot.copy();
}
else
{
ItemStack copy = stackInSlot.copy();
copy.func_190920_e(amount);
copy.setCount(amount);
return copy;
}
}
else
{
int m = Math.min(stackInSlot.func_190916_E(), amount);
int m = Math.min(stackInSlot.getCount(), amount);
ItemStack decrStackSize = getInv().decrStackSize(slot, m);
getInv().markDirty();
@@ -49,7 +49,7 @@ public class PlayerArmorInvWrapper extends RangedWrapper
}
}
// check if it's valid for the armor slot
if (equ != null && slot < 4 && !stack.func_190926_b() && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player))
if (equ != null && slot < 4 && !stack.isEmpty() && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player))
{
return super.insertItem(slot, stack, simulate);
}
@@ -44,15 +44,15 @@ public class PlayerMainInvWrapper extends RangedWrapper
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
ItemStack rest = super.insertItem(slot, stack, simulate);
if (rest.func_190916_E()!= stack.func_190916_E())
if (rest.getCount()!= stack.getCount())
{
// the stack in the slot changed, animate it
ItemStack inSlot = getStackInSlot(slot);
if(!inSlot.func_190926_b())
if(!inSlot.isEmpty())
{
if (getInventoryPlayer().player.worldObj.isRemote)
if (getInventoryPlayer().player.world.isRemote)
{
inSlot.func_190915_d(5);
inSlot.setAnimationsToGo(5);
}
else if(getInventoryPlayer().player instanceof EntityPlayerMP) {
getInventoryPlayer().player.openContainer.detectAndSendChanges();
@@ -58,7 +58,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
return compose.getStackInSlot(slot + minSlot);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -82,7 +82,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
return compose.extractItem(slot + minSlot, amount, simulate);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -78,15 +78,15 @@ public class SidedInvWrapper implements IItemHandlerModifiable
public ItemStack getStackInSlot(int slot)
{
int i = getSlot(inv, slot, side);
return i == -1 ? ItemStack.field_190927_a : inv.getStackInSlot(i);
return i == -1 ? ItemStack.EMPTY : inv.getStackInSlot(i);
}
@Override
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
int slot1 = getSlot(inv, slot, side);
@@ -99,23 +99,23 @@ public class SidedInvWrapper implements IItemHandlerModifiable
ItemStack stackInSlot = inv.getStackInSlot(slot1);
int m;
if (!stackInSlot.func_190926_b())
if (!stackInSlot.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.func_190916_E();
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
if (stack.func_190916_E() <= m)
if (stack.getCount() <= m)
{
if (!simulate)
{
ItemStack copy = stack.copy();
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
inv.setInventorySlotContents(slot1, copy);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
else
{
@@ -124,13 +124,13 @@ public class SidedInvWrapper implements IItemHandlerModifiable
if (!simulate)
{
ItemStack copy = stack.splitStack(m);
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
inv.setInventorySlotContents(slot1, copy);
return stack;
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -138,7 +138,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
else
{
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
if (m < stack.func_190916_E())
if (m < stack.getCount())
{
// copy the stack to not modify the original one
stack = stack.copy();
@@ -149,7 +149,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -157,7 +157,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
{
if (!simulate)
inv.setInventorySlotContents(slot1, stack);
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -177,37 +177,37 @@ public class SidedInvWrapper implements IItemHandlerModifiable
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
int slot1 = getSlot(inv, slot, side);
if (slot1 == -1)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack stackInSlot = inv.getStackInSlot(slot1);
if (stackInSlot.func_190926_b())
return ItemStack.field_190927_a;
if (stackInSlot.isEmpty())
return ItemStack.EMPTY;
if (!inv.canExtractItem(slot1, stackInSlot, side))
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
if (simulate)
{
if (stackInSlot.func_190916_E() < amount)
if (stackInSlot.getCount() < amount)
{
return stackInSlot.copy();
}
else
{
ItemStack copy = stackInSlot.copy();
copy.func_190920_e(amount);
copy.setCount(amount);
return copy;
}
}
else
{
int m = Math.min(stackInSlot.func_190916_E(), amount);
int m = Math.min(stackInSlot.getCount(), amount);
return inv.decrStackSize(slot1, m);
}
}