PaperMC/nms-patches/ContainerShulkerBox.patch

35 lines
1.1 KiB
Diff
Raw Normal View History

2016-11-17 02:41:03 +01:00
--- 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;