diff --git a/.gitignore b/.gitignore index 625a6231d..931bf78fe 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,3 @@ libs # Files from Forge MDK forge*changelog.txt /runs/ -/src/generated/ diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d new file mode 100644 index 000000000..e0b17510c --- /dev/null +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -0,0 +1,4 @@ +// 1.21 2024-09-01T12:55:35.7666307 Loot Tables +422fa2b11748fc7edc4c172103423dff35d20964 data/irons_spellbooks/loot_table/blocks/deepslate_mithril_ore.json +b20768ceea204b8e455440cb543df7653bbee629 data/irons_spellbooks/loot_table/blocks/mithril_ore.json +9bf8698563fef54ae90f7fcde094ce570bf8be51 data/irons_spellbooks/loot_table/blocks/portal_frame.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e new file mode 100644 index 000000000..d11d66dba --- /dev/null +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -0,0 +1,25 @@ +// 1.21 2024-08-24T13:05:16.1358117 Recipes +5684a9bb618e3b2c2a96dbcb830c5df276de6a27 data/irons_spellbooks/advancement/recipes/misc/affinity_ring.json +e4a59ea817a6944398503bc85ca3f045e7042510 data/irons_spellbooks/advancement/recipes/misc/cast_time_ring.json +66ff6686b91a38a9d76a55ac2c0d8ac17148201a data/irons_spellbooks/advancement/recipes/misc/concentration_amulet.json +74f3d4be6bf01ca992dbb6af94ad8073c56d90cd data/irons_spellbooks/advancement/recipes/misc/conjurers_talisman.json +2715b2af42f4a270f034d28977428973938047c4 data/irons_spellbooks/advancement/recipes/misc/cooldown_ring.json +454247aef4d363bf3006ec54534b627932fd0e06 data/irons_spellbooks/advancement/recipes/misc/emerald_stoneplate_ring.json +6517fe83c969035db205d2220d5bb916091b2bf1 data/irons_spellbooks/advancement/recipes/misc/expulsion_ring.json +ca0f9e49a7e92e5d5c2106da7beb688c06344aaa data/irons_spellbooks/advancement/recipes/misc/fireward_ring.json +7c25811edb3e46566a77a21f9f074d1915dd265d data/irons_spellbooks/advancement/recipes/misc/frostward_ring.json +b6dc1d4fc843d0580e6693017255840bb93a1f4e data/irons_spellbooks/advancement/recipes/misc/heavy_chain_necklace.json +b34b879eead94f93ec2b567cac38ff833f1e05b8 data/irons_spellbooks/advancement/recipes/misc/poisonward_ring.json +a48ba2877f2d76701bd06d5fff991fef30055e20 data/irons_spellbooks/advancement/recipes/misc/visibility_ring.json +e6eed7cdd574ae03b22c38b260a3156a997b6f49 data/irons_spellbooks/recipe/affinity_ring.json +b2424464c03f168f4a0c1e3589f147b693fff82e data/irons_spellbooks/recipe/cast_time_ring.json +e42b780ef39e05ca81a43885dd3d68e3b94d8363 data/irons_spellbooks/recipe/concentration_amulet.json +acd871661e749420e6ad8db7ffe6315a5a13345f data/irons_spellbooks/recipe/conjurers_talisman.json +da2d38aeb93ade977877d0451f29a4da73b31fb7 data/irons_spellbooks/recipe/cooldown_ring.json +f23f7a747ba21edb4e2437792af8c8a8928f7797 data/irons_spellbooks/recipe/emerald_stoneplate_ring.json +4da2aae38686d8e7ebce0a39b63ef1a8485a50a1 data/irons_spellbooks/recipe/expulsion_ring.json +e143a96fd8f6c54e62335fbcca903ac0899e9da1 data/irons_spellbooks/recipe/fireward_ring.json +3d7d26afef5e1d698e86e21a831ebfc125eb134a data/irons_spellbooks/recipe/frostward_ring.json +05ba7370b042a82ccb17469ae94cb8f09b840ab5 data/irons_spellbooks/recipe/heavy_chain_necklace.json +2dccc4afa900be2abe389d208a30c907d03f0aa9 data/irons_spellbooks/recipe/poisonward_ring.json +586b89d52c7a15c985a4a86f5774bad648206143 data/irons_spellbooks/recipe/visibility_ring.json diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/affinity_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/affinity_ring.json new file mode 100644 index 000000000..d506eade1 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/affinity_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:affinity_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:affinity_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cast_time_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cast_time_ring.json new file mode 100644 index 000000000..07ec9e60a --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cast_time_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:cast_time_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:cast_time_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/concentration_amulet.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/concentration_amulet.json new file mode 100644 index 000000000..ca8ce1f6a --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/concentration_amulet.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:concentration_amulet" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:concentration_amulet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/conjurers_talisman.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/conjurers_talisman.json new file mode 100644 index 000000000..9fd585be4 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/conjurers_talisman.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:conjurers_talisman" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:conjurers_talisman" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cooldown_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cooldown_ring.json new file mode 100644 index 000000000..3118f21c8 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/cooldown_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:cooldown_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:cooldown_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/emerald_stoneplate_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/emerald_stoneplate_ring.json new file mode 100644 index 000000000..732132aaa --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/emerald_stoneplate_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:emerald_stoneplate_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:emerald_stoneplate_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/expulsion_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/expulsion_ring.json new file mode 100644 index 000000000..51c3a1380 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/expulsion_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:expulsion_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:expulsion_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/fireward_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/fireward_ring.json new file mode 100644 index 000000000..12676ea7d --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/fireward_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:fireward_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:fireward_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/frostward_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/frostward_ring.json new file mode 100644 index 000000000..eabe54961 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/frostward_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:frostward_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:frostward_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/heavy_chain_necklace.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/heavy_chain_necklace.json new file mode 100644 index 000000000..436aeda70 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/heavy_chain_necklace.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:heavy_chain_necklace" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:heavy_chain_necklace" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/poisonward_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/poisonward_ring.json new file mode 100644 index 000000000..2dd4ec790 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/poisonward_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:poisonward_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:poisonward_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/visibility_ring.json b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/visibility_ring.json new file mode 100644 index 000000000..2f5804ec6 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/advancement/recipes/misc/visibility_ring.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "irons_spellbooks:visibility_ring" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "mithril_scrap": { + "conditions": { + "items": [ + { + "items": "irons_spellbooks:mithril_scrap" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "mithril_scrap" + ] + ], + "rewards": { + "recipes": [ + "irons_spellbooks:visibility_ring" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/loot_table/blocks/deepslate_mithril_ore.json b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/deepslate_mithril_ore.json new file mode 100644 index 000000000..afb4a27f9 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/deepslate_mithril_ore.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "irons_spellbooks:deepslate_mithril_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + } + ], + "name": "irons_spellbooks:raw_mithril" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "irons_spellbooks:blocks/deepslate_mithril_ore" +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/loot_table/blocks/mithril_ore.json b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/mithril_ore.json new file mode 100644 index 000000000..55b4bcb3e --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/mithril_ore.json @@ -0,0 +1,49 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "irons_spellbooks:mithril_ore" + }, + { + "type": "minecraft:item", + "functions": [ + { + "enchantment": "minecraft:fortune", + "formula": "minecraft:ore_drops", + "function": "minecraft:apply_bonus" + } + ], + "name": "irons_spellbooks:raw_mithril" + } + ] + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "irons_spellbooks:blocks/mithril_ore" +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/loot_table/blocks/portal_frame.json b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/portal_frame.json new file mode 100644 index 000000000..03a01770c --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/loot_table/blocks/portal_frame.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "irons_spellbooks:portal_frame" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "irons_spellbooks:blocks/portal_frame" +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/neoforge/biome_modifier/add_mithril_ore.json b/src/generated/resources/data/irons_spellbooks/neoforge/biome_modifier/add_mithril_ore.json new file mode 100644 index 000000000..c9fc52784 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/neoforge/biome_modifier/add_mithril_ore.json @@ -0,0 +1,6 @@ +{ + "type": "neoforge:add_features", + "biomes": "#minecraft:is_overworld", + "features": "irons_spellbooks:ore_mithril_placement", + "step": "underground_ores" +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/affinity_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/affinity_ring.json new file mode 100644 index 000000000..16e057d39 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/affinity_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:bucket" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:affinity_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/cast_time_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/cast_time_ring.json new file mode 100644 index 000000000..4ece88ce1 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/cast_time_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:amethyst_shard" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:cast_time_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/concentration_amulet.json b/src/generated/resources/data/irons_spellbooks/recipe/concentration_amulet.json new file mode 100644 index 000000000..988fb0466 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/concentration_amulet.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "irons_spellbooks:mithril_ingot" + }, + "S": { + "item": "minecraft:chain" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + " S ", + "SXS", + " M " + ], + "result": { + "count": 1, + "id": "irons_spellbooks:concentration_amulet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/conjurers_talisman.json b/src/generated/resources/data/irons_spellbooks/recipe/conjurers_talisman.json new file mode 100644 index 000000000..28e4dbb53 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/conjurers_talisman.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:skeleton_skull" + }, + "S": { + "item": "minecraft:string" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + " S ", + "SXS", + " M " + ], + "result": { + "count": 1, + "id": "irons_spellbooks:conjurers_talisman" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/cooldown_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/cooldown_ring.json new file mode 100644 index 000000000..34bd2863c --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/cooldown_ring.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "tag": "c:ingots/copper" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + " M ", + "MXM", + " M " + ], + "result": { + "count": 1, + "id": "irons_spellbooks:cooldown_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/emerald_stoneplate_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/emerald_stoneplate_ring.json new file mode 100644 index 000000000..8ff67967a --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/emerald_stoneplate_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:experience_bottle" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:emerald_stoneplate_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/expulsion_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/expulsion_ring.json new file mode 100644 index 000000000..c5ab1a3da --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/expulsion_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:wind_charge" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:expulsion_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/fireward_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/fireward_ring.json new file mode 100644 index 000000000..a37120cd4 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/fireward_ring.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "irons_spellbooks:cinder_essence" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + " M ", + "MXM", + " M " + ], + "result": { + "count": 1, + "id": "irons_spellbooks:fireward_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/frostward_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/frostward_ring.json new file mode 100644 index 000000000..53f3a6886 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/frostward_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "irons_spellbooks:permafrost_shard" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:frostward_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/heavy_chain_necklace.json b/src/generated/resources/data/irons_spellbooks/recipe/heavy_chain_necklace.json new file mode 100644 index 000000000..8c48ffe5c --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/heavy_chain_necklace.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:chain" + }, + "S": { + "item": "minecraft:chain" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + " S ", + "SXS", + " M " + ], + "result": { + "count": 1, + "id": "irons_spellbooks:heavy_chain_necklace" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/poisonward_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/poisonward_ring.json new file mode 100644 index 000000000..4c1b2bcb7 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/poisonward_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "irons_spellbooks:nature_rune" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:poisonward_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/recipe/visibility_ring.json b/src/generated/resources/data/irons_spellbooks/recipe/visibility_ring.json new file mode 100644 index 000000000..0d5d30b15 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/recipe/visibility_ring.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "M": { + "item": "minecraft:spyglass" + }, + "X": { + "item": "irons_spellbooks:mithril_scrap" + } + }, + "pattern": [ + "M ", + " X" + ], + "result": { + "count": 1, + "id": "irons_spellbooks:visibility_ring" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/worldgen/configured_feature/ore_mithril_feature.json b/src/generated/resources/data/irons_spellbooks/worldgen/configured_feature/ore_mithril_feature.json new file mode 100644 index 000000000..8500e7d3b --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/worldgen/configured_feature/ore_mithril_feature.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:ore", + "config": { + "discard_chance_on_air_exposure": 1.0, + "size": 3, + "targets": [ + { + "state": { + "Name": "irons_spellbooks:mithril_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:stone_ore_replaceables" + } + }, + { + "state": { + "Name": "irons_spellbooks:deepslate_mithril_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:deepslate_ore_replaceables" + } + } + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/irons_spellbooks/worldgen/placed_feature/ore_mithril_placement.json b/src/generated/resources/data/irons_spellbooks/worldgen/placed_feature/ore_mithril_placement.json new file mode 100644 index 000000000..a542902a5 --- /dev/null +++ b/src/generated/resources/data/irons_spellbooks/worldgen/placed_feature/ore_mithril_placement.json @@ -0,0 +1,27 @@ +{ + "feature": "irons_spellbooks:ore_mithril_feature", + "placement": [ + { + "type": "minecraft:count", + "count": 7 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:height_range", + "height": { + "type": "minecraft:uniform", + "max_inclusive": { + "absolute": -38 + }, + "min_inclusive": { + "absolute": -63 + } + } + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/src/main/java/io/redspace/ironsspellbooks/command/GenerateSiteData.java b/src/main/java/io/redspace/ironsspellbooks/command/GenerateSiteData.java index dce338421..dc4c83c61 100644 --- a/src/main/java/io/redspace/ironsspellbooks/command/GenerateSiteData.java +++ b/src/main/java/io/redspace/ironsspellbooks/command/GenerateSiteData.java @@ -1,393 +1,487 @@ -//package io.redspace.ironsspellbooks.command; -// -//import com.mojang.brigadier.CommandDispatcher; -//import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -//import io.redspace.ironsspellbooks.IronsSpellbooks; -//import io.redspace.ironsspellbooks.api.registry.SpellRegistry; -//import io.redspace.ironsspellbooks.capabilities.spellbook.SpellBookData; -//import io.redspace.ironsspellbooks.item.SpellBook; -//import io.redspace.ironsspellbooks.item.UniqueSpellBook; -//import io.redspace.ironsspellbooks.api.item.weapons.ExtendedSwordItem; -//import io.redspace.ironsspellbooks.registries.ItemRegistry; -//import net.minecraft.commands.CommandSourceStack; -//import net.minecraft.commands.Commands; -//import net.minecraft.network.chat.Component; -//import net.minecraft.resources.ResourceLocation; -//import net.minecraft.server.level.ServerPlayer; -//import net.minecraft.world.item.*; -//import net.minecraft.world.item.crafting.*; -// -// -//import java.io.BufferedWriter; -//import java.io.FileWriter; -//import java.util.*; -//import java.util.stream.Collectors; -// -//public class GenerateSiteData { -// -// private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.irons_spellbooks.generate_recipe_data.failed")); -// -// private static final String RECIPE_DATA_TEMPLATE = """ -// - id: "%s" -// name: "%s" -// path: "%s" -// group: "%s" -// craftingType: "%s" -// item0Id: "%s" -// item0: "%s" -// item0Path: "%s" -// item1Id: "%s" -// item1: "%s" -// item1Path: "%s" -// item2Id: "%s" -// item2: "%s" -// item2Path: "%s" -// item3Id: "%s" -// item3: "%s" -// item3Path: "%s" -// item4Id: "%s" -// item4: "%s" -// item4Path: "%s" -// item5Id: "%s" -// item5: "%s" -// item5Path: "%s" -// item6Id: "%s" -// item6: "%s" -// item6Path: "%s" -// item7Id: "%s" -// item7: "%s" -// item7Path: "%s" -// item8Id: "%s" -// item8: "%s" -// item8Path: "%s" -// tooltip: "%s" -// description: "" -// -// """; -// -// private static final String SPELL_DATA_TEMPLATE = """ -// - name: "%s" -// school: "%s" -// icon: "%s" -// level: "%d to %d" -// mana: "%d to %d" -// cooldown: "%ds" -// cast_type: "%s" -// rarity: "%s to %s" -// description: "%s" -// u1: "%s" -// u2: "%s" -// u3: "%s" -// u4: "%s" -// -// """; -// -// public static void register(CommandDispatcher pDispatcher) { -// pDispatcher.register(Commands.literal("generateSiteData").requires((p_138819_) -> { -// return p_138819_.hasPermission(2); -// }).executes((commandContext) -> { -// return generateSiteData(commandContext.getSource()); -// })); -// } -// -// private static int generateSiteData(CommandSourceStack source) { -// generateRecipeData(source); -// generateSpellData(); -// -// return 1; -// } -// -// private static void generateRecipeData(CommandSourceStack source) { -// try { -// var itemBuilder = new StringBuilder(); -// var armorBuilder = new StringBuilder(); -// var spellbookBuilder = new StringBuilder(); -// var blockBuilder = new StringBuilder(); -// -// var armorTypes = List.of("Archevoker", "Cryomancer", "Cultist", "Electromancer", "Priest", "Pumpkin", "Pyromancer", "Shadow-Walker", "Wandering Magician", "Ring", "Heavy Chain", "Scarecrow", "Plagued"); -// Set itemsTracked = new HashSet<>(); -// //This will exclude these items -// itemsTracked.add(ItemRegistry.WIMPY_SPELL_BOOK.get()); -// itemsTracked.add(ItemRegistry.LEGENDARY_SPELL_BOOK.get()); -// itemsTracked.add(Items.POISONOUS_POTATO); -// -// source.getLevel().getRecipeManager().getRecipes() -// .stream() -// .filter(r -> r.getId().getNamespace().equals("irons_spellbooks") && !r.getId().toString().contains("poisonous_potato")) -// .sorted(Comparator.comparing(x -> x.getId().toString())) -// .forEach(recipe -> { -// //IronsSpellbooks.LOGGER.debug("recipe: {}, {}, {}", recipe.getId(), recipe.getClass(), recipe.getType()); -// //IronsSpellbooks.LOGGER.debug("recipe: resultItem: {}", ForgeRegistries.ITEMS.getKey(recipe.getResultItem().getItem())); -// -// var resultItemResourceLocation = ForgeRegistries.ITEMS.getKey(recipe.getResultItem().getItem()); -// var recipeData = new ArrayList(10); -// recipeData.add(new RecipeData( -// resultItemResourceLocation.toString(), -// recipe.getResultItem().getItem().getName(ItemStack.EMPTY).getString(), -// String.format("/img/items/%s.png", resultItemResourceLocation.getPath()), -// recipe.getResultItem().getItem()) -// ); -// -// itemsTracked.add(recipe.getResultItem().getItem()); -// -// if (recipe instanceof ShapedRecipe || recipe instanceof ShapelessRecipe) { -// recipe.getIngredients().forEach(ingredient -> { -// handleIngeredient(ingredient, recipeData, recipe); -// }); -// } else if (recipe instanceof UpgradeRecipe upgradeRecipe) { -// handleIngeredient(upgradeRecipe.base, recipeData, recipe); -// handleIngeredient(upgradeRecipe.addition, recipeData, recipe); -// } -// -// var name = getRecipeDataAtIndex(recipeData, 0).name; -// var tooltip = getTooltip(source.getPlayer(), recipe.getResultItem()); -// -// if (getRecipeDataAtIndex(recipeData, 0).item instanceof SpellBook || getRecipeDataAtIndex(recipeData, 0).item instanceof ExtendedSwordItem) { -// appendToBuilder(spellbookBuilder, recipe, recipeData, "", tooltip); -// } else if (armorTypes.stream().anyMatch(item -> name.contains(item))) { -// var words = name.split(" "); -// var group = Arrays.stream(words).limit(words.length - 1).collect(Collectors.joining(" ")); -// appendToBuilder(armorBuilder, recipe, recipeData, group, tooltip); -// } else if (recipe.getResultItem().getItem() instanceof BlockItem) { -// appendToBuilder(blockBuilder, recipe, recipeData, "", tooltip); -// } else { -// appendToBuilder(itemBuilder, recipe, recipeData, "", tooltip); -// } -// }); -// -// ForgeRegistries.ITEMS.getValues() -// .stream() -// .sorted(Comparator.comparing(Item::getDescriptionId)) -// .forEach(item -> { -// var itemResource = ForgeRegistries.ITEMS.getKey(item); -// var tooltip = getTooltip(source.getPlayer(), new ItemStack(item)); -// -// if (itemResource.toString().contains("irons_spellbooks") && !itemsTracked.contains(item)) { -// //Non craftable items -// var name = item.getName(ItemStack.EMPTY).getString(); -// if (item.getDescriptionId().contains("spawn_egg") || item.getDescriptionId().equals("item.irons_spellbooks.scroll")) { -// //Skip -// } else if (armorTypes.stream().anyMatch(itemToMatch -> name.contains(itemToMatch))) { -// appendToBuilder2(armorBuilder, name, itemResource, tooltip); -// } else if (item instanceof UniqueSpellBook) { -// appendToBuilder2(spellbookBuilder, name, itemResource, getSpells(new ItemStack(item))); -// } else if (item instanceof SpellBook || item instanceof ExtendedSwordItem) { -// appendToBuilder2(spellbookBuilder, name, itemResource, tooltip); -// } else if (item instanceof BlockItem) { -// appendToBuilder2(blockBuilder, name, itemResource, tooltip); -// } else { -// appendToBuilder2(itemBuilder, name, itemResource, tooltip); -// } -// itemsTracked.add(item); -// -// } -// }); -// -// var file = new BufferedWriter(new FileWriter("item_data.yml")); -// file.write(postProcess(itemBuilder)); -// file.close(); -// -// file = new BufferedWriter(new FileWriter("armor_data.yml")); -// file.write(postProcess(armorBuilder)); -// file.close(); -// -// file = new BufferedWriter(new FileWriter("spellbook_data.yml")); -// file.write(postProcess(spellbookBuilder)); -// file.close(); -// -// file = new BufferedWriter(new FileWriter("block_data.yml")); -// file.write(postProcess(blockBuilder)); -// file.close(); -// } catch (Exception e) { -// IronsSpellbooks.LOGGER.debug(e.getMessage()); -// } -// } -// -// private static String postProcess(StringBuilder sb) { -// return sb.toString() -// .replace("netherite_spell_book.png", "netherite_spell_book.gif") -// .replace("ruined_book.png", "ruined_book.gif") -// .replace("lightning_bottle.png", "lightning_bottle.gif") -// .replace("/upgrade_orb.png", "/upgrade_orb.gif") -// .replace("fire_upgrade_orb.png", "fire_upgrade_orb.gif") -// .replace("holy_upgrade_orb.png", "holy_upgrade_orb.gif") -// .replace("lightning_upgrade_orb.png", "lightning_upgrade_orb.gif") -// .replace("ender_upgrade_orb.png", "ender_upgrade_orb.gif") -// .replace("wayward_compass.png", "wayward_compass.gif"); -// } -// -// private static String getSpells(ItemStack itemStack) { -// if (itemStack.getItem() instanceof SpellBook) { -// return SpellBookData.getSpellBookData(itemStack).getActiveInscribedSpells().stream().map(spell -> { -// return spell.getSpell().getDisplayName().getString() + " (" + spell.getLevel() + ")"; -// }).collect(Collectors.joining(", ")); -// } -// return ""; -// } -// -// private static String getTooltip(ServerPlayer player, ItemStack itemStack) { -// return Arrays.stream(itemStack.getTooltipLines(player, TooltipFlag.Default.NORMAL) -// .stream() -// .skip(1) //First component is always the name. Ignore it -// .map(Component::getString) -// .filter(x -> x.trim().length() > 0) -// .collect(Collectors.joining(", ")) -// .replace(":,", ": ") -// .replace(" ", " ") -// .split(",")) -// .filter(item -> !item.contains("Slot")) -// .collect(Collectors.joining(",")) -// .trim() -// .replace(":", ":
"); -// } -// -// private static void appendToBuilder(StringBuilder sb, Recipe recipe, List recipeData, String group, String tooltip) { -// sb.append(String.format(RECIPE_DATA_TEMPLATE, -// getRecipeDataAtIndex(recipeData, 0).id, -// getRecipeDataAtIndex(recipeData, 0).name, -// getRecipeDataAtIndex(recipeData, 0).path, -// group, -// recipe.getType(), -// getRecipeDataAtIndex(recipeData, 1).id, -// getRecipeDataAtIndex(recipeData, 1).name, -// getRecipeDataAtIndex(recipeData, 1).path, -// getRecipeDataAtIndex(recipeData, 2).id, -// getRecipeDataAtIndex(recipeData, 2).name, -// getRecipeDataAtIndex(recipeData, 2).path, -// getRecipeDataAtIndex(recipeData, 3).id, -// getRecipeDataAtIndex(recipeData, 3).name, -// getRecipeDataAtIndex(recipeData, 3).path, -// getRecipeDataAtIndex(recipeData, 4).id, -// getRecipeDataAtIndex(recipeData, 4).name, -// getRecipeDataAtIndex(recipeData, 4).path, -// getRecipeDataAtIndex(recipeData, 5).id, -// getRecipeDataAtIndex(recipeData, 5).name, -// getRecipeDataAtIndex(recipeData, 5).path, -// getRecipeDataAtIndex(recipeData, 6).id, -// getRecipeDataAtIndex(recipeData, 6).name, -// getRecipeDataAtIndex(recipeData, 6).path, -// getRecipeDataAtIndex(recipeData, 7).id, -// getRecipeDataAtIndex(recipeData, 7).name, -// getRecipeDataAtIndex(recipeData, 7).path, -// getRecipeDataAtIndex(recipeData, 8).id, -// getRecipeDataAtIndex(recipeData, 8).name, -// getRecipeDataAtIndex(recipeData, 8).path, -// getRecipeDataAtIndex(recipeData, 9).id, -// getRecipeDataAtIndex(recipeData, 9).name, -// getRecipeDataAtIndex(recipeData, 9).path, -// tooltip -// )); -// } -// -// private static void appendToBuilder2(StringBuilder sb, String name, ResourceLocation itemResource, String tooltip) { -// sb.append(String.format(RECIPE_DATA_TEMPLATE, -// itemResource.toString(), -// name, -// String.format("/img/items/%s.png", itemResource.getPath()), -// "", -// "none", -// "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", tooltip -// )); -// } -// -// private static void handleIngeredient(Ingredient ingredient, ArrayList recipeData, Recipe recipe) { -// Arrays.stream(ingredient.getItems()) -// .findFirst() -// .ifPresentOrElse(itemStack -> { -// var itemResource = ForgeRegistries.ITEMS.getKey(itemStack.getItem()); -// var path = ""; -// -// if (itemResource.toString().contains("irons_spellbooks")) { -// path = String.format("/img/items/%s.png", itemResource.getPath()); -// } else { -// path = String.format("/img/items/minecraft/%s.png", itemResource.getPath()); -// } -// -// recipeData.add(new RecipeData( -// itemResource.toString(), -// itemStack.getItem().getName(ItemStack.EMPTY).getString(), -// path, -// recipe.getResultItem().getItem())); -// -// }, () -> { -// recipeData.add(RecipeData.EMPTY); -// }); -// } -// -// private static RecipeData getRecipeDataAtIndex(List recipeData, int index) { -// if (index < recipeData.size()) { -// return recipeData.get(index); -// } else { -// return RecipeData.EMPTY; -// } -// } -// -// private record RecipeData(String id, String name, String path, Item item) { -// public static RecipeData EMPTY = new RecipeData("", "", "", null); -// } -// -// private static void generateSpellData() { -// try { -// var sb = new StringBuilder(); -// -// SpellRegistry.REGISTRY.get().getValues().stream() -// .filter(st -> (st.isEnabled() && st != SpellRegistry.none())) -// .forEach(spellType -> { -// var spellMin = spellType.getMinLevel(); -// var spellMax = spellType.getMaxLevel(); -// -// var uniqueInfo = spellType.getUniqueInfo(spellMin, null); -// var u1 = uniqueInfo.size() >= 1 ? uniqueInfo.get(0).getString() : ""; -// var u2 = uniqueInfo.size() >= 2 ? uniqueInfo.get(1).getString() : ""; -// var u3 = uniqueInfo.size() >= 3 ? uniqueInfo.get(2).getString() : ""; -// var u4 = uniqueInfo.size() >= 4 ? uniqueInfo.get(3).getString() : ""; -// -// sb.append(String.format(SPELL_DATA_TEMPLATE, -// handleCapitalization(spellType.getSpellName()), -// handleCapitalization(spellType.getSchoolType().getDisplayName().getString()), -// String.format("/img/spells/%s.png", spellType.getSpellId()), -// spellType.getMinLevel(), -// spellType.getMaxLevel(), -// spellType.getManaCost(spellMin, null), -// spellType.getManaCost(spellMax, null), -// spellType.getSpellCooldown(), -// handleCapitalization(spellType.getCastType().name()), -// handleCapitalization(spellType.getRarity(spellMin).name()), -// handleCapitalization(spellType.getRarity(spellMax).name()), -// Component.translatable(String.format("%s.guide", spellType.getComponentId())).getString(), -// u1, -// u2, -// u3, -// u4) -// ); -// }); -// -// var file = new BufferedWriter(new FileWriter("spell_data.yml")); -// file.write(sb.toString()); -// file.close(); -// } catch (Exception e) { -// IronsSpellbooks.LOGGER.debug(e.getMessage()); -// } -// } -// -// public static String handleCapitalization(String input) { -// return Arrays.stream(input.toLowerCase().split("[ |_]")) -// .map(word -> { -// if (word.equals("spell")) { -// return ""; -// } else { -// var first = word.substring(0, 1); -// var rest = word.substring(1); -// return first.toUpperCase() + rest; -// } -// }) -// .collect(Collectors.joining(" ")) -// .trim(); -// } -// -// private enum CraftingType { -// CRAFTING_TABLE, -// SMITHING_TABLE, -// NOT_CRAFTABLE -// } -//} +package io.redspace.ironsspellbooks.command; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +import io.redspace.ironsspellbooks.IronsSpellbooks; +import io.redspace.ironsspellbooks.api.item.weapons.ExtendedSwordItem; +import io.redspace.ironsspellbooks.api.registry.SpellRegistry; +import io.redspace.ironsspellbooks.api.spells.AbstractSpell; +import io.redspace.ironsspellbooks.api.spells.ISpellContainer; +import io.redspace.ironsspellbooks.item.*; +import io.redspace.ironsspellbooks.item.consumables.SimpleElixir; +import io.redspace.ironsspellbooks.item.curios.CurioBaseItem; +import io.redspace.ironsspellbooks.jei.ArcaneAnvilRecipeMaker; +import io.redspace.ironsspellbooks.registries.ItemRegistry; +import io.redspace.ironsspellbooks.util.ModTags; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.*; +import net.minecraft.world.item.crafting.*; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nullable; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.util.*; +import java.util.stream.Collectors; + +public class GenerateSiteData { + + private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.irons_spellbooks.generate_recipe_data.failed")); + + private static final String RECIPE_DATA_TEMPLATE = """ + - id: "%s" + name: "%s" + path: "%s" + group: "%s" + craftingType: "%s" + item0Id: "%s" + item0: "%s" + item0Path: "%s" + item1Id: "%s" + item1: "%s" + item1Path: "%s" + item2Id: "%s" + item2: "%s" + item2Path: "%s" + item3Id: "%s" + item3: "%s" + item3Path: "%s" + item4Id: "%s" + item4: "%s" + item4Path: "%s" + item5Id: "%s" + item5: "%s" + item5Path: "%s" + item6Id: "%s" + item6: "%s" + item6Path: "%s" + item7Id: "%s" + item7: "%s" + item7Path: "%s" + item8Id: "%s" + item8: "%s" + item8Path: "%s" + tooltip: "%s" + description: "" + + """; + + private static final String SPELL_DATA_TEMPLATE = """ + - name: "%s" + school: "%s" + icon: "%s" + level: "%d to %d" + mana: "%d to %d" + cooldown: "%ds" + cast_type: "%s" + rarity: "%s to %s" + description: "%s" + u1: "%s" + u2: "%s" + u3: "%s" + u4: "%s" + + """; + + public static void register(CommandDispatcher pDispatcher) { + pDispatcher.register(Commands.literal("generateSiteData").requires((p_138819_) -> { + return p_138819_.hasPermission(2); + }).executes((commandContext) -> { + return generateSiteData(commandContext.getSource()); + })); + } + + private static int generateSiteData(CommandSourceStack source) { + generateRecipeData(source); + generateSpellData(); + + return 1; + } + static ServerLevel level; + + private static void generateRecipeData(CommandSourceStack source) { + try { + var itemBuilder = new StringBuilder(); + var armorBuilder = new StringBuilder(); + var spellbookBuilder = new StringBuilder(); + var curioBuilder = new StringBuilder(); + var blockBuilder = new StringBuilder(); + level = source.getLevel(); + + Set itemsTracked = new HashSet<>(); + //This will exclude these items + itemsTracked.add(ItemRegistry.WIMPY_SPELL_BOOK.get()); + itemsTracked.add(ItemRegistry.LEGENDARY_SPELL_BOOK.get()); + itemsTracked.add(Items.POISONOUS_POTATO); + handleAffinityRingEntry(curioBuilder, itemsTracked, source); + ArcaneAnvilRecipeMaker.getVisibleItems() + .stream() + .sorted(Comparator.comparing(Item::getDescriptionId)) + .forEach(item -> { + var itemResource = BuiltInRegistries.ITEM.getKey(item); + var tooltip = getTooltip(source.getPlayer(), new ItemStack(item)); + + if (itemResource.getNamespace().equals("irons_spellbooks") && !itemsTracked.contains(item)) { + var recipe = getRecipeFor(source, item); + var name = item.getName(ItemStack.EMPTY).getString(); + if (item.getDescriptionId().contains("patchouli") || item.getDescriptionId().contains("spawn_egg") || item.getDescriptionId().equals("item.irons_spellbooks.scroll")) { + //Skip + } else if (item instanceof ArmorItem) { + if (recipe != null) { + var words = name.split(" "); + var group = Arrays.stream(words).limit(words.length - 1).collect(Collectors.joining(" ")); + appendToBuilder(armorBuilder, recipe, getRecipeData(recipe), group, tooltip); + } else { + appendToBuilder2(armorBuilder, name, itemResource, tooltip); + } + } else if (item instanceof UniqueSpellBook) { + //should never have recipe + appendToBuilder2(spellbookBuilder, name, itemResource, getSpells(new ItemStack(item))); + } else if (item instanceof SpellBook || item instanceof ExtendedSwordItem || item instanceof CastingItem) { + if (recipe != null) { + appendToBuilder(spellbookBuilder, recipe, getRecipeData(recipe), "", tooltip); + } else { + appendToBuilder2(spellbookBuilder, name, itemResource, tooltip); + } + } else if (item instanceof CurioBaseItem) { + if (recipe != null) { + appendToBuilder(curioBuilder, recipe, getRecipeData(recipe), "", tooltip); + } else { + appendToBuilder2(curioBuilder, name, itemResource, tooltip); + } + } else if (item instanceof BlockItem) { + if (recipe != null) { + appendToBuilder(blockBuilder, recipe, getRecipeData(recipe), "", tooltip); + } else { + appendToBuilder2(blockBuilder, name, itemResource, tooltip); + } + } else { + if (recipe != null) { + appendToBuilder(itemBuilder, recipe, getRecipeData(recipe), handleGenericItemGrouping(item), tooltip); + } else { + appendToBuilder3(itemBuilder, name, itemResource, handleGenericItemGrouping(item), tooltip); + } + } + itemsTracked.add(item); + + } + }); + + var file = new BufferedWriter(new FileWriter("item_data.yml")); + file.write(postProcess(itemBuilder)); + file.close(); + + file = new BufferedWriter(new FileWriter("armor_data.yml")); + file.write(postProcess(armorBuilder)); + file.close(); + + file = new BufferedWriter(new FileWriter("curio_data.yml")); + file.write(postProcess(curioBuilder)); + file.close(); + + file = new BufferedWriter(new FileWriter("spellbook_data.yml")); + file.write(postProcess(spellbookBuilder)); + file.close(); + + file = new BufferedWriter(new FileWriter("block_data.yml")); + file.write(postProcess(blockBuilder)); + file.close(); + } catch (Exception e) { + IronsSpellbooks.LOGGER.debug(e.getMessage()); + } + } + + private static void handleAffinityRingEntry(StringBuilder curioBuilder, Set itemsTracked, CommandSourceStack source) { + var item = ItemRegistry.AFFINITY_RING.get(); + itemsTracked.add(item); + var itemResource = BuiltInRegistries.ITEM.getKey(item); + var name = item.getName(ItemStack.EMPTY).getString(); + appendToBuilder2(curioBuilder, name, itemResource, + "Affinity Rings are randomly generated as loot, and will boost the level of a select spell by one. This effect can stack." + ); + + } + + private static String handleGenericItemGrouping(Item item) { + if (item instanceof InkItem) { + return "Ink"; + } else if (item.getDescriptionId().contains("rune")) { + return "Runes"; + } else if (item instanceof UpgradeOrbItem || item == ItemRegistry.UPGRADE_ORB.get()) { + return "Upgrade Orbs"; + } else if (item instanceof SimpleElixir) { + return "Elixirs"; + } else { + return "All"; + } + } + + @NotNull + private static ArrayList getRecipeData(Recipe recipe) { + var resultItemResourceLocation = BuiltInRegistries.ITEM.getKey(recipe.getResultItem(level.registryAccess()).getItem()); + var recipeData = new ArrayList(10); + recipeData.add(new RecipeIngredientData( + resultItemResourceLocation.toString(), + recipe.getResultItem(level.registryAccess()).getItem().getName(ItemStack.EMPTY).getString(), + String.format("/img/items/%s.png", resultItemResourceLocation.getPath()), + recipe.getResultItem(level.registryAccess()).getItem()) + ); + if (recipe instanceof ShapedRecipe || recipe instanceof ShapelessRecipe) { + recipe.getIngredients().forEach(ingredient -> { + handleIngredient(ingredient, recipeData, recipe); + }); + } + return recipeData; + } + + private static @Nullable Recipe getRecipeFor(CommandSourceStack sourceStack, Item item) { + for (RecipeHolder recipe : sourceStack.getRecipeManager().getRecipes()) { + if (recipe.value().getResultItem(level.registryAccess()).is(item)) { + return recipe.value(); + } + } + return null; + } + + private static String postProcess(StringBuilder sb) { + return sb.toString() + .replace("netherite_spell_book.png", "netherite_spell_book.gif") + .replace("ruined_book.png", "ruined_book.gif") + .replace("lightning_bottle.png", "lightning_bottle.gif") + .replace("cinder_essence.png", "cinder_essence.gif") + .replace("nature_upgrade_orb.png", "nature_upgrade_orb.gif") + .replace("evasion_elixir.png", "evasion_elixir.gif") + .replace("/upgrade_orb.png", "/upgrade_orb.gif") + .replace("fire_upgrade_orb.png", "fire_upgrade_orb.gif") + .replace("holy_upgrade_orb.png", "holy_upgrade_orb.gif") + .replace("lightning_upgrade_orb.png", "lightning_upgrade_orb.gif") + .replace("ender_upgrade_orb.png", "ender_upgrade_orb.gif") + .replace("mana_upgrade_orb.png", "upgrade_orb_mana.gif") + .replace("protection_upgrade_orb.png", "upgrade_orb_protection.gif") + .replace("ice_upgrade_orb.png", "upgrade_orb_ice.gif") + .replace("evocation_upgrade_orb.png", "upgrade_orb_evocation.gif") + .replace("cooldown_upgrade_orb.png", "upgrade_orb_cooldown.gif") + .replace("blood_upgrade_orb.png", "upgrade_orb_blood.gif") + .replace("wayward_compass.png", "wayward_compass.gif"); + } + + private static String getSpells(ItemStack itemStack) { + if (itemStack.getItem() instanceof SpellBook) { + var spellList = ISpellContainer.get(itemStack); + + return spellList.getActiveSpells().stream().map(spell -> { + return spell.getSpell().getDisplayName(null).getString() + " (" + spell.getLevel() + ")"; + }).collect(Collectors.joining(", ")); + } + return ""; + } + + private static String getTooltip(ServerPlayer player, ItemStack itemStack) { + return Arrays.stream(itemStack.getTooltipLines(Item.TooltipContext.EMPTY, player, TooltipFlag.Default.NORMAL) + .stream() + .skip(1) //First component is always the name. Ignore it + .map(Component::getString) + .filter(x -> x.trim().length() > 0) + .collect(Collectors.joining(", ")) + .replace(":,", ": ") + .replace(" ", " ") + .split(",")) + .filter(item -> !item.contains("Slot")) + .collect(Collectors.joining(",")) + .trim() + .replace(":", ":
"); + } + + private static void appendToBuilder(StringBuilder sb, Recipe recipe, List recipeIngredientData, String group, String tooltip) { + sb.append(String.format(RECIPE_DATA_TEMPLATE, + getRecipeDataAtIndex(recipeIngredientData, 0).id, + getRecipeDataAtIndex(recipeIngredientData, 0).name, + getRecipeDataAtIndex(recipeIngredientData, 0).path, + group, + recipe.getType(), + getRecipeDataAtIndex(recipeIngredientData, 1).id, + getRecipeDataAtIndex(recipeIngredientData, 1).name, + getRecipeDataAtIndex(recipeIngredientData, 1).path, + getRecipeDataAtIndex(recipeIngredientData, 2).id, + getRecipeDataAtIndex(recipeIngredientData, 2).name, + getRecipeDataAtIndex(recipeIngredientData, 2).path, + getRecipeDataAtIndex(recipeIngredientData, 3).id, + getRecipeDataAtIndex(recipeIngredientData, 3).name, + getRecipeDataAtIndex(recipeIngredientData, 3).path, + getRecipeDataAtIndex(recipeIngredientData, 4).id, + getRecipeDataAtIndex(recipeIngredientData, 4).name, + getRecipeDataAtIndex(recipeIngredientData, 4).path, + getRecipeDataAtIndex(recipeIngredientData, 5).id, + getRecipeDataAtIndex(recipeIngredientData, 5).name, + getRecipeDataAtIndex(recipeIngredientData, 5).path, + getRecipeDataAtIndex(recipeIngredientData, 6).id, + getRecipeDataAtIndex(recipeIngredientData, 6).name, + getRecipeDataAtIndex(recipeIngredientData, 6).path, + getRecipeDataAtIndex(recipeIngredientData, 7).id, + getRecipeDataAtIndex(recipeIngredientData, 7).name, + getRecipeDataAtIndex(recipeIngredientData, 7).path, + getRecipeDataAtIndex(recipeIngredientData, 8).id, + getRecipeDataAtIndex(recipeIngredientData, 8).name, + getRecipeDataAtIndex(recipeIngredientData, 8).path, + getRecipeDataAtIndex(recipeIngredientData, 9).id, + getRecipeDataAtIndex(recipeIngredientData, 9).name, + getRecipeDataAtIndex(recipeIngredientData, 9).path, + tooltip + )); + } + + private static void appendToBuilder2(StringBuilder sb, String name, ResourceLocation itemResource, String tooltip) { + sb.append(String.format(RECIPE_DATA_TEMPLATE, + itemResource.toString(), + name, + String.format("/img/items/%s.png", itemResource.getPath()), + "", + "none", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", tooltip + )); + } + + private static void appendToBuilder3(StringBuilder sb, String name, ResourceLocation itemResource, String group, String tooltip) { + sb.append(String.format(RECIPE_DATA_TEMPLATE, + itemResource.toString(), + name, + String.format("/img/items/%s.png", itemResource.getPath()), + group, + "none", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", tooltip + )); + } + + private static void handleIngredient(Ingredient ingredient, ArrayList recipeData, Recipe recipe) { + Arrays.stream(ingredient.getItems()) + .findFirst() + .ifPresentOrElse(itemStack -> { + var itemResource = BuiltInRegistries.ITEM.getKey(itemStack.getItem()); + var path = ""; + + if (itemResource.toString().contains("irons_spellbooks")) { + path = String.format("/img/items/%s.png", itemResource.getPath()); + } else { + path = String.format("/img/items/minecraft/%s.png", itemResource.getPath()); + } + //Detect a specific ingredient tag and replace it will a gif of all applicable items + if (itemStack.is(ModTags.INSCRIBED_RUNES) && recipe.getResultItem(level.registryAccess()).is(ItemRegistry.BLANK_RUNE.get())) { + path = "/img/items/all_runes.gif"; + } + recipeData.add(new RecipeIngredientData( + itemResource.toString(), + itemStack.getItem().getName(ItemStack.EMPTY).getString(), + path, + recipe.getResultItem(level.registryAccess()).getItem())); + + }, () -> { + recipeData.add(RecipeIngredientData.EMPTY); + }); + } + + private static RecipeIngredientData getRecipeDataAtIndex(List recipeIngredientData, int index) { + if (index < recipeIngredientData.size()) { + return recipeIngredientData.get(index); + } else { + return RecipeIngredientData.EMPTY; + } + } + + private record RecipeIngredientData(String id, String name, String path, Item item) { + public static RecipeIngredientData EMPTY = new RecipeIngredientData("", "", "", null); + } + + private static void generateSpellData() { + try { + var sb = new StringBuilder(); + + SpellRegistry.REGISTRY.stream() + .filter(st -> (st.isEnabled() && st != SpellRegistry.none())) + .forEach(spellType -> { + var spellMin = spellType.getMinLevel(); + var spellMax = spellType.getMaxLevel(); + + var uniqueInfo = processUniqueInfo(spellType); + var u1 = uniqueInfo.size() >= 1 ? uniqueInfo.get(0) : ""; + var u2 = uniqueInfo.size() >= 2 ? uniqueInfo.get(1) : ""; + var u3 = uniqueInfo.size() >= 3 ? uniqueInfo.get(2) : ""; + var u4 = uniqueInfo.size() >= 4 ? uniqueInfo.get(3) : ""; + + sb.append(String.format(SPELL_DATA_TEMPLATE, + handleCapitalization(spellType.getSpellName()), + handleCapitalization(spellType.getSchoolType().getDisplayName().getString()), + String.format("/img/spells/%s.png", spellType.getSpellName()), + spellType.getMinLevel(), + spellType.getMaxLevel(), + spellType.getManaCost(spellMin), + spellType.getManaCost(spellMax), + spellType.getSpellCooldown(), + handleCapitalization(spellType.getCastType().name()), + handleCapitalization(spellType.getRarity(spellMin).name()), + handleCapitalization(spellType.getRarity(spellMax).name()), + Component.translatable(String.format("%s.guide", spellType.getComponentId())).getString(), + u1, + u2, + u3, + u4) + ); + }); + + var file = new BufferedWriter(new FileWriter("spell_data.yml")); + file.write(sb.toString()); + file.close(); + } catch (Exception e) { + IronsSpellbooks.LOGGER.debug(e.getMessage()); + } + } + + private static List processUniqueInfo(AbstractSpell spell) { + List text = new ArrayList<>(); + var uniqueInfoMin = spell.getUniqueInfo(spell.getMinLevel(), null); + var uniqueInfoMax = spell.getUniqueInfo(spell.getMaxLevel(), null); + for (int i = 0; i < uniqueInfoMax.size(); i++) { + var splitMin = uniqueInfoMin.get(i).getString().split(" "); + var splitMax = uniqueInfoMax.get(i).getString().split(" "); + int k = -1; + for (int j = 0; j < splitMin.length; j++) { + if (splitMin[j].matches("\\d\\.?\\d*(s|m|%)*")) { + k = j; + break; + } + } + if (k >= 0 && !splitMin[k].equals(splitMax[k])) { + text.add(String.format(uniqueInfoMin.get(i).getString().replaceFirst(splitMin[k], "%s"), String.format("%s-%s", splitMin[k], splitMax[k]))); + } else { + text.add(uniqueInfoMin.get(i).getString()); + } + } + return text; + } + + public static String handleCapitalization(String input) { + return Arrays.stream(input.toLowerCase().split("[ |_]")) + .map(word -> { + if (word.equals("spell")) { + return ""; + } else { + var first = word.substring(0, 1); + var rest = word.substring(1); + return first.toUpperCase() + rest; + } + }) + .collect(Collectors.joining(" ")) + .trim(); + } + + private enum CraftingType { + CRAFTING_TABLE, + SMITHING_TABLE, + NOT_CRAFTABLE + } +} \ No newline at end of file diff --git a/src/main/java/io/redspace/ironsspellbooks/registries/CommandRegistry.java b/src/main/java/io/redspace/ironsspellbooks/registries/CommandRegistry.java index 20425f3e4..1c8ea5936 100644 --- a/src/main/java/io/redspace/ironsspellbooks/registries/CommandRegistry.java +++ b/src/main/java/io/redspace/ironsspellbooks/registries/CommandRegistry.java @@ -29,6 +29,7 @@ public static void onCommandsRegister(RegisterCommandsEvent event) { if (!FMLLoader.isProduction()) { ClearSpellSelectionCommand.register(commandDispatcher); IronsDebugCommand.register(commandDispatcher); + GenerateSiteData.register(commandDispatcher); } } } \ No newline at end of file