From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 14 Jun 2024 17:48:49 -0500 Subject: [PATCH] ResourceLocation validation diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index 8b612b772ca87c852d0b108c2afd6785c261c9b9..e063562fdbe05882c4a81f9fb15141056c35ed8b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -678,7 +678,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @Override public final ResourceKey getLootTable() { - return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable; + try { + return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable; + } catch (Exception ex) { + return this.getDefaultLootTable(); + } } protected ResourceKey getDefaultLootTable() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java index 1f90f4b3f310b8cf5750c3a581be178f19b979d2..0c6aad363f99bd86393335b9df1e186a3198274f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -38,7 +38,11 @@ public class CraftLootTable implements org.bukkit.loot.LootTable { } public static org.bukkit.loot.LootTable minecraftToBukkit(ResourceKey minecraft) { - return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing + try { + return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing + } catch (Exception ex) { + return null; + } } public static NamespacedKey minecraftToBukkitKey(ResourceKey minecraft) {