Skip to content

Commit

Permalink
1.11.2 port is working as intended \o/
Browse files Browse the repository at this point in the history
  • Loading branch information
XDjackieXD committed Jun 29, 2017
1 parent 8321def commit 62c26fa
Showing 1 changed file with 0 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,83 +95,4 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
}
return currentStack;
}

@Override
protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) {
boolean success = false;
int index = startIndex;

if (useEndIndex)
index = endIndex - 1;

Slot slot;
ItemStack stackinslot;

if (stack.isStackable()) {
while (stack.getCount() > 0 && (!useEndIndex && index < endIndex || useEndIndex && index >= startIndex)) {
slot = this.inventorySlots.get(index);
stackinslot = slot.getStack();

if (stackinslot != ItemStack.EMPTY && stackinslot.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getItemDamage() == stackinslot.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, stackinslot)) {
int l = stackinslot.getCount() + stack.getCount();
int maxsize = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());

if (l <= maxsize) {
stack.setCount(0);
stackinslot.setCount(l);
slot.onSlotChanged();
success = true;
} else if (stackinslot.getCount() < maxsize) {
stack.setCount((stack.getMaxStackSize() - stackinslot.getCount()) - stack.getCount());
stackinslot.setCount(stack.getMaxStackSize());
slot.onSlotChanged();
success = true;
}
}

if (useEndIndex) {
--index;
} else {
++index;
}
}
}

if (stack.getCount() > 0) {
if (useEndIndex) {
index = endIndex - 1;
} else {
index = startIndex;
}

while (!useEndIndex && index < endIndex || useEndIndex && index >= startIndex && stack.getCount() > 0) {
slot = this.inventorySlots.get(index);
stackinslot = slot.getStack();

// Forge: Make sure to respect isItemValid in the slot.
if (stackinslot == ItemStack.EMPTY && slot.isItemValid(stack)) {
if (stack.getCount() < slot.getSlotStackLimit()) {
slot.putStack(stack.copy());
stack.setCount(0);
success = true;
break;
} else {
ItemStack newstack = stack.copy();
newstack.setCount(slot.getSlotStackLimit());
slot.putStack(newstack);
stack.setCount(slot.getSlotStackLimit() - stack.getCount());
success = true;
}
}

if (useEndIndex) {
--index;
} else {
++index;
}
}
}

return success;
}
}

0 comments on commit 62c26fa

Please sign in to comment.