mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-16 18:46:12 +00:00
87 lines
4.2 KiB
Diff
87 lines
4.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Video <videogamesm12@gmail.com>
|
|
Date: Mon, 9 May 2022 23:40:59 -0500
|
|
Subject: [PATCH] Even more ResourceLocation validation and log spam fixes
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
index 7e1885d9cc568a544e934cede32bff05c20b567a..2481c50d8eb58a003e30e2d957b877bce5123a3a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
@@ -420,7 +420,7 @@ public class AreaEffectCloud extends Entity {
|
|
try {
|
|
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle"))));
|
|
} catch (CommandSyntaxException commandsyntaxexception) {
|
|
- AreaEffectCloud.LOGGER.warn("Couldn't load custom particle {}", nbt.getString("Particle"), commandsyntaxexception);
|
|
+ // Scissors - Don't log custom particle errors
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
index e49eece9bff3a53469673d03a7bbf8f9cf8776b8..a49f32e9649155b6af4b1f236e4e8142d730e7e8 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
@@ -30,8 +30,14 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
|
return null;
|
|
}
|
|
|
|
- ResourceLocation key = getSnapshot().lootTable;
|
|
- return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
+ try {
|
|
+ ResourceLocation key = getSnapshot().lootTable;
|
|
+ return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf11cf046fb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
@@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
|
return null; // return empty loot table?
|
|
}
|
|
|
|
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
- return Bukkit.getLootTable(key);
|
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
+ try {
|
|
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
+ return Bukkit.getLootTable(key);
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
index d775e19402188e35f79affb4ed636b6533f90ab5..29f5ab80ffbc421da911046678427755c6156894 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
@@ -63,8 +63,18 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
|
|
|
@Override
|
|
public LootTable getLootTable() {
|
|
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
- return Bukkit.getLootTable(key);
|
|
+ if (this.getHandle().lootTable == null) {
|
|
+ this.getHandle().lootTable = this.getHandle().getDefaultLootTable();
|
|
+ }
|
|
+
|
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
+ try {
|
|
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
+ return Bukkit.getLootTable(key);
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
}
|
|
|
|
@Override
|