Files
CatServer/patches/net/minecraft/inventory/ContainerMerchant.java.patch
2019-02-24 22:29:41 +08:00

42 lines
1.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/inventory/ContainerMerchant.java
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerMerchant.java
@@ -5,6 +5,7 @@
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerMerchant extends Container
{
@@ -12,6 +13,9 @@
private final InventoryMerchant merchantInventory;
private final World world;
+ private CraftInventoryView bukkitEntity = null;
+ private InventoryPlayer player;
+
public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn)
{
this.merchant = merchant;
@@ -20,6 +24,7 @@
this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53));
+ this.player = playerInventory;
for (int i = 0; i < 3; ++i)
{
@@ -137,4 +142,12 @@
}
}
}
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity == null) {
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(merchantInventory), this);
+ }
+ return bukkitEntity;
+ }
}