mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
I believe this resolves berserk allowing you to take drops into your equipment slots.
This commit is contained in:
parent
2f7b1c38e1
commit
a2bcce9ab1
@ -26,7 +26,8 @@ public class Unarmed {
|
|||||||
if (inventory.containsAtLeast(dropStack, 1)) {
|
if (inventory.containsAtLeast(dropStack, 1)) {
|
||||||
int nextSlot = 0;
|
int nextSlot = 0;
|
||||||
|
|
||||||
for (ItemStack itemstack : inventory) {
|
ItemStack[] items = inventory.getStorageContents();
|
||||||
|
for (ItemStack itemstack : items) {
|
||||||
if (dropStack.isSimilar(itemstack)) {
|
if (dropStack.isSimilar(itemstack)) {
|
||||||
int itemAmount = itemstack.getAmount();
|
int itemAmount = itemstack.getAmount();
|
||||||
int itemMax = itemstack.getMaxStackSize();
|
int itemMax = itemstack.getMaxStackSize();
|
||||||
@ -36,13 +37,15 @@ public class Unarmed {
|
|||||||
if (dropAmount + itemAmount <= itemMax) {
|
if (dropAmount + itemAmount <= itemMax) {
|
||||||
drop.remove();
|
drop.remove();
|
||||||
addStack.setAmount(dropAmount + itemAmount);
|
addStack.setAmount(dropAmount + itemAmount);
|
||||||
inventory.setItem(nextSlot, addStack);
|
items[nextSlot] = addStack;
|
||||||
|
inventory.setStorageContents(items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addStack.setAmount(itemMax);
|
addStack.setAmount(itemMax);
|
||||||
dropAmount = dropAmount + itemAmount - itemMax;
|
dropAmount = dropAmount + itemAmount - itemMax;
|
||||||
inventory.setItem(nextSlot, addStack);
|
items[nextSlot] = addStack;
|
||||||
|
inventory.setStorageContents(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropAmount == 0) {
|
if (dropAmount == 0) {
|
||||||
@ -57,13 +60,15 @@ public class Unarmed {
|
|||||||
if (firstEmpty == inventory.getHeldItemSlot()) {
|
if (firstEmpty == inventory.getHeldItemSlot()) {
|
||||||
int nextSlot = firstEmpty + 1;
|
int nextSlot = firstEmpty + 1;
|
||||||
|
|
||||||
for (Iterator<ItemStack> iterator = inventory.iterator(nextSlot); iterator.hasNext(); ) {
|
ItemStack[] items = inventory.getStorageContents();
|
||||||
ItemStack itemstack = iterator.next();
|
for (; nextSlot < items.length; nextSlot++) {
|
||||||
|
ItemStack itemstack = items[nextSlot];
|
||||||
|
|
||||||
if (itemstack == null) {
|
if (itemstack == null) {
|
||||||
drop.remove();
|
drop.remove();
|
||||||
dropStack.setAmount(dropAmount);
|
dropStack.setAmount(dropAmount);
|
||||||
inventory.setItem(nextSlot, dropStack);
|
items[nextSlot] = dropStack;
|
||||||
|
inventory.setStorageContents(items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user