Better Combat [Fabric & Forge]

Better Combat [Fabric & Forge]

21M Downloads

LevelZ mod

ZsoltMolnarrr opened this issue ยท 1 comments

commented
commented

Looks like there is a @Redirect in BetterCombat that is conflicting with a @ModifyVariable in LevelZ. Because of the @Redirect, the target that LevelZ is trying to get to isn't there anymore, so it crashes.

The code in question is as follows:
-- Better Combat --
PlayerEntityInject#replaceSword

@Redirect(method = "attack(Lnet/minecraft/entity/Entity;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
    public Item replaceSword(ItemStack instance) {
        if (WeaponRegistry.getAttributes(instance) != null) {
            return Items.AIR;
        } else {
            return instance.getItem();
        }
    }

-- LevelZ --
PlayerEntityMixin#attackMixin

@ModifyVariable(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"), ordinal = 2, require = 0)
    private boolean attackMixin(boolean original) {
        if (playerEntity.world.random.nextFloat() < (float) playerStatsManager.getLevel("luck") * ConfigInit.CONFIG.luckCritBonus) {
            isCrit = true;
            return true;
        } else
            isCrit = false;
        return original;
    }