diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemStack.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemStack.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index d0a60c2d..a09d8d89 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -149,9 +149,17 @@ public final class ItemStack { public void damage(int i, EntityLiving entityliving) { if (this.f()) { if (i > 0 && entityliving instanceof EntityHuman) { - int j = EnchantmentManager.getDurabilityEnchantmentLevel(entityliving); + int j = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, this); + int k = 0; - if (j > 0 && entityliving.world.random.nextInt(j + 1) > 0) { + for (int l = 0; j > 0 && l < i; ++l) { + if (EnchantmentDurability.a(this, j, entityliving.world.random)) { + ++k; + } + } + + i -= k; + if (i <= 0) { return; } } @@ -237,7 +245,7 @@ public final class ItemStack { } public String a() { - return Item.byId[this.id].c_(this); + return Item.byId[this.id].d(this); } public static ItemStack b(ItemStack itemstack) { @@ -262,11 +270,11 @@ public final class ItemStack { } public int m() { - return this.getItem().a(this); + return this.getItem().c_(this); } public EnumAnimation n() { - return this.getItem().d_(this); + return this.getItem().b_(this); } public void b(World world, EntityHuman entityhuman, int i) { @@ -290,7 +298,7 @@ public final class ItemStack { } public String r() { - String s = this.getItem().j(this); + String s = this.getItem().l(this); if (this.tag != null && this.tag.hasKey("display")) { NBTTagCompound nbttagcompound = this.tag.getCompound("display"); @@ -320,7 +328,7 @@ public final class ItemStack { } public boolean v() { - return !this.getItem().k(this) ? false : !this.hasEnchantments(); + return !this.getItem().d_(this) ? false : !this.hasEnchantments(); } public void addEnchantment(Enchantment enchantment, int i) { |