PaperMC/nms-patches/ContainerShulkerBox.patch
2016-11-17 12:41:03 +11:00

34 lines
1.1 KiB
Diff

--- a/net/minecraft/server/ContainerShulkerBox.java
+++ b/net/minecraft/server/ContainerShulkerBox.java
@@ -1,11 +1,31 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerShulkerBox extends Container {
private final IInventory a;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.a), this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerShulkerBox(PlayerInventory playerinventory, IInventory iinventory, EntityHuman entityhuman) {
this.a = iinventory;
+ this.player = playerinventory; // CraftBukkit - save player
iinventory.startOpen(entityhuman);
boolean flag = true;
boolean flag1 = true;