mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-10 04:41:42 +01:00
SPIGOT-1543: Return combined slots for PlayerInventory.getContents
This commit is contained in:
parent
32587ed8e7
commit
f0c37a1671
@ -15,7 +15,7 @@
|
|||||||
public class PlayerInventory implements IInventory {
|
public class PlayerInventory implements IInventory {
|
||||||
|
|
||||||
public final ItemStack[] items = new ItemStack[36];
|
public final ItemStack[] items = new ItemStack[36];
|
||||||
@@ -14,6 +22,44 @@
|
@@ -14,6 +22,48 @@
|
||||||
private ItemStack carried;
|
private ItemStack carried;
|
||||||
public boolean f;
|
public boolean f;
|
||||||
|
|
||||||
@ -24,7 +24,11 @@
|
|||||||
+ private int maxStack = MAX_STACK;
|
+ private int maxStack = MAX_STACK;
|
||||||
+
|
+
|
||||||
+ public ItemStack[] getContents() {
|
+ 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() {
|
+ public ItemStack[] getArmorContents() {
|
||||||
@ -60,7 +64,7 @@
|
|||||||
public PlayerInventory(EntityHuman entityhuman) {
|
public PlayerInventory(EntityHuman entityhuman) {
|
||||||
this.g = new ItemStack[][] { this.items, this.armor, this.extraSlots};
|
this.g = new ItemStack[][] { this.items, this.armor, this.extraSlots};
|
||||||
this.player = entityhuman;
|
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);
|
return itemstack.getItem() == itemstack1.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +87,7 @@
|
|||||||
public int getFirstEmptySlotIndex() {
|
public int getFirstEmptySlotIndex() {
|
||||||
for (int i = 0; i < this.items.length; ++i) {
|
for (int i = 0; i < this.items.length; ++i) {
|
||||||
if (this.items[i] == null) {
|
if (this.items[i] == null) {
|
||||||
@@ -455,7 +517,7 @@
|
@@ -455,7 +521,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxStackSize() {
|
public int getMaxStackSize() {
|
||||||
@ -92,7 +96,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean b(IBlockData iblockdata) {
|
public boolean b(IBlockData iblockdata) {
|
||||||
@@ -511,6 +573,11 @@
|
@@ -511,6 +577,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getCarried() {
|
public ItemStack getCarried() {
|
||||||
|
Loading…
Reference in New Issue
Block a user