--- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
@@ -12,13 +12,50 @@
 import net.minecraft.world.inventory.DispenserMenu;
 import net.minecraft.world.item.ItemStack;
 import net.minecraft.world.level.block.state.BlockState;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.v1_19_R1.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
 
 public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
+
     public static final int CONTAINER_SIZE = 9;
-    private NonNullList<ItemStack> items = NonNullList.withSize(9, ItemStack.EMPTY);
+    private NonNullList<ItemStack> items;
+
+    // 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) {
+        this.transaction.add(who);
+    }
+
+    public void onClose(CraftHumanEntity who) {
+        this.transaction.remove(who);
+    }
+
+    public List<HumanEntity> getViewers() {
+        return this.transaction;
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        return this.maxStack;
+    }
+
+    public void setMaxStackSize(int size) {
+        this.maxStack = size;
+    }
+    // CraftBukkit end
 
     protected DispenserBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
         super(type, pos, state);
+        this.items = NonNullList.withSize(9, ItemStack.EMPTY);
     }
 
     public DispenserBlockEntity(BlockPos pos, BlockState state) {
@@ -31,12 +68,12 @@
     }
 
     public int getRandomSlot(RandomSource random) {
-        this.unpackLootTable((Player)null);
+        this.unpackLootTable((Player) null);
         int i = -1;
         int j = 1;
 
-        for(int k = 0; k < this.items.size(); ++k) {
-            if (!this.items.get(k).isEmpty() && random.nextInt(j++) == 0) {
+        for (int k = 0; k < this.items.size(); ++k) {
+            if (!((ItemStack) this.items.get(k)).isEmpty() && random.nextInt(j++) == 0) {
                 i = k;
             }
         }
@@ -45,8 +82,8 @@
     }
 
     public int addItem(ItemStack stack) {
-        for(int i = 0; i < this.items.size(); ++i) {
-            if (this.items.get(i).isEmpty()) {
+        for (int i = 0; i < this.items.size(); ++i) {
+            if (((ItemStack) this.items.get(i)).isEmpty()) {
                 this.setItem(i, stack);
                 return i;
             }
