mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
Fixed stupidity in CraftInventory return types
This commit is contained in:
parent
92e3957a0e
commit
2c1f57e20b
1 changed files with 16 additions and 16 deletions
|
@ -30,8 +30,8 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
return new CraftItemStack(getInventory().c_(index));
|
return new CraftItemStack(getInventory().c_(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
CraftItemStack[] items = new CraftItemStack[getSize()];
|
ItemStack[] items = new ItemStack[getSize()];
|
||||||
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
|
||||||
|
|
||||||
for (int i = 0; i < mcItems.length; i++ ) {
|
for (int i = 0; i < mcItems.length; i++ ) {
|
||||||
|
@ -106,12 +106,12 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, CraftItemStack> all(int materialId) {
|
public HashMap<Integer, ItemStack> all(int materialId) {
|
||||||
HashMap<Integer, CraftItemStack> slots = new HashMap<Integer, CraftItemStack>();
|
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
CraftItemStack item = inventory[i];
|
ItemStack item = inventory[i];
|
||||||
if (item.getTypeId() == materialId) {
|
if (item.getTypeId() == materialId) {
|
||||||
slots.put( i, item );
|
slots.put( i, item );
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,14 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, CraftItemStack> all(Material material) {
|
public HashMap<Integer, ItemStack> all(Material material) {
|
||||||
return all(material.getId());
|
return all(material.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, CraftItemStack> all(ItemStack item) {
|
public HashMap<Integer, ItemStack> all(ItemStack item) {
|
||||||
HashMap<Integer, CraftItemStack> slots = new HashMap<Integer, CraftItemStack>();
|
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
if (item.equals(inventory[i])) {
|
if (item.equals(inventory[i])) {
|
||||||
slots.put( i, inventory[i] );
|
slots.put( i, inventory[i] );
|
||||||
|
@ -136,7 +136,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int first(int materialId) {
|
public int first(int materialId) {
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
if (inventory[i].getTypeId() == materialId) {
|
if (inventory[i].getTypeId() == materialId) {
|
||||||
return i;
|
return i;
|
||||||
|
@ -150,7 +150,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int first(ItemStack item) {
|
public int first(ItemStack item) {
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
if (item.equals(inventory[i])) {
|
if (item.equals(inventory[i])) {
|
||||||
return i;
|
return i;
|
||||||
|
@ -164,9 +164,9 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int firstPartial(int materialId) {
|
public int firstPartial(int materialId) {
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
CraftItemStack item = inventory[i];
|
ItemStack item = inventory[i];
|
||||||
if (item != null && item.getTypeId() == materialId && item.getAmount() < item.getMaxStackSize()) {
|
if (item != null && item.getTypeId() == materialId && item.getAmount() < item.getMaxStackSize()) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -179,9 +179,9 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int firstPartial(ItemStack item) {
|
public int firstPartial(ItemStack item) {
|
||||||
CraftItemStack[] inventory = getContents();
|
ItemStack[] inventory = getContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
CraftItemStack cItem = inventory[i];
|
ItemStack cItem = inventory[i];
|
||||||
if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
|
if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue