summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerInventory.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-03-01 16:40:12 +1100
committermd_5 <git@md-5.net>2016-03-01 16:40:12 +1100
commitf0c37a16714f54355e9a6a1e61025b435faf6ef6 (patch)
tree5d1310e9573edb10b1f59fc69c455f6bda4a7512 /nms-patches/PlayerInventory.patch
parent32587ed8e7e349f7f4d374541a2de9a7982f33d3 (diff)
downloadcraftbukkit-f0c37a16714f54355e9a6a1e61025b435faf6ef6.tar
craftbukkit-f0c37a16714f54355e9a6a1e61025b435faf6ef6.tar.gz
craftbukkit-f0c37a16714f54355e9a6a1e61025b435faf6ef6.tar.lz
craftbukkit-f0c37a16714f54355e9a6a1e61025b435faf6ef6.tar.xz
craftbukkit-f0c37a16714f54355e9a6a1e61025b435faf6ef6.zip
SPIGOT-1543: Return combined slots for PlayerInventory.getContents
Diffstat (limited to 'nms-patches/PlayerInventory.patch')
-rw-r--r--nms-patches/PlayerInventory.patch14
1 files changed, 9 insertions, 5 deletions
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() {