Paper/nms-patches/ContainerMerchant.patch

37 lines
1.3 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ContainerMerchant.java
+++ b/net/minecraft/server/ContainerMerchant.java
2019-04-23 04:00:00 +02:00
@@ -1,10 +1,25 @@
package net.minecraft.server;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
2016-11-17 02:41:03 +01:00
+
public class ContainerMerchant extends Container {
2016-11-17 02:41:03 +01:00
private final IMerchant merchant;
2019-04-23 04:00:00 +02:00
private final InventoryMerchant inventoryMerchant;
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity == null) {
2019-04-28 04:35:28 +02:00
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(merchant, inventoryMerchant), this);
+ }
+ return bukkitEntity;
+ }
+ // CraftBukkit end
2015-02-26 23:41:06 +01:00
+
2019-04-23 04:00:00 +02:00
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
2019-04-23 04:00:00 +02:00
int j;