Fix custom ore drops and tool enchantability for 1.21
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
}
|
||||
+20
-16
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user