Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/ContainerMerchant.patch

46 Zeilen
1.8 KiB
Diff

--- a/net/minecraft/server/ContainerMerchant.java
+++ b/net/minecraft/server/ContainerMerchant.java
@@ -1,10 +1,25 @@
package net.minecraft.server;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
+
public class ContainerMerchant extends Container {
private final IMerchant merchant;
private final InventoryMerchant inventoryMerchant;
+ // 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(merchant, inventoryMerchant), this);
+ }
+ return bukkitEntity;
+ }
+ // CraftBukkit end
+
public ContainerMerchant(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new MerchantWrapper(playerinventory.player));
}
@@ -16,6 +31,7 @@
this.a(new Slot(this.inventoryMerchant, 0, 136, 37));
this.a(new Slot(this.inventoryMerchant, 1, 162, 37));
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.inventoryMerchant, 2, 220, 37)));
+ this.player = playerinventory; // CraftBukkit - save player
int j;
@@ -96,7 +112,7 @@
}
private void j() {
- if (!this.merchant.getWorld().isClientSide) {
+ if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035
Entity entity = (Entity) this.merchant;
this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.eb(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);