From f0c37a16714f54355e9a6a1e61025b435faf6ef6 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 16:40:12 +1100 Subject: SPIGOT-1543: Return combined slots for PlayerInventory.getContents --- nms-patches/PlayerInventory.patch | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch index 285ff230..00993e86 100644 --- a/nms-patches/PlayerInventory.patch +++ b/nms-patches/PlayerInventory.patch @@ -15,7 +15,7 @@ public class PlayerInventory implements IInventory { public final ItemStack[] items = new ItemStack[36]; -@@ -14,6 +22,44 @@ +@@ -14,6 +22,48 @@ private ItemStack carried; public boolean f; @@ -24,7 +24,11 @@ + private int maxStack = MAX_STACK; + + public ItemStack[] getContents() { -+ return this.items; ++ ItemStack[] combined = new ItemStack[items.length + armor.length + extraSlots.length]; ++ System.arraycopy(items, 0, combined, 0, items.length); ++ System.arraycopy(armor, 0, combined, items.length, armor.length); ++ System.arraycopy(extraSlots, 0, combined, items.length + armor.length, extraSlots.length); ++ return combined; + } + + public ItemStack[] getArmorContents() { @@ -60,7 +64,7 @@ public PlayerInventory(EntityHuman entityhuman) { this.g = new ItemStack[][] { this.items, this.armor, this.extraSlots}; this.player = entityhuman; -@@ -35,6 +81,22 @@ +@@ -35,6 +85,22 @@ return itemstack.getItem() == itemstack1.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1); } @@ -83,7 +87,7 @@ public int getFirstEmptySlotIndex() { for (int i = 0; i < this.items.length; ++i) { if (this.items[i] == null) { -@@ -455,7 +517,7 @@ +@@ -455,7 +521,7 @@ } public int getMaxStackSize() { @@ -92,7 +96,7 @@ } public boolean b(IBlockData iblockdata) { -@@ -511,6 +573,11 @@ +@@ -511,6 +577,11 @@ } public ItemStack getCarried() { -- cgit v1.2.3