mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-22 04:16:17 +00:00
49 lines
2.0 KiB
Diff
49 lines
2.0 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerMerchant.java
|
|
+++ b/net/minecraft/world/inventory/ContainerMerchant.java
|
|
@@ -13,6 +13,8 @@
|
|
import net.minecraft.world.item.trading.MerchantRecipe;
|
|
import net.minecraft.world.item.trading.MerchantRecipeList;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.view.CraftMerchantView; // CraftBukkit
|
|
+
|
|
public class ContainerMerchant extends Container {
|
|
|
|
protected static final int PAYMENT1_SLOT = 0;
|
|
@@ -32,6 +34,19 @@
|
|
private boolean showProgressBar;
|
|
private boolean canRestock;
|
|
|
|
+ // CraftBukkit start
|
|
+ private CraftMerchantView bukkitEntity = null;
|
|
+ private PlayerInventory player;
|
|
+
|
|
+ @Override
|
|
+ public CraftMerchantView getBukkitView() {
|
|
+ if (bukkitEntity == null) {
|
|
+ bukkitEntity = new CraftMerchantView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(trader, tradeContainer), this, trader);
|
|
+ }
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public ContainerMerchant(int i, PlayerInventory playerinventory) {
|
|
this(i, playerinventory, new MerchantWrapper(playerinventory.player));
|
|
}
|
|
@@ -43,6 +58,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
|
|
this.addStandardInventorySlots(playerinventory, 108, 84);
|
|
}
|
|
|
|
@@ -143,7 +159,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);
|