mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Renamed ItemStack.set/getDamage to durability, which is now a short
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
4388c95e43
commit
91b6778723
3 changed files with 11 additions and 11 deletions
|
@ -125,7 +125,7 @@ public class CraftWorld implements World {
|
||||||
net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(
|
net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(
|
||||||
item.getTypeId(),
|
item.getTypeId(),
|
||||||
item.getAmount(),
|
item.getAmount(),
|
||||||
item.getDamage()
|
item.getDurability()
|
||||||
);
|
);
|
||||||
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
|
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
|
||||||
entity.c = 10;
|
entity.c = 10;
|
||||||
|
|
|
@ -53,13 +53,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||||
if (item == null || item.getTypeId() <= 0) {
|
if (item == null || item.getTypeId() <= 0) {
|
||||||
mcItems[i] = null;
|
mcItems[i] = null;
|
||||||
} else {
|
} else {
|
||||||
mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage());
|
mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(int index, ItemStack item) {
|
public void setItem(int index, ItemStack item) {
|
||||||
getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage())));
|
getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(int materialId) {
|
public boolean contains(int materialId) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class CraftItemStack extends ItemStack {
|
||||||
super(
|
super(
|
||||||
item != null ? item.id: 0,
|
item != null ? item.id: 0,
|
||||||
item != null ? item.count : 0,
|
item != null ? item.count : 0,
|
||||||
(byte)(item != null ? item.damage : 0)
|
(short)(item != null ? item.damage : 0)
|
||||||
);
|
);
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
@ -101,21 +101,21 @@ public class CraftItemStack extends ItemStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDamage(final byte damage) {
|
public void setDurability(final short durability) {
|
||||||
// Ignore damage if item is null
|
// Ignore damage if item is null
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
super.setDamage(damage);
|
super.setDurability(durability);
|
||||||
item.damage = damage;
|
item.damage = durability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getDamage() {
|
public short getDurability() {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
super.setDamage((byte) item.damage); // sync, needed?
|
super.setDurability((short) item.damage); // sync, needed?
|
||||||
return (byte) item.damage;
|
return (short) item.damage;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue