--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -62,22 +_,26 @@
     default void addChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
         if (this.getContainerLootTable() != null) {
             tag.putString("LootTable", this.getContainerLootTable().location().toString());
+            this.lootableData().saveNbt(tag); // Paper
             if (this.getContainerLootTableSeed() != 0L) {
                 tag.putLong("LootTableSeed", this.getContainerLootTableSeed());
             }
-        } else {
-            ContainerHelper.saveAllItems(tag, this.getItemStacks(), levelRegistry);
         }
+        ContainerHelper.saveAllItems(tag, this.getItemStacks(), levelRegistry); // Paper - always save the items, table may still remain
     }
 
     default void readChestVehicleSaveData(CompoundTag tag, HolderLookup.Provider levelRegistry) {
         this.clearItemStacks();
         if (tag.contains("LootTable", 8)) {
-            this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(tag.getString("LootTable"))));
+            this.setContainerLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(tag.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
+            // Paper start - LootTable API
+            if (this.getContainerLootTable() != null) {
+                this.lootableData().loadNbt(tag);
+            }
+            // Paper end - LootTable API
             this.setContainerLootTableSeed(tag.getLong("LootTableSeed"));
-        } else {
-            ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry);
         }
+        ContainerHelper.loadAllItems(tag, this.getItemStacks(), levelRegistry); // Paper - always read the items, table may still remain
     }
 
     default void chestVehicleDestroyed(DamageSource damageSource, ServerLevel level, Entity entity) {
@@ -91,19 +_,27 @@
     }
 
     default InteractionResult interactWithContainerVehicle(Player player) {
-        player.openMenu(this);
+        // Paper start - Fix InventoryOpenEvent cancellation
+        if (player.openMenu(this).isEmpty()) {
+            return InteractionResult.PASS;
+        }
+        // Paper end - Fix InventoryOpenEvent cancellation
         return InteractionResult.SUCCESS;
     }
 
     default void unpackChestVehicleLootTable(@Nullable Player player) {
         MinecraftServer server = this.level().getServer();
-        if (this.getContainerLootTable() != null && server != null) {
+        if (server != null && this.lootableData().shouldReplenish(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.ENTITY, player)) { // Paper - LootTable API
             LootTable lootTable = server.reloadableRegistries().getLootTable(this.getContainerLootTable());
             if (player != null) {
                 CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getContainerLootTable());
             }
 
-            this.setContainerLootTable(null);
+            // Paper start - LootTable API
+            if (this.lootableData().shouldClearLootTable(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.ENTITY, player)) {
+                this.setContainerLootTable(null);
+            }
+            // Paper end - LootTable API
             LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position());
             if (player != null) {
                 builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
@@ -173,4 +_,14 @@
     default boolean isChestVehicleStillValid(Player player) {
         return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0);
     }
+
+    // Paper start - LootTable API
+    default com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() {
+        throw new UnsupportedOperationException("Implement this method");
+    }
+
+    default com.destroystokyo.paper.loottable.PaperLootableInventory getLootableInventory() {
+        return ((com.destroystokyo.paper.loottable.PaperLootableInventory) ((net.minecraft.world.entity.Entity) this).getBukkitEntity());
+    }
+    // Paper end - LootTable API
 }
