--- a/net/minecraft/world/level/block/entity/TileEntityChest.java
+++ b/net/minecraft/world/level/block/entity/TileEntityChest.java
@@ -23,6 +23,12 @@
 import net.minecraft.world.level.block.state.IBlockData;
 import net.minecraft.world.level.block.state.properties.BlockPropertyChestType;
 
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
 public class TileEntityChest extends TileEntityLootable implements LidBlockEntity {
 
     private static final int EVENT_SET_OPEN_COUNT = 1;
@@ -30,6 +36,36 @@
     public final ContainerOpenersCounter openersCounter;
     private final ChestLidController chestLidController;
 
+    // CraftBukkit start - add fields and methods
+    public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+    private int maxStack = MAX_STACK;
+
+    public List<ItemStack> getContents() {
+        return this.items;
+    }
+
+    public void onOpen(CraftHumanEntity who) {
+        transaction.add(who);
+    }
+
+    public void onClose(CraftHumanEntity who) {
+        transaction.remove(who);
+    }
+
+    public List<HumanEntity> getViewers() {
+        return transaction;
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        return maxStack;
+    }
+
+    public void setMaxStackSize(int size) {
+        maxStack = size;
+    }
+    // CraftBukkit end
+
     protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
         super(tileentitytypes, blockposition, iblockdata);
         this.items = NonNullList.withSize(27, ItemStack.EMPTY);
@@ -198,4 +234,11 @@
 
         world.blockEvent(blockposition, block, 1, j);
     }
+
+    // CraftBukkit start
+    @Override
+    public boolean onlyOpCanSetNbt() {
+        return true;
+    }
+    // CraftBukkit end
 }
