From 7b44d4640135e4b268afaa72f2222006069db336 Mon Sep 17 00:00:00 2001 From: Doc Date: Tue, 5 Nov 2024 14:12:23 +1100 Subject: [PATCH] SPIGOT-7931: Fix sync in Anvil View when result item is taken --- .../net/minecraft/world/inventory/ContainerAnvil.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch b/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch index 74393b2c8..9bf68e92e 100644 --- a/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch +++ b/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch @@ -92,13 +92,12 @@ itemstack1 = ItemStack.EMPTY; } -@@ -285,11 +294,12 @@ +@@ -285,12 +294,13 @@ EnchantmentManager.setEnchantments(itemstack1, itemenchantments_a.toImmutable()); } - this.resultSlots.setItem(0, itemstack1); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit -+ sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client this.broadcastChanges(); } else { - this.resultSlots.setItem(0, ItemStack.EMPTY); @@ -106,8 +105,10 @@ + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit + this.cost.set(DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item } ++ sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686, SPIGOT-7931: Always send completed inventory to stay in sync with client } + public static int calculateIncreasedRepairCost(int i) { @@ -329,4 +339,19 @@ public int getCost() { return this.cost.get();