3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/nms-patches/ContainerMerchant.patch

39 Zeilen
1.3 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ContainerMerchant.java
+++ b/net/minecraft/server/ContainerMerchant.java
2016-05-10 13:47:39 +02:00
@@ -1,6 +1,7 @@
package net.minecraft.server;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
2016-05-10 13:47:39 +02:00
public class ContainerMerchant extends Container {
2016-05-10 13:47:39 +02:00
@@ -8,6 +9,19 @@
2016-06-09 03:43:49 +02:00
private final InventoryMerchant f;
private final World g;
2015-02-26 23:41:06 +01:00
+ // 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
2015-02-26 23:41:06 +01:00
+
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
this.merchant = imerchant;
2015-02-26 23:41:06 +01:00
this.g = world;
2016-05-10 13:47:39 +02:00
@@ -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;