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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,9 +14,10 @@
|
|||||||
"term": {
|
"term": {
|
||||||
"condition": "minecraft:match_tool",
|
"condition": "minecraft:match_tool",
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"enchantments": [
|
"sub_predicates": {
|
||||||
|
"minecraft:enchantments": [
|
||||||
{
|
{
|
||||||
"enchantment": "minecraft:silk_touch",
|
"enchantments": "minecraft:silk_touch",
|
||||||
"levels": {
|
"levels": {
|
||||||
"min": 1
|
"min": 1
|
||||||
}
|
}
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"functions": [
|
"functions": [
|
||||||
{
|
{
|
||||||
@@ -48,15 +50,16 @@
|
|||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"type": "minecraft:item",
|
"type": "minecraft:item",
|
||||||
"name": "minecraft:coal_ore",
|
"name": "custom_ore_gen:concentratedcoalore",
|
||||||
"weight": 1,
|
"weight": 1,
|
||||||
"conditions": [
|
"conditions": [
|
||||||
{
|
{
|
||||||
"condition": "minecraft:match_tool",
|
"condition": "minecraft:match_tool",
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"enchantments": [
|
"sub_predicates": {
|
||||||
|
"minecraft:enchantments": [
|
||||||
{
|
{
|
||||||
"enchantment": "minecraft:silk_touch",
|
"enchantments": "minecraft:silk_touch",
|
||||||
"levels": {
|
"levels": {
|
||||||
"min": 1
|
"min": 1
|
||||||
}
|
}
|
||||||
@@ -64,6 +67,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"functions": [
|
"functions": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user