Archiviert
13
0

SPIGOT-1543: Return combined slots for PlayerInventory.getContents

Dieser Commit ist enthalten in:
md_5 2016-03-01 16:40:12 +11:00
Ursprung 32587ed8e7
Commit f0c37a1671

Datei anzeigen

@ -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() {