diff --git a/src/main/java/org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.java b/src/main/java/org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.java index 9731c82..8576c3f 100644 --- a/src/main/java/org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.java +++ b/src/main/java/org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.java @@ -19,6 +19,7 @@ package org.auioc.mcmod.harmoniclib.event; +import net.minecraft.core.Holder; import net.minecraft.world.entity.animal.Cat; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -37,8 +38,8 @@ public final class HLServerEventFactory { /** * FMLCoreMod: harmoniclib.apply_bonus_count.run */ - public static int onApplyLootEnchantmentBonusCount(LootContext lootContext, ItemStack itemStack, Enchantment enchantment, int enchantmentLevel) { - var event = new ApplyLootEnchantmentBonusCountEvent(lootContext, itemStack, enchantment, enchantmentLevel); + public static int onApplyLootEnchantmentBonusCount(LootContext lootContext, ItemStack itemStack, Holder enchantment, int enchantmentLevel) { + var event = new ApplyLootEnchantmentBonusCountEvent(lootContext, itemStack, enchantment.value(), enchantmentLevel); BUS.post(event); return event.getEnchantmentLevel(); } diff --git a/src/main/resources/coremods/apply_bonus_count.run.js b/src/main/resources/coremods/apply_bonus_count.run.js index f292858..a0f658f 100644 --- a/src/main/resources/coremods/apply_bonus_count.run.js +++ b/src/main/resources/coremods/apply_bonus_count.run.js @@ -28,7 +28,7 @@ function initializeCoreMod() { Opcodes.GETFIELD, 'net/minecraft/world/level/storage/loot/functions/ApplyBonusCount', 'enchantment', - 'Lnet/minecraft/world/item/enchantment/Enchantment;' + 'Lnet/minecraft/core/Holder;' ) ); toInject.add(new VarInsnNode(Opcodes.ILOAD, 4)); @@ -37,7 +37,7 @@ function initializeCoreMod() { Opcodes.INVOKESTATIC, 'org/auioc/mcmod/harmoniclib/event/HLServerEventFactory', 'onApplyLootEnchantmentBonusCount', - '(Lnet/minecraft/world/level/storage/loot/LootContext;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/enchantment/Enchantment;I)I', + '(Lnet/minecraft/world/level/storage/loot/LootContext;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/Holder;I)I', false ) ); @@ -91,7 +91,7 @@ function initializeCoreMod() { + ALOAD 0 + GETFIELD net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.enchantment : Lnet/minecraft/world/item/enchantment/Enchantment; + ILOAD 4 -+ INVOKESTATIC org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.onApplyLootEnchantmentBonusCount (Lnet/minecraft/world/level/storage/loot/LootContext;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/enchantment/Enchantment;I)I ++ INVOKESTATIC org/auioc/mcmod/harmoniclib/event/HLServerEventFactory.onApplyLootEnchantmentBonusCount (Lnet/minecraft/world/level/storage/loot/LootContext;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/Holder;I)I + ISTORE 4 ALOAD 0 GETFIELD net/minecraft/world/level/storage/loot/functions/ApplyBonusCount.formula : Lnet/minecraft/world/level/storage/loot/functions/ApplyBonusCount$Formula;