diff --git a/src/main/java/net/mcreator/customoregen/event/EnchantabilityFix.java b/src/main/java/net/mcreator/customoregen/event/EnchantabilityFix.java new file mode 100644 index 000000000..98a84ebd1 --- /dev/null +++ b/src/main/java/net/mcreator/customoregen/event/EnchantabilityFix.java @@ -0,0 +1,28 @@ +package net.mcreator.customoregen.event; + +import net.mcreator.customoregen.CustomOreGenMod; +import net.mcreator.customoregen.init.CustomOreGenModItems; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.enchantment.Enchantable; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.ModifyDefaultComponentsEvent; + +@Mod.EventBusSubscriber(modid = CustomOreGenMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class EnchantabilityFix { + + @SubscribeEvent + public static void modifyComponents(ModifyDefaultComponentsEvent event) { + // Tools - Value 9 + event.modify(CustomOreGenModItems.SHARDDIAMONDPICKAXE.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(9))); + event.modify(CustomOreGenModItems.SHARDDIAMONDSHOVEL.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(9))); + event.modify(CustomOreGenModItems.SHARDDIAMONDAXE.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(9))); + event.modify(CustomOreGenModItems.SHARDDIAMONDPAXEL.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(9))); + + // Armor - Value 14 + event.modify(CustomOreGenModItems.SHARDDIAMONDHELMET.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(14))); + event.modify(CustomOreGenModItems.SHARDDIAMONDCHESTPLATE.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(14))); + event.modify(CustomOreGenModItems.SHARDDIAMONDLEGGINGS.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(14))); + event.modify(CustomOreGenModItems.SHARDDIAMONDBOOTS.get(), builder -> builder.set(DataComponents.ENCHANTABLE, new Enchantable(14))); + } +} diff --git a/src/main/resources/data/custom_ore_gen/loot_tables/blocks/concentratedcoalore.json b/src/main/resources/data/custom_ore_gen/loot_tables/blocks/concentratedcoalore.json index 2b170dd1e..07042261a 100644 --- a/src/main/resources/data/custom_ore_gen/loot_tables/blocks/concentratedcoalore.json +++ b/src/main/resources/data/custom_ore_gen/loot_tables/blocks/concentratedcoalore.json @@ -14,14 +14,16 @@ "term": { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "sub_predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } } @@ -48,20 +50,22 @@ "entries": [ { "type": "minecraft:item", - "name": "minecraft:coal_ore", + "name": "custom_ore_gen:concentratedcoalore", "weight": 1, "conditions": [ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "sub_predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ], @@ -79,4 +83,4 @@ } ], "random_sequence": "custom_ore_gen:blocks/concentratedcoalore" -} \ No newline at end of file +}