mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-10-31 20:27:10 +00:00
Fixes Knowledge Books causing log spam when invalid data is provided
the game of whack-a-mole continues
This commit is contained in:
parent
ac6b6f77ee
commit
61cce5a83c
@ -0,0 +1,38 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Sun, 13 Mar 2022 18:42:07 -0600
|
||||||
|
Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
||||||
|
provided
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
index bb5319afd112f1013445e29e9fcad137d4c581f9..13f6cd57c3dc39cfd58b2a58aec8a1f08fad5d4a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
@@ -55,7 +55,7 @@ public class KnowledgeBookItem extends Item {
|
||||||
|
|
||||||
|
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
||||||
|
} else {
|
||||||
|
- LOGGER.error("Tag not valid: {}", (Object)compoundTag);
|
||||||
|
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
|
||||||
|
return InteractionResultHolder.fail(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
index e816e505cd292d6c5138dff0aeae0e9592c09de0..0f6438dfe0a6620eb87233b9eefbe2340dfc347b 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
@@ -42,7 +42,12 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
||||||
|
for (int i = 0; i < pages.size(); i++) {
|
||||||
|
String recipe = pages.getString(i);
|
||||||
|
|
||||||
|
- this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||||
|
+ // Scissors start - Don't add recipes with invalid namespaces
|
||||||
|
+ try {
|
||||||
|
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||||
|
+ } catch (Exception ignored) {
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user