diff options
author | Parker Hawke <hawkeboyz2@hotmail.com> | 2018-10-05 21:48:54 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-10-06 19:26:40 +1000 |
commit | 1ceee63341927e71e23293be6cb7466bd3045e9e (patch) | |
tree | 9e48ed33a96ff148e6932bcebba8bb5b8abf3904 /nms-patches/ContainerAnvil.patch | |
parent | 6a0c4e1cc2518ad246ad51dc9c06412f3c46371f (diff) | |
download | craftbukkit-1ceee63341927e71e23293be6cb7466bd3045e9e.tar craftbukkit-1ceee63341927e71e23293be6cb7466bd3045e9e.tar.gz craftbukkit-1ceee63341927e71e23293be6cb7466bd3045e9e.tar.lz craftbukkit-1ceee63341927e71e23293be6cb7466bd3045e9e.tar.xz craftbukkit-1ceee63341927e71e23293be6cb7466bd3045e9e.zip |
Implement maximum repair cost API to AnvilInventory
Diffstat (limited to 'nms-patches/ContainerAnvil.patch')
-rw-r--r-- | nms-patches/ContainerAnvil.patch | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index 12c342d8..c5787ca8 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -11,11 +11,12 @@ public class ContainerAnvil extends Container { private static final Logger f = LogManager.getLogger(); -@@ -22,8 +26,14 @@ +@@ -22,8 +26,15 @@ private int k; public String renameText; private final EntityHuman m; + // CraftBukkit start ++ public int maximumRepairCost = 40; + private int lastLevelCost; + private CraftInventoryView bukkitEntity; + private PlayerInventory player; @@ -26,7 +27,7 @@ this.j = blockposition; this.i = world; this.m = entityhuman; -@@ -111,7 +121,7 @@ +@@ -111,7 +122,7 @@ byte b1 = 0; if (itemstack.isEmpty()) { @@ -35,7 +36,7 @@ this.levelCost = 0; } else { ItemStack itemstack1 = itemstack.cloneItemStack(); -@@ -129,7 +139,7 @@ +@@ -129,7 +140,7 @@ if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) { k = Math.min(itemstack1.getDamage(), itemstack1.h() / 4); if (k <= 0) { @@ -44,7 +45,7 @@ this.levelCost = 0; return; } -@@ -144,7 +154,7 @@ +@@ -144,7 +155,7 @@ this.k = l; } else { if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) { @@ -53,7 +54,7 @@ this.levelCost = 0; return; } -@@ -237,7 +247,7 @@ +@@ -237,7 +248,7 @@ } if (flag2 && !flag1) { @@ -62,7 +63,22 @@ this.levelCost = 0; return; } -@@ -284,7 +294,7 @@ +@@ -261,11 +272,11 @@ + itemstack1 = ItemStack.a; + } + +- if (b1 == i && b1 > 0 && this.levelCost >= 40) { +- this.levelCost = 39; ++ if (b1 == i && b1 > 0 && this.levelCost >= maximumRepairCost) { // CraftBukkit ++ this.levelCost = maximumRepairCost - 1; // CraftBukkit + } + +- if (this.levelCost >= 40 && !this.m.abilities.canInstantlyBuild) { ++ if (this.levelCost >= maximumRepairCost && !this.m.abilities.canInstantlyBuild) { // CraftBukkit + itemstack1 = ItemStack.a; + } + +@@ -284,7 +295,7 @@ EnchantmentManager.a(map, itemstack1); } @@ -71,7 +87,7 @@ this.b(); } } -@@ -302,6 +312,7 @@ +@@ -302,6 +313,7 @@ } public boolean canUse(EntityHuman entityhuman) { @@ -79,7 +95,7 @@ return !this.i.getType(this.j).a(TagsBlock.ANVIL) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; } -@@ -357,4 +368,33 @@ +@@ -357,4 +369,33 @@ this.d(); } |