aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch b/patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch
new file mode 100644
index 0000000000..0d7382d66f
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/inventory/ContainerMerchant.patch
@@ -0,0 +1,48 @@
+--- a/net/minecraft/world/inventory/ContainerMerchant.java
++++ b/net/minecraft/world/inventory/ContainerMerchant.java
+@@ -12,6 +12,8 @@
+ import net.minecraft.world.item.trading.MerchantRecipe;
+ import net.minecraft.world.item.trading.MerchantRecipeList;
+
++import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
++
+ public class ContainerMerchant extends Container {
+
+ protected static final int PAYMENT1_SLOT = 0;
+@@ -31,6 +33,19 @@
+ private boolean showProgressBar;
+ private boolean canRestock;
+
++ // CraftBukkit start
++ private CraftInventoryView bukkitEntity = null;
++ private PlayerInventory player;
++
++ @Override
++ public CraftInventoryView getBukkitView() {
++ if (bukkitEntity == null) {
++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(trader, tradeContainer), this);
++ }
++ return bukkitEntity;
++ }
++ // CraftBukkit end
++
+ public ContainerMerchant(int i, PlayerInventory playerinventory) {
+ this(i, playerinventory, new MerchantWrapper(playerinventory.player));
+ }
+@@ -42,6 +57,7 @@
+ this.addSlot(new Slot(this.tradeContainer, 0, 136, 37));
+ this.addSlot(new Slot(this.tradeContainer, 1, 162, 37));
+ this.addSlot(new SlotMerchantResult(playerinventory.player, imerchant, this.tradeContainer, 2, 220, 37));
++ this.player = playerinventory; // CraftBukkit - save player
+
+ int j;
+
+@@ -154,7 +170,7 @@
+ }
+
+ private void playTradeSound() {
+- if (!this.trader.isClientSide()) {
++ if (!this.trader.isClientSide() && this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035
+ Entity entity = (Entity) this.trader;
+
+ entity.level().playLocalSound(entity.getX(), entity.getY(), entity.getZ(), this.trader.getNotifyTradeSound(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);