--- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
+++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
@@ -22,10 +_,11 @@
 import net.minecraft.world.phys.Vec3;
 
 public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity {
-    private NonNullList<ItemStack> itemStacks = NonNullList.withSize(36, ItemStack.EMPTY);
+    private NonNullList<ItemStack> itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
     @Nullable
-    private ResourceKey<LootTable> lootTable;
-    private long lootTableSeed;
+    public ResourceKey<LootTable> lootTable;
+    public long lootTableSeed;
+    private final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(); // Paper - LootTable API
 
     protected AbstractMinecartContainer(EntityType<?> entityType, Level level) {
         super(entityType, level);
@@ -72,12 +_,12 @@
     }
 
     @Override
-    public void remove(Entity.RemovalReason reason) {
+    public void remove(Entity.RemovalReason reason, @Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { // CraftBukkit - add Bukkit remove cause
         if (!this.level().isClientSide() && reason.shouldDestroy()) {
             Containers.dropContents(this.level(), this, this);
         }
 
-        super.remove(reason);
+        super.remove(reason, cause); // CraftBukkit - add Bukkit remove cause
     }
 
     @Override
@@ -165,4 +_,56 @@
     public void clearItemStacks() {
         this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
     }
+
+    // Paper start - LootTable API
+    @Override
+    public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() {
+        return this.lootableData;
+    }
+    // Paper end - LootTable API
+
+    // CraftBukkit start
+    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.itemStacks;
+    }
+
+    @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 @Nullable org.bukkit.inventory.InventoryHolder getOwner() {
+        return this.getBukkitEntity() instanceof final org.bukkit.inventory.InventoryHolder inventoryHolder ? inventoryHolder : null;
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        return this.maxStack;
+    }
+
+    @Override
+    public void setMaxStackSize(int size) {
+        this.maxStack = size;
+    }
+
+    @Override
+    public org.bukkit.Location getLocation() {
+        return this.getBukkitEntity().getLocation();
+    }
+    // CraftBukkit end
 }
