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

This commit is contained in:
Doc 2024-11-05 14:12:23 +11:00 committed by md_5
parent df1efc0bbf
commit 7b44d46401
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

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