mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Updated Inventory with proper generics, fixed ItemStack to have data as 'Byte' so we can put in nulls when not having data.
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
48feb74b19
commit
3b1fe7dcf7
3 changed files with 8 additions and 8 deletions
|
@ -104,7 +104,7 @@ public interface Inventory {
|
|||
* @param materialId The materialId to look for
|
||||
* @return The Slots found.
|
||||
*/
|
||||
public HashMap<Integer,ItemStack> all(int materialId);
|
||||
public HashMap<Integer, ? extends ItemStack> all(int materialId);
|
||||
|
||||
/**
|
||||
* Find all slots in the inventory containing any ItemStacks with the given material
|
||||
|
@ -112,7 +112,7 @@ public interface Inventory {
|
|||
* @param materialId The material to look for
|
||||
* @return The Slots found.
|
||||
*/
|
||||
public HashMap<Integer,ItemStack> all(Material material);
|
||||
public HashMap<Integer, ? extends ItemStack> all(Material material);
|
||||
|
||||
/**
|
||||
* Find all slots in the inventory containing any ItemStacks with the given ItemStack
|
||||
|
@ -121,7 +121,7 @@ public interface Inventory {
|
|||
* @param item The ItemStack to match against
|
||||
* @return The Slots found.
|
||||
*/
|
||||
public HashMap<Integer,ItemStack> all(ItemStack item);
|
||||
public HashMap<Integer, ? extends ItemStack> all(ItemStack item);
|
||||
|
||||
/**
|
||||
* Find the first slot in the inventory containing an ItemStack with the given materialId
|
||||
|
|
|
@ -30,21 +30,21 @@ public class ItemStack {
|
|||
}
|
||||
|
||||
public ItemStack(final int type, final int amount, final byte damage) {
|
||||
this(type, amount, damage, (byte) 0);
|
||||
this(type, amount, damage, null);
|
||||
}
|
||||
|
||||
public ItemStack(final Material type, final int amount, final byte damage) {
|
||||
this(type.getId(), amount, damage);
|
||||
}
|
||||
|
||||
public ItemStack(final int type, final int amount, final byte damage, final byte data) {
|
||||
public ItemStack(final int type, final int amount, final byte damage, final Byte data) {
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
this.damage = damage;
|
||||
createData(data);
|
||||
if (data != null) createData(data);
|
||||
}
|
||||
|
||||
public ItemStack(final Material type, final int amount, final byte damage, final byte data) {
|
||||
public ItemStack(final Material type, final int amount, final byte damage, final Byte data) {
|
||||
this(type.getId(), amount, damage, data);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public interface PlayerInventory extends Inventory {
|
|||
/**
|
||||
* Returns the ItemStack currently hold
|
||||
*
|
||||
* @return The currently holded ItemStack
|
||||
* @return The currently held ItemStack
|
||||
*/
|
||||
public ItemStack getItemInHand();
|
||||
|
||||
|
|
Loading…
Reference in a new issue