PaperMC/paper-server/nms-patches/net/minecraft/world/inventory/ContainerShulkerBox.patch
CraftBukkit/Spigot b3a8254758 Update to Minecraft 1.17
By: md_5 <git@md-5.net>
2021-06-11 15:00:00 +10:00

40 lines
1.4 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerShulkerBox.java
+++ b/net/minecraft/world/inventory/ContainerShulkerBox.java
@@ -6,10 +6,29 @@
import net.minecraft.world.entity.player.PlayerInventory;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerShulkerBox extends Container {
private static final int CONTAINER_SIZE = 27;
private final IInventory container;
+ // 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.container), this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerShulkerBox(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(27));
@@ -19,6 +38,7 @@
super(Containers.SHULKER_BOX, i);
a(iinventory, 27);
this.container = iinventory;
+ this.player = playerinventory; // CraftBukkit - save player
iinventory.startOpen(playerinventory.player);
boolean flag = true;
boolean flag1 = true;