diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/BlockSettings.java b/core/src/main/java/net/momirealms/craftengine/core/block/BlockSettings.java index 35b55839f..cfcfd042c 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/BlockSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/BlockSettings.java @@ -55,7 +55,7 @@ public class BlockSettings { if (factory != null) { factory.createModifier(entry.getValue()).apply(settings); } else { - throw new LocalizedResourceConfigException("warning.config.block.settings.unknown", new IllegalArgumentException("Unknown block settings key: " + entry.getKey()), entry.getKey()); + throw new LocalizedResourceConfigException("warning.config.block.settings.unknown", entry.getKey()); } } return settings; diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java b/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java index c220ec974..445961eb5 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/behavior/BlockBehaviors.java @@ -27,12 +27,12 @@ public class BlockBehaviors { if (map == null) return EmptyBlockBehavior.INSTANCE; Object type = map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.missing_type", new NullPointerException("behavior type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.block.behavior.missing_type"); } Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); BlockBehaviorFactory factory = BuiltInRegistries.BLOCK_BEHAVIOR_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", new IllegalArgumentException("Unknown block behavior type: " + type), type.toString()); + throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", type.toString()); } return factory.create(block, map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java b/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java index aabc93436..8659819b7 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/properties/Properties.java @@ -37,12 +37,12 @@ public class Properties { public static Property fromMap(String name, Map map) { Object type = map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.property.missing_type", new NullPointerException("'type' cannot be null for block state property"), name); + throw new LocalizedResourceConfigException("warning.config.block.state.property.missing_type", name); } Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); PropertyFactory factory = BuiltInRegistries.PROPERTY_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.block.state.property.invalid_type", new IllegalArgumentException("Unknown property type: " + type), key.toString(), name); + throw new LocalizedResourceConfigException("warning.config.block.state.property.invalid_type", key.toString(), name); } return factory.create(name, map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureSettings.java b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureSettings.java index 361fc71f8..298dbc877 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/FurnitureSettings.java @@ -39,7 +39,7 @@ public class FurnitureSettings { if (factory != null) { factory.createModifier(entry.getValue()).apply(settings); } else { - throw new LocalizedResourceConfigException("warning.config.furniture.settings.unknown", new RuntimeException("Unknown furniture settings: " + entry.getKey()), entry.getKey()); + throw new LocalizedResourceConfigException("warning.config.furniture.settings.unknown", entry.getKey()); } } return settings; diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/HitBoxTypes.java b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/HitBoxTypes.java index 3987da6d6..05b03bebb 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/HitBoxTypes.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/furniture/HitBoxTypes.java @@ -27,7 +27,7 @@ public class HitBoxTypes { Key type = Optional.ofNullable((String) arguments.get("type")).map(Key::of).orElse(HitBoxTypes.INTERACTION); HitBoxFactory factory = BuiltInRegistries.HITBOX_FACTORY.getValue(type); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.furniture.hitbox.invalid_type", new IllegalArgumentException("Unknown hitbox type: " + type), type.toString()); + throw new LocalizedResourceConfigException("warning.config.furniture.hitbox.invalid_type", type.toString()); } return factory.create(arguments); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java index e3e6133ba..59d8a06a4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java @@ -59,7 +59,7 @@ public class ItemSettings { if (factory != null) { factory.createModifier(entry.getValue()).apply(settings); } else { - throw new LocalizedResourceConfigException("warning.config.item.settings.unknown", new IllegalArgumentException("Unknown item settings key: " + entry.getKey()), entry.getKey()); + throw new LocalizedResourceConfigException("warning.config.item.settings.unknown", entry.getKey()); } } return settings; diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java b/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java index f092787cd..0c02d14c9 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/behavior/ItemBehaviors.java @@ -24,12 +24,12 @@ public class ItemBehaviors { public static ItemBehavior fromMap(Pack pack, Path path, Key id, Map map) { Object type = map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.missing_type", new NullPointerException("behavior type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.behavior.missing_type"); } Key key = Key.withDefaultNamespace(type.toString(), "craftengine"); ItemBehaviorFactory factory = BuiltInRegistries.ITEM_BEHAVIOR_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.behavior.invalid_type", new IllegalArgumentException("Unknown behavior type: " + type), type.toString()); + throw new LocalizedResourceConfigException("warning.config.item.behavior.invalid_type", type.toString()); } return factory.create(pack, path, id, map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java index 1036a197e..6b1d5f017 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/AbstractRecipeFactory.java @@ -26,7 +26,7 @@ public abstract class AbstractRecipeFactory implements RecipeFactory { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } } return holders; @@ -38,7 +38,7 @@ public abstract class AbstractRecipeFactory implements RecipeFactory { ingredient = arguments.get("ingredients"); } if (ingredient == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.missing_ingredient", new NullPointerException("'ingredient' should not be null")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_ingredient"); } return ingredient; } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java index bb96d8c9c..de8f7e4f0 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapedRecipe.java @@ -141,10 +141,10 @@ public class CustomShapedRecipe extends CustomCraftingTableRecipe { public Recipe create(Key id, Map arguments) { List pattern = MiscUtils.getAsStringList(arguments.get("pattern")); if (pattern.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.recipe.shaped.missing_pattern", new NullPointerException("'pattern' cannot be empty")); + throw new LocalizedResourceConfigException("warning.config.recipe.shaped.missing_pattern"); } if (!validatePattern(pattern)) { - throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_pattern", new IllegalArgumentException("Invalid pattern: " + pattern), pattern.toString()); + throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_pattern", pattern.toString()); } Object ingredientObj = getIngredientOrThrow(arguments); String group = arguments.containsKey("group") ? arguments.get("group").toString() : null; @@ -152,7 +152,7 @@ public class CustomShapedRecipe extends CustomCraftingTableRecipe { for (Map.Entry entry : MiscUtils.castToMap(ingredientObj, false).entrySet()) { String key = entry.getKey(); if (key.length() != 1) { - throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_symbol", new IllegalArgumentException("Invalid symbol: " + key), key); + throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_symbol", key); } char ch = key.charAt(0); List items = MiscUtils.getAsStringList(entry.getValue()); @@ -162,7 +162,7 @@ public class CustomShapedRecipe extends CustomCraftingTableRecipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } } ingredients.put(ch, Ingredient.of(holders)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapelessRecipe.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapelessRecipe.java index 152199a8a..2f71fd2d4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapelessRecipe.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomShapelessRecipe.java @@ -70,7 +70,7 @@ public class CustomShapelessRecipe extends CustomCraftingTableRecipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } } ingredients.add(Ingredient.of(holders)); @@ -84,7 +84,7 @@ public class CustomShapelessRecipe extends CustomCraftingTableRecipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } } ingredients.add(Ingredient.of(holders)); @@ -95,7 +95,7 @@ public class CustomShapelessRecipe extends CustomCraftingTableRecipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } ingredients.add(Ingredient.of(holders)); } @@ -107,7 +107,7 @@ public class CustomShapelessRecipe extends CustomCraftingTableRecipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } ingredients.add(Ingredient.of(holders)); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java index 892ebd919..1742fcc19 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/CustomSmithingTransformRecipe.java @@ -151,7 +151,7 @@ public class CustomSmithingTransformRecipe implements Recipe { holders.addAll(CraftEngine.instance().itemManager().tagToItems(Key.of(item.substring(1)))); } else { holders.add(BuiltInRegistries.OPTIMIZED_ITEM_ID.get(Key.of(item)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Invalid vanilla/custom item: " + item), item))); + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", item))); } } return holders.isEmpty() ? null : Ingredient.of(holders); @@ -182,12 +182,12 @@ public class CustomSmithingTransformRecipe implements Recipe { public static ItemDataProcessor fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.missing_type", new NullPointerException("Missing required parameter 'type' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); ItemDataProcessor.Factory factory = BuiltInRegistries.SMITHING_RESULT_PROCESSOR_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.invalid_type", new IllegalArgumentException("Unknown processor type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.invalid_type", type); } return factory.create(map); } @@ -237,7 +237,7 @@ public class CustomSmithingTransformRecipe implements Recipe { public ItemDataProcessor create(Map arguments) { Object componentsObj = arguments.get("components"); if (componentsObj == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_components", new NullPointerException("Missing required parameter 'components' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_components"); } List components = MiscUtils.getAsStringList(componentsObj); return new KeepComponents(components.stream().map(Key::of).toList()); @@ -274,7 +274,7 @@ public class CustomSmithingTransformRecipe implements Recipe { public ItemDataProcessor create(Map arguments) { Object tagsObj = arguments.get("tags"); if (tagsObj == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags", new NullPointerException("Missing required parameter 'tags' for post processor")); + throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags"); } List tags = MiscUtils.getAsStringList(tagsObj); return new KeepTags(tags.stream().map(it -> it.split("\\.")).toList()); diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java index c42a28520..744b10971 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeFactory.java @@ -16,16 +16,16 @@ public interface RecipeFactory { default CustomRecipeResult parseResult(Map arguments) { Map resultMap = MiscUtils.castToMap(arguments.get("result"), true); if (resultMap == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.missing_result", new IllegalArgumentException("result cannot be empty for recipe")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_result"); } String id = (String) resultMap.get("id"); if (id == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.result.missing_id", new IllegalArgumentException("id cannot be empty for result")); + throw new LocalizedResourceConfigException("warning.config.recipe.result.missing_id"); } int count = ResourceConfigUtils.getAsInt(resultMap.getOrDefault("count", 1), "count"); return new CustomRecipeResult( CraftEngine.instance().itemManager().getBuildableItem(Key.of(id)).orElseThrow( - () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", new IllegalArgumentException("Unknown recipe result item id: " + id), id)), + () -> new LocalizedResourceConfigException("warning.config.recipe.invalid_item", id)), count ); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java index 5a6cd0255..6b29dc7e2 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/recipe/RecipeTypes.java @@ -42,12 +42,12 @@ public class RecipeTypes { public static Recipe fromMap(Key id, Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.missing_type", new NullPointerException("'type' cannot be null for recipe")); + throw new LocalizedResourceConfigException("warning.config.recipe.missing_type"); } Key key = Key.withDefaultNamespace(type, "minecraft"); RecipeFactory factory = (RecipeFactory) BuiltInRegistries.RECIPE_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.recipe.invalid_type", new IllegalArgumentException("Unknown recipe type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.recipe.invalid_type", type); } return factory.create(id, map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java b/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java index 9f98469cd..9fc0a76a9 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/LootTable.java @@ -56,15 +56,15 @@ public class LootTable { NumberProvider bonus_rolls = NumberProviders.fromObject(pool.getOrDefault("bonus_rolls", 0)); List conditions = Optional.ofNullable(pool.get("conditions")) .map(it -> LootConditions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_conditions_type", new RuntimeException("'conditions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_conditions_type", it.getClass().getSimpleName())))) .orElse(Lists.newArrayList()); List> containers = Optional.ofNullable(pool.get("entries")) .map(it -> (List>) new ArrayList>(LootEntryContainers.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_entries_type", new RuntimeException("'entries' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_entries_type", it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()); List> functions = Optional.ofNullable(pool.get("functions")) .map(it -> (List>) new ArrayList>(LootFunctions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()); lootPools.add(new LootPool<>(containers, conditions, functions, rolls, bonus_rolls)); } else if (rawPool instanceof String string) { @@ -76,7 +76,7 @@ public class LootTable { return new LootTable<>(lootPools, Optional.ofNullable(map.get("functions")) .map(it -> (List>) new ArrayList>(LootFunctions.fromMapList(castToMapListOrThrow(it, - () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))) + () -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", it.getClass().getSimpleName()))))) .orElse(Lists.newArrayList()) ); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java index 6c8b80008..fd8f55e2b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/condition/LootConditions.java @@ -90,12 +90,12 @@ public class LootConditions { public static LootCondition fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.condition.missing_type", new NullPointerException("condition type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.condition.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootConditionFactory factory = BuiltInRegistries.LOOT_CONDITION_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.condition.invalid_type", new IllegalArgumentException("Unknown loot condition type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.loot_table.condition.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java index 737a65aef..ff4d74262 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/ExpLootEntryContainer.java @@ -46,7 +46,7 @@ public class ExpLootEntryContainer extends AbstractLootEntryContainer { public LootEntryContainer create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.missing_count", new IllegalArgumentException("'count' is required for exp entry")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.missing_count"); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java index 63f7258c7..b4f7dbcd6 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/LootEntryContainers.java @@ -42,12 +42,12 @@ public class LootEntryContainers { public static LootEntryContainer fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.missing_type", new NullPointerException("loot entry type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootEntryContainerFactory factory = (LootEntryContainerFactory) BuiltInRegistries.LOOT_ENTRY_CONTAINER_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.invalid_type", new IllegalArgumentException("Unknown loot entry type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java index bf4e16afa..161d0e04e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/entry/SingleItemLootEntryContainer.java @@ -45,7 +45,7 @@ public class SingleItemLootEntryContainer extends AbstractSingleLootEntryCont public LootEntryContainer create(Map arguments) { Object itemObj = arguments.get("item"); if (itemObj == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.missing_item", new IllegalArgumentException("'item' is required for item entry")); + throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.missing_item"); } Key item = Key.from(itemObj.toString()); int weight = (int) arguments.getOrDefault("weight", 1); diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java index 28c57055a..319e09a00 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/ApplyBonusCountFunction.java @@ -51,11 +51,11 @@ public class ApplyBonusCountFunction extends AbstractLootConditionalFunction< public LootFunction create(Map arguments) { String enchantment = (String) arguments.get("enchantment"); if (enchantment == null || enchantment.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_enchantment", new IllegalArgumentException("'enchantment' is required for apply_bonus function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_enchantment"); } Map formulaMap = MiscUtils.castToMap(arguments.get("formula"), true); if (formulaMap == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_formula", new IllegalArgumentException("formula is required")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_formula"); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java index 46504bff4..439d30649 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/DropExpFunction.java @@ -42,7 +42,7 @@ public class DropExpFunction extends AbstractLootConditionalFunction { public LootFunction create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.missing_count", new IllegalArgumentException("'count' is required for drop_exp function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.missing_count"); } List conditions = Optional.ofNullable(arguments.get("conditions")) .map(it -> LootConditions.fromMapList((List>) it)) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java index b40d1b590..02ae938a4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/LootFunctions.java @@ -70,12 +70,12 @@ public class LootFunctions { public static LootFunction fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.missing_type", new NullPointerException("function type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); LootFunctionFactory factory = (LootFunctionFactory) BuiltInRegistries.LOOT_FUNCTION_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.invalid_type", new IllegalArgumentException("Unknown function type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java b/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java index 2f5d5d3e1..4e3fab7bd 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/function/SetCountFunction.java @@ -44,7 +44,7 @@ public class SetCountFunction extends AbstractLootConditionalFunction { public LootFunction create(Map arguments) { Object value = arguments.get("count"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.missing_count", new IllegalArgumentException("'count' is required for set_count function")); + throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.missing_count"); } boolean add = (boolean) arguments.getOrDefault("add", false); List conditions = Optional.ofNullable(arguments.get("conditions")) diff --git a/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java b/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java index b56361b00..693d598b9 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java +++ b/core/src/main/java/net/momirealms/craftengine/core/loot/number/NumberProviders.java @@ -39,12 +39,12 @@ public class NumberProviders { public static NumberProvider fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.number.missing_type", new NullPointerException("number type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.loot_table.number.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); NumberProviderFactory factory = BuiltInRegistries.NUMBER_PROVIDER_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.loot_table.number.invalid_type", new IllegalArgumentException("Unknown number type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.loot_table.number.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AllOfPathMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AllOfPathMatcher.java index 58cfdac77..bb476f97a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AllOfPathMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AllOfPathMatcher.java @@ -44,7 +44,7 @@ public class AllOfPathMatcher implements PathMatcher { Map terms = MiscUtils.castToMap(termsObj, false); return new AllOfPathMatcher(PathMatchers.fromMapList(List.of(terms))); } else { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.all_of.missing_terms", new NullPointerException("terms should not be null for all_of")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.all_of.missing_terms"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AnyOfPathMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AnyOfPathMatcher.java index 9cd787390..6b15f9764 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AnyOfPathMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/AnyOfPathMatcher.java @@ -44,7 +44,7 @@ public class AnyOfPathMatcher implements PathMatcher { Map terms = MiscUtils.castToMap(termsObj, false); return new AnyOfPathMatcher(PathMatchers.fromMapList(List.of(terms))); } else { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.any_of.missing_terms", new NullPointerException("terms should not be null for any_of")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.any_of.missing_terms"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java index 5e833b6a4..efc39ea59 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ExactPathMatcher.java @@ -31,7 +31,7 @@ public class ExactPathMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.missing_path", new IllegalArgumentException("The 'path' argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.missing_path"); } return new ExactPathMatcher(path.toString()); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java index d43c76820..193c30b27 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/FilenameMatcher.java @@ -31,7 +31,7 @@ public class FilenameMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object name = arguments.get("name"); if (name == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.missing_name", new IllegalArgumentException("The 'name' argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.missing_name"); } return new FilenameMatcher(name.toString()); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/InvertedPathMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/InvertedPathMatcher.java index 89a4691d3..8a6b731c6 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/InvertedPathMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/InvertedPathMatcher.java @@ -31,7 +31,7 @@ public class InvertedPathMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object inverted = arguments.get("term"); if (inverted == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.inverted.missing_term", new NullPointerException("term should not be null for inverted")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.inverted.missing_term"); } Map term = MiscUtils.castToMap(inverted, false); return new InvertedPathMatcher(PathMatchers.fromMap(term)); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java index 79aace065..4d4678900 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/ParentPathPrefixMatcher.java @@ -33,7 +33,7 @@ public class ParentPathPrefixMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object prefix = arguments.get("prefix"); if (prefix == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_prefix.missing_prefix", new IllegalArgumentException("The prefix argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_prefix.missing_prefix"); } return new ParentPathPrefixMatcher(prefix.toString()); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java index 28dbc39c1..8ead5c22d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathContainsMatcher.java @@ -31,7 +31,7 @@ public class PathContainsMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.missing_path", new NullPointerException("path should not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.missing_path"); } return new PathContainsMatcher(path.toString()); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java index eef970569..fb2353e50 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathMatchers.java @@ -51,12 +51,12 @@ public class PathMatchers { public static PathMatcher fromMap(Map map) { String type = (String) map.getOrDefault("type", "empty"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.missing_type", new NullPointerException("path matcher type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.missing_type"); } Key key = Key.withDefaultNamespace(type, "craftengine"); PathMatcherFactory factory = BuiltInRegistries.PATH_MATCHER_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.invalid_type", new IllegalArgumentException("Unknown matcher type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java index 8cac9a51d..78a5860ab 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/conflict/matcher/PathPatternMatcher.java @@ -31,7 +31,7 @@ public class PathPatternMatcher implements PathMatcher { public PathMatcher create(Map arguments) { Object pattern = arguments.get("pattern"); if (pattern == null) { - throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.missing_pattern", new IllegalArgumentException("The pattern argument must not be null")); + throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.missing_pattern"); } return new PathPatternMatcher(pattern.toString()); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java index 564051d97..ab7a54bcc 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/BaseItemModel.java @@ -71,11 +71,11 @@ public class BaseItemModel implements ItemModel { public ItemModel create(Map arguments) { Object path = arguments.get("path"); if (path == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.base.missing_path", new NullPointerException("'path' is required for 'minecraft:model'")); + throw new LocalizedResourceConfigException("warning.config.item.model.base.missing_path"); } String modelPath = path.toString(); if (!ResourceLocation.isValid(modelPath)) { - throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_path", new IllegalArgumentException("Invalid resource location: " + modelPath), modelPath); + throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_path", modelPath); } Map generation = MiscUtils.castToMap(arguments.get("generation"), true); ModelGeneration modelGeneration = null; diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java index 01aaaac98..7d9d97af0 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/CompositeItemModel.java @@ -58,7 +58,7 @@ public class CompositeItemModel implements ItemModel { if (m instanceof List list) { List> models = (List>) list; if (models.isEmpty()) { - throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new IllegalArgumentException("'models' list should not be empty for 'minecraft:composite'")); + throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models"); } List modelList = new ArrayList<>(); for (Map model : models) { @@ -68,7 +68,7 @@ public class CompositeItemModel implements ItemModel { } else if (m instanceof Map map) { return new CompositeItemModel(List.of(ItemModels.fromMap(MiscUtils.castToMap(map, false)))); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new NullPointerException("'models' argument is required for 'minecraft:composite'")); + throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java index 78687b662..cb51e65a8 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ConditionItemModel.java @@ -68,13 +68,13 @@ public class ConditionItemModel implements ItemModel { if (arguments.get("on-true") instanceof Map map1) { onTrue = ItemModels.fromMap(MiscUtils.castToMap(map1, false)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_true", new NullPointerException("'on-true' is required for condition")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_true"); } ItemModel onFalse; if (arguments.get("on-false") instanceof Map map2) { onFalse = ItemModels.fromMap(MiscUtils.castToMap(map2, false)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_false", new NullPointerException("'on-false' is required for condition")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_false"); } return new ConditionItemModel(property, onTrue, onFalse); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ItemModels.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ItemModels.java index 70c199496..fb2938a14 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/ItemModels.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/ItemModels.java @@ -40,7 +40,7 @@ public class ItemModels { Key key = Key.withDefaultNamespace(type, "minecraft"); ItemModelFactory factory = BuiltInRegistries.ITEM_MODEL_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.invalid_type", new IllegalArgumentException("Unknown model type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java index c54eb597c..90372bd90 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/RangeDispatchItemModel.java @@ -109,16 +109,16 @@ public class RangeDispatchItemModel implements ItemModel { float threshold = ResourceConfigUtils.getAsFloat(entry.getOrDefault("threshold", 1), "threshold"); Object model = entry.getOrDefault("model", fallback); if (model == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.missing_model", new NullPointerException("'model' is required for range_dispatch entry")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.missing_model"); } entryMap.put(threshold, ItemModels.fromMap(MiscUtils.castToMap(model, false))); } return new RangeDispatchItemModel(property, scale, fallback == null ? null : ItemModels.fromMap(fallback), entryMap); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new IllegalArgumentException("No entries found for range_dispatch")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries"); } } else { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new NullPointerException("'entries' is required for the range_dispatch model")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java index d628d71e2..24ac80089 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/SelectItemModel.java @@ -106,7 +106,7 @@ public class SelectItemModel implements ItemModel { for (Map c : cases) { Object when = c.get("when"); if (when == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_when", new NullPointerException("'when' should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_when"); } Either> either; if (when instanceof List whenList) { @@ -120,16 +120,16 @@ public class SelectItemModel implements ItemModel { } Object model = c.get("model"); if (model == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_model", new NullPointerException("'model' should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_model"); } whenMap.put(either, ItemModels.fromMap(MiscUtils.castToMap(model, false))); } return new SelectItemModel(property, whenMap, fallback == null ? null : ItemModels.fromMap(fallback)); } else { - throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases"); } } else { - throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases"); } } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java index f6033df00..9419c204b 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/ConditionProperties.java @@ -48,12 +48,12 @@ public class ConditionProperties { public static ConditionProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_property"); } Key key = Key.withDefaultNamespace(type, "minecraft"); ConditionPropertyFactory factory = BuiltInRegistries.CONDITION_PROPERTY_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.invalid_property", new IllegalArgumentException("Unknown property type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.invalid_property", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java index 439be322b..028a14a0a 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/HasComponentConditionProperty.java @@ -38,7 +38,7 @@ public class HasComponentConditionProperty implements ConditionProperty { boolean ignoreDefault = (boolean) arguments.getOrDefault("ignore-default", false); Object componentObj = arguments.get("component"); if (componentObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.missing_component", new NullPointerException("component should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.missing_component"); } String component = componentObj.toString(); return new HasComponentConditionProperty(component, ignoreDefault); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java index 8599fbe5e..5e2b678d3 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/condition/KeyBindDownConditionProperty.java @@ -32,7 +32,7 @@ public class KeyBindDownConditionProperty implements ConditionProperty { public ConditionProperty create(Map arguments) { Object keybindObj = arguments.get("keybind"); if (keybindObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind.missing", new NullPointerException("keybind should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind.missing"); } String keybind = keybindObj.toString(); return new KeyBindDownConditionProperty(keybind); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java index e95462336..086d8c6d5 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/generation/ModelGeneration.java @@ -25,7 +25,7 @@ public class ModelGeneration { this.path = path; Object parent = map.get("parent"); if (parent == null) { - throw new LocalizedResourceConfigException("warning.config.model.generation.missing_parent", new NullPointerException("'parent' argument is required for generation")); + throw new LocalizedResourceConfigException("warning.config.model.generation.missing_parent"); } this.parentModelPath = parent.toString(); Map texturesMap = MiscUtils.castToMap(map.get("textures"), true); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java index d55586a7c..48fbfefd4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/CompassRangeDispatchProperty.java @@ -32,7 +32,7 @@ public class CompassRangeDispatchProperty implements RangeDispatchProperty { public RangeDispatchProperty create(Map arguments) { Object targetObj = arguments.get("target"); if (targetObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.missing_target", new NullPointerException("target should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.missing_target"); } String target = targetObj.toString(); return new CompassRangeDispatchProperty(target); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java index 3e8021d8b..edaeb7190 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/RangeDispatchProperties.java @@ -44,12 +44,12 @@ public class RangeDispatchProperties { public static RangeDispatchProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_property"); } Key key = Key.withDefaultNamespace(type, "minecraft"); RangeDispatchPropertyFactory factory = BuiltInRegistries.RANGE_DISPATCH_PROPERTY_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.invalid_property", new IllegalArgumentException("Unknown property type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.invalid_property", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java index bc4ea4c22..9e8d9da05 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/rangedisptach/TimeRangeDispatchProperty.java @@ -37,7 +37,7 @@ public class TimeRangeDispatchProperty implements RangeDispatchProperty { public RangeDispatchProperty create(Map arguments) { Object sourceObj = arguments.get("source"); if (sourceObj == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.missing_source", new NullPointerException("source should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.missing_source"); } String source = sourceObj.toString(); boolean wobble = (boolean) arguments.getOrDefault("wobble", true); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java index 127d6ae4d..0e0944c97 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/BlockStateSelectProperty.java @@ -32,7 +32,7 @@ public class BlockStateSelectProperty implements SelectProperty { public SelectProperty create(Map arguments) { Object property = arguments.get("block-state-property"); if (property == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.missing_property", new NullPointerException("block-state-property should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.missing_property"); } String blockStateProperty = property.toString(); return new BlockStateSelectProperty(blockStateProperty); diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java index 55f145e97..dad39c385 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/select/SelectProperties.java @@ -42,12 +42,12 @@ public class SelectProperties { public static SelectProperty fromMap(Map map) { String type = (String) map.get("property"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_property", new NullPointerException("property type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_property"); } Key key = Key.withDefaultNamespace(type, "minecraft"); SelectPropertyFactory factory = BuiltInRegistries.SELECT_PROPERTY_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.select.invalid_property", new IllegalArgumentException("Unknown property type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.select.invalid_property", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java index ceb361452..42b85e940 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/special/SpecialModels.java @@ -45,12 +45,12 @@ public class SpecialModels { public static SpecialModel fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.special.missing_type", new NullPointerException("special model type cannot be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.special.missing_type"); } Key key = Key.withDefaultNamespace(type, "minecraft"); SpecialModelFactory factory = BuiltInRegistries.SPECIAL_MODEL_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.special.invalid_type", new IllegalArgumentException("Unknown special model type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.special.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java index 6b4978557..525c02668 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/ConstantTint.java @@ -35,7 +35,7 @@ public class ConstantTint implements Tint { public Tint create(Map arguments) { Object value = arguments.get("value"); if (value == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.missing_value", new NullPointerException("value should not be null")); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.missing_value"); } return new ConstantTint(parseTintValue(value)); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java index 17c2e6163..e20a2d6fd 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/GrassTint.java @@ -39,10 +39,10 @@ public class GrassTint implements Tint { float temperature = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("temperature", 0), "temperature"); float downfall = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("downfall", 0), "downfall"); if (temperature > 1 || temperature < 0) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temp", new IllegalArgumentException("Invalid temperature: " + temperature + ". Valid range 0~1"), String.valueOf(temperature)); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temp", String.valueOf(temperature)); } if (downfall > 1 || downfall < 0) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_downfall", new IllegalArgumentException("Invalid downfall: " + downfall + ". Valid range 0~1"), String.valueOf(downfall)); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_downfall", String.valueOf(downfall)); } return new GrassTint(temperature, downfall); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/TintFactory.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/TintFactory.java index 324fce58d..ee595ad49 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/TintFactory.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/TintFactory.java @@ -32,6 +32,6 @@ public interface TintFactory { return Either.ofFallback(intList); } } - throw new LocalizedResourceConfigException("warning.config.item.model.tint.invalid_value", new IllegalArgumentException("Invalid tint value: " + value), value.toString()); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.invalid_value", value.toString()); } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java index d6e701427..c0f2baf3e 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/tint/Tints.java @@ -40,12 +40,12 @@ public class Tints { public static Tint fromMap(Map map) { String type = (String) map.get("type"); if (type == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.missing_type", new NullPointerException("'type' cannot be null for tint")); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.missing_type"); } Key key = Key.withDefaultNamespace(type, "minecraft"); TintFactory factory = BuiltInRegistries.TINT_FACTORY.getValue(key); if (factory == null) { - throw new LocalizedResourceConfigException("warning.config.item.model.tint.invalid_type", new IllegalArgumentException("Unknown tint type: " + type), type); + throw new LocalizedResourceConfigException("warning.config.item.model.tint.invalid_type", type); } return factory.create(map); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java b/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java index f7a0d723e..ec16fd8dc 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java +++ b/core/src/main/java/net/momirealms/craftengine/core/sound/Sound.java @@ -53,7 +53,7 @@ public interface Sound extends Supplier { public static SoundFile fromMap(Map map) { Object name = map.get("name"); - if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.missing_name", new NullPointerException("Missing required property 'name'")); + if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.missing_name"); Builder builder = file(name.toString()); for (Map.Entry entry : map.entrySet()) { Optional.ofNullable(Builder.MODIFIERS.get(entry.getKey())).ifPresent(modifier -> modifier.apply(builder, entry.getValue())); diff --git a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java index 659cab125..e8159bef3 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java +++ b/core/src/main/java/net/momirealms/craftengine/core/util/MiscUtils.java @@ -59,7 +59,7 @@ public class MiscUtils { } else if (split.length == 1) { return new Vector3f(Float.parseFloat(split[0])); } else { - throw new LocalizedResourceConfigException("warning.config.type.vector3f", new RuntimeException("Cannot convert " + o + " to Vector3f"), stringFormat, option); + throw new LocalizedResourceConfigException("warning.config.type.vector3f", stringFormat, option); } } @@ -72,7 +72,7 @@ public class MiscUtils { } else if (split.length == 1) { return QuaternionUtils.toQuaternionf(0, Math.toRadians(Float.parseFloat(split[0])), 0); } else { - throw new LocalizedResourceConfigException("warning.config.type.quaternionf", new RuntimeException("Cannot convert " + o + " to Quaternionf"), stringFormat, option); + throw new LocalizedResourceConfigException("warning.config.type.quaternionf", stringFormat, option); } } }