Scissors/patches/server/0005-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch
2024-06-14 18:02:52 -05:00

29 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Sun, 5 May 2024 12:32:55 -0500
Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
with content in them
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
index 9549eee0d92f322bd5232abd7e695213660c2e22..94a689e1adf24f6385dc97eb5cc3790c8e14da97 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
@@ -142,8 +142,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
@Override
public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
// CraftBukkit end
- if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) {
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
+ if (!this.level().isClientSide && entity_removalreason.shouldDestroy())
+ {
+ // Scissors start - Ignore errors thrown when trying to remove Minecart entities with content in them
+ try {
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
+ } catch (Exception ignored)
+ {}
+ // Scissors end
}
super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause