Scissors/patches/server/0003-ResourceLocation-validation.patch

41 lines
2.1 KiB
Diff
Raw Permalink Normal View History

2024-05-05 17:47:44 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
2024-06-14 23:02:52 +00:00
Date: Fri, 14 Jun 2024 17:48:49 -0500
2024-05-05 17:47:44 +00:00
Subject: [PATCH] ResourceLocation validation
2024-06-14 23:02:52 +00:00
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
2024-05-05 17:47:44 +00:00
@Override
2024-06-14 23:02:52 +00:00
public final ResourceKey<LootTable> getLootTable() {
- return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable;
2024-05-05 17:47:44 +00:00
+ try {
2024-06-14 23:02:52 +00:00
+ return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable;
2024-05-05 17:47:44 +00:00
+ } catch (Exception ex) {
2024-06-14 23:02:52 +00:00
+ return this.getDefaultLootTable();
2024-05-05 17:47:44 +00:00
+ }
}
2024-06-14 23:02:52 +00:00
protected ResourceKey<LootTable> 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 {
2024-05-05 17:47:44 +00:00
}
2024-06-14 23:02:52 +00:00
public static org.bukkit.loot.LootTable minecraftToBukkit(ResourceKey<LootTable> minecraft) {
- return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing
2024-05-05 17:47:44 +00:00
+ try {
2024-06-14 23:02:52 +00:00
+ return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing
+ } catch (Exception ex) {
2024-05-05 17:47:44 +00:00
+ return null;
+ }
}
2024-06-14 23:02:52 +00:00
public static NamespacedKey minecraftToBukkitKey(ResourceKey<LootTable> minecraft) {