Skip to content

@Redirect in HeldItemRenderer conflicts with other mods #119

@RobertSkalko

Description

@RobertSkalko

I just found out my age of exile fabric mod redirects the same class as your mod in: https://github.com/OroArmor/Netherite-Plus-Mod/blob/26f8f86a5dce77a108b3698ffc96bf36ffe6cdcd/forge/src/main/java/com/oroarmor/multi_item_lib/mixin/render/HeldItemRendererMixin.java

We seem to both use it to render our bows. Mixin crashes if 2 mods use redirects on same method and require it.

I asked around on fabric discord and llama recommended me to use this instead:

`@Mixin(HeldItemRenderer.class)
public class HeldItemRendererMixin {

@ModifyVariable(
    method = "renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;Lnet/minecraft/client/network/ClientPlayerEntity;I)V",
    at = @At(value = "STORE", ordinal = 0),
    ordinal = 0
)
private ItemStack modifyStack(ItemStack original) {
    return original.getItem() == Items.CARROT ? new ItemStack(Items.BOW) : original;
}

}`

You can use it too if you want, in case some other mod is also adding custom bows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions