Skip to content

Commit

Permalink
fix(coremod): fix harmoniclib.apply_bonus_count.run
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Feb 19, 2024
1 parent 7e471b4 commit 40ebaf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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> enchantment, int enchantmentLevel) {
var event = new ApplyLootEnchantmentBonusCountEvent(lootContext, itemStack, enchantment.value(), enchantmentLevel);
BUS.post(event);
return event.getEnchantmentLevel();
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/coremods/apply_bonus_count.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
)
);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 40ebaf8

Please sign in to comment.