mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Fix PlayerTradeEvent visual issue when being cancelled (#11773)
This commit is contained in:
parent
cbf630d5b5
commit
17f649de1e
1 changed files with 3 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
--- a/net/minecraft/world/inventory/MerchantResultSlot.java
|
--- a/net/minecraft/world/inventory/MerchantResultSlot.java
|
||||||
+++ b/net/minecraft/world/inventory/MerchantResultSlot.java
|
+++ b/net/minecraft/world/inventory/MerchantResultSlot.java
|
||||||
@@ -47,13 +_,32 @@
|
@@ -47,13 +_,34 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTake(Player player, ItemStack stack) {
|
public void onTake(Player player, ItemStack stack) {
|
||||||
|
@ -19,6 +19,8 @@
|
||||||
+ if (!event.callEvent()) {
|
+ if (!event.callEvent()) {
|
||||||
+ stack.setCount(0);
|
+ stack.setCount(0);
|
||||||
+ event.getPlayer().updateInventory();
|
+ event.getPlayer().updateInventory();
|
||||||
|
+ int level = merchant instanceof net.minecraft.world.entity.npc.Villager villager ? villager.getVillagerData().getLevel() : 1;
|
||||||
|
+ serverPlayer.sendMerchantOffers(player.containerMenu.containerId, merchant.getOffers(), level, merchant.getVillagerXp(), merchant.showProgressBar(), merchant.canRestock());
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ activeOffer = org.bukkit.craftbukkit.inventory.CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft();
|
+ activeOffer = org.bukkit.craftbukkit.inventory.CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft();
|
||||||
|
|
Loading…
Reference in a new issue