--- a/net/minecraft/world/level/block/entity/ShelfBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ShelfBlockEntity.java
@@ -34,6 +_,47 @@
     private final NonNullList<ItemStack> items = NonNullList.withSize(3, ItemStack.EMPTY);
     private boolean alignItemsToBottom;
 
+    // CraftBukkit start - add fields and methods
+    public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+    private int maxStack = MAX_STACK;
+
+    @Override
+    public java.util.List<net.minecraft.world.item.ItemStack> getContents() {
+        return this.items;
+    }
+
+    @Override
+    public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+        this.transaction.add(player);
+    }
+
+    @Override
+    public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+        this.transaction.remove(player);
+    }
+
+    @Override
+    public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+        return this.transaction;
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        return this.maxStack;
+    }
+
+    @Override
+    public void setMaxStackSize(int size) {
+        this.maxStack = size;
+    }
+
+    @Override
+    public @javax.annotation.Nullable org.bukkit.Location getLocation() {
+        if (this.level == null) return null;
+        return org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.worldPosition, this.level);
+    }
+    // CraftBukkit end
+
     public ShelfBlockEntity(BlockPos pos, BlockState state) {
         super(BlockEntityType.SHELF, pos, state);
     }
