SPIGOT-7931: Fix sync in Anvil View when result item is taken

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2024-11-05 14:12:23 +11:00
parent 8fc0f462c0
commit d27615dcaf

View File

@ -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();