mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-01 12:37:10 +00:00
87 lines
4.3 KiB
Diff
87 lines
4.3 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 fa724cd34a7c469ca12068e64295cd00ad215a3c..168b60fda38a7172f4473017ccc42447b36faab2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
@@ -425,7 +425,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
|
try {
|
|
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup()));
|
|
} 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 620d918e302a00d5a6640648e3096988d15535a0..ac6831248b7c4f25d48391432afb613f25d7e23a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
@@ -80,8 +80,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
|