Tigereye504 / spellbound

Adds esoteric enchantments to minecraft
2 stars 4 forks source link

Disabled enchants can still be found it dungeons and treasure #11

Closed PixelatedBruh closed 3 years ago

PixelatedBruh commented 3 years ago

It is quite annoying to find a book that enchant is disabled. is there a way to change this?

elhertz commented 3 years ago

You can fix this by editing the enchantments from loot tables that use the minecraft enchant_randomly function I had to edit like 200 chest loot tables from minecraft and other mods D:

This is an example from the "When Dungeons Arise" mod: campsite_tent.json ```json { "type": "minecraft:chest", "pools": [ { "rolls": { "min": 1, "max": 32 }, "entries": [ { "type": "minecraft:item", "name": "minecraft:charcoal" }, { "type": "minecraft:item", "name": "minecraft:coal" }, { "type": "minecraft:item", "name": "minecraft:iron_ingot" } ] }, { "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "minecraft:iron_sword", "functions": [ { "function": "minecraft:enchant_with_levels", "levels": 16 } ] }, { "type": "minecraft:item", "name": "minecraft:stone_sword", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:sharpness", "minecraft:smite", "minecraft:bane_of_arthropods", "minecraft:knockback", "minecraft:fire_aspect", "minecraft:looting", "minecraft:sweeping", "minecraft:unbreaking", "minecraft:mending", "minecraft:vanishing_curse", "better_withered_mobs:withering", "extra_enchants:barbaric", "extra_enchants:fireproof", "extra_enchants:lifesteal", "fabricenchantments:beheading", "fabricenchantments:consumer", "fabricenchantments:ice_aspect", "fabricenchantments:paralysis", "fabricenchantments:rise", "more_gems:wisdom", "soulbound:soulbound", "spellbound:dullness", "spellbound:tethering", "spellbound:trophy_collecting" ] } ] } ] }, { "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "minecraft:bow", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:unbreaking", "minecraft:power", "minecraft:punch", "minecraft:flame", "minecraft:infinity", "minecraft:mending", "minecraft:vanishing_curse", "extra_enchants:arrow_speed", "extra_enchants:ender", "extra_enchants:explosive", "extra_enchants:fireproof", "extra_enchants:nimble", "soulbound:soulbound", "vanillatweaks:homing" ] } ] }, { "type": "minecraft:item", "name": "minecraft:crossbow", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:unbreaking", "minecraft:power", "minecraft:punch", "minecraft:flame", "minecraft:mending", "minecraft:vanishing_curse", "extra_enchants:fireproof", "soulbound:soulbound" ] } ] } ] }, { "rolls": { "min": 0, "max": 2 }, "entries": [ { "type": "minecraft:item", "weight": 2, "name": "minecraft:iron_boots", "functions": [ { "function": "minecraft:enchant_with_levels", "levels": 20 } ] }, { "type": "minecraft:item", "weight": 2, "name": "minecraft:iron_leggings", "functions": [ { "function": "minecraft:enchant_with_levels", "levels": 20 } ] }, { "type": "minecraft:item", "weight": 2, "name": "minecraft:iron_helmet", "functions": [ { "function": "minecraft:enchant_with_levels", "levels": 20 } ] }, { "type": "minecraft:item", "weight": 2, "name": "minecraft:iron_chestplate", "functions": [ { "function": "minecraft:enchant_with_levels", "levels": 20 } ] } ] }, { "rolls": { "min": 1, "max": 2 }, "entries": [ { "type": "minecraft:item", "name": "minecraft:leather_boots", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:protection", "minecraft:fire_protection", "minecraft:feather_falling", "minecraft:blast_protection", "minecraft:projectile_protection", "minecraft:thorns", "minecraft:depth_strider", "minecraft:frost_walker", "minecraft:binding_curse", "minecraft:unbreaking", "minecraft:mending", "minecraft:vanishing_curse", "doublejump:doublejump", "extra_enchants:fireproof", "gobber2:solidfooting", "soulbound:soulbound" ] } ] }, { "type": "minecraft:item", "name": "minecraft:leather_leggings", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:protection", "minecraft:fire_protection", "minecraft:feather_falling", "minecraft:blast_protection", "minecraft:projectile_protection", "minecraft:thorns", "minecraft:binding_curse", "minecraft:unbreaking", "minecraft:mending", "minecraft:vanishing_curse", "extra_enchants:blaze_affinity", "extra_enchants:boosting", "extra_enchants:fireproof", "extra_enchants:steadfast", "soulbound:soulbound", "spellbound:phase_strafe" ] } ] }, { "type": "minecraft:item", "name": "minecraft:leather_chestplate", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:protection", "minecraft:fire_protection", "minecraft:feather_falling", "minecraft:blast_protection", "minecraft:projectile_protection", "minecraft:thorns", "minecraft:binding_curse", "minecraft:unbreaking", "minecraft:mending", "minecraft:vanishing_curse", "extra_enchants:architect", "extra_enchants:berserk", "extra_enchants:fireproof", "gobber2:untouchable", "soulbound:soulbound", "spellbound:attractive", "spellbound:repulsive" ] } ] }, { "type": "minecraft:item", "name": "minecraft:leather_helmet", "functions": [ { "function": "minecraft:enchant_randomly", "enchantments": [ "minecraft:protection", "minecraft:fire_protection", "minecraft:blast_protection", "minecraft:projectile_protection", "minecraft:respiration", "minecraft:aqua_affinity", "minecraft:thorns", "minecraft:binding_curse", "minecraft:unbreaking", "minecraft:mending", "minecraft:vanishing_curse", "betterend:end_veil", "extra_enchants:fireproof", "extra_enchants:psychic", "fabricenchantments:ender_mind", "fabricenchantments:nocturnal", "soulbound:soulbound" ] } ] } ] }, { "rolls": { "min": 1, "max": 16 }, "entries": [ { "type": "minecraft:item", "name": "minecraft:slime_ball" }, { "type": "minecraft:item", "name": "minecraft:spruce_planks", "functions": [ { "function": "minecraft:set_count", "count": { "min": 1, "max": 3 } } ] }, { "type": "minecraft:item", "name": "minecraft:stick", "functions": [ { "function": "minecraft:set_count", "count": { "min": 1, "max": 4 } } ] }, { "type": "minecraft:item", "name": "minecraft:white_wool", "functions": [ { "function": "minecraft:set_count", "count": { "min": 1, "max": 8 } } ] } ] }, { "rolls": { "min": 0, "max": 2 }, "entries": [ { "type": "minecraft:loot_table", "name": "minecraft:chests/pillager_outpost" } ] } ] } ```

You should extract all your mods into a folder then locate all the loot tables using the "enchant_randomly" function (you can get the minecraft vanilla loot tables from the minecraft jar file), then edit all the loot tables manually or with a text replacer. It's pretty tedious but it does the job.

Note: you need to specify a list of enchantments for every item (sword, chestplate, pickaxe, etc). Otherwise you'll be getting sharpness on your boots lol

edit: You need to create a datapack to overwrite the loot tables with the ones you modified. I'm currently using KubeJS cause it's easier but creating a datapack works. Remember that for the datapack/KubeJS-data you need to follow the same folder structure as the one included inside the mod/minecraft's respective jar file

PixelatedBruh commented 3 years ago

Looks like I got some work to do

Tigereye504 commented 3 years ago

Fixed in latest release, adjusting 200+ loot tables will no longer be required.

PixelatedBruh commented 3 years ago

I have been saved.

elhertz commented 3 years ago

Amazing, thanks.

Tigereye504 commented 3 years ago

by the by, be sure to also update hellish materials if you are using it with the latest spellbound version. Flesh Wound and Batet have an undesirable interaction without that update