3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 14:28:09 +01:00
Paper/nms-patches/ContainerMerchant.patch
2016-06-09 11:43:49 +10:00

39 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/ContainerMerchant.java
+++ b/net/minecraft/server/ContainerMerchant.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
public class ContainerMerchant extends Container {
@@ -8,6 +9,19 @@
private final InventoryMerchant f;
private final World g;
+ // 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((InventoryMerchant) f), this);
+ }
+ return bukkitEntity;
+ }
+ // CraftBukkit end
+
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
this.merchant = imerchant;
this.g = world;
@@ -15,6 +29,7 @@
this.a(new Slot(this.f, 0, 36, 53));
this.a(new Slot(this.f, 1, 62, 53));
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.f, 2, 120, 53)));
+ this.player = playerinventory; // CraftBukkit - save player
int i;