mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-27 07:05:39 +00:00
41 lines
2.1 KiB
Diff
41 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
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<LootTable> 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<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 {
|
|
}
|
|
|
|
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
|
|
+ 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<LootTable> minecraft) {
|