Commits
Phoenix616 authored and md_5 committed 6719d1f1e7d
47 47 | |
48 48 | |
49 49 | int i = this.a(entityhuman, this.value); |
50 50 | |
51 51 | if (i > 0) { |
52 52 | - entityhuman.giveExp(i); |
53 53 | + entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, i).getAmount()); // CraftBukkit - this.value -> event.getAmount() |
54 54 | } |
55 55 | |
56 56 | --this.count; |
57 - | |
57 + | |
58 58 | if (entry != null) { |
59 59 | ItemStack itemstack = (ItemStack) entry.getValue(); |
60 60 | int j = Math.min(this.c(this.value), itemstack.getDamage()); |
61 61 | + // CraftBukkit start |
62 62 | + org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, j); |
63 63 | + j = event.getRepairAmount(); |
64 64 | + if (event.isCancelled()) { |
65 65 | + return i; |
66 66 | + } |
67 67 | + // CraftBukkit end |
68 68 | |
69 69 | itemstack.setDamage(itemstack.getDamage() - j); |
70 70 | int k = i - this.b(j); |
71 - | |
71 + | + this.value = k; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls |
72 + | |
73 + | return k > 0 ? this.a(entityhuman, k) : 0; |
74 + | } else { |
75 + | |
72 76 | } |
73 77 | |
74 78 | public static int getOrbValue(int i) { |
75 79 | + // CraftBukkit start |
76 80 | + if (i > 162670129) return i - 100000; |
77 81 | + if (i > 81335063) return 81335063; |
78 82 | + if (i > 40667527) return 40667527; |
79 83 | + if (i > 20333759) return 20333759; |
80 84 | + if (i > 10166857) return 10166857; |
81 85 | + if (i > 5083423) return 5083423; |