Fabric Shield Lib

Fabric Shield Lib

3M Downloads

Migrate to BuiltInItem renderer registry & remove RenderMixin.

Luligabi1 opened this issue · 21 comments

commented

Registering the model predicate for the banner shield's blocking is causing issues with some items' animations, such as bows and in some cases, crashes.

Bow issue: Luligabi1/MagicFungi#51

Crash issue (see responses): LXGaming/NorthernCompass#6

commented

@CrimsonDawn45

commented

I haven't had time lately to work on this library as I have a full time job now & my PC was dead for awhile. It'll take me a bit to get my development environment all set back up, but hopefully I can fix some of these bugs.

commented

Sorry I know it has been a long time, but I finally have time to work on this stuff again. If this still occurs please update me.

Can confirm it still happens on v1.6.0-1.19.

commented

Sorry I know it has been a long time, but I finally have time to work on this stuff again. If this still occurs please update me.

commented

Can you confirm if this still occurs in v1.6.1-lite-1.19?

commented

Well the only thing different with 1.6.0 and 1.6.1-lite is the removal of FabricASM which was causing a number of bugs while allowing the enchanting features to work fully. So I'm not sure there is a possibility removing it fixed this problem it is also likely the mixin this mod does for shield rendering is interfering with bow animations for this mod.

commented

I'll have to look through the BuiltInItemRenderer class again to see how the render methos is structured and I will go from there.

commented

Can you confirm if this still occurs in v1.6.1-lite-1.19?

Hey, sorry for the delay, been busy with college finals. I can confirm this tomorrow, but as Crimson said, it's unlikely :/

commented

it is also likely the mixin this mod does for shield rendering is interfering with bow animations for this mod.

It most likely isn't. I just looked through the injected class again and there is no reference to bows in there.

commented

It most likely isn't. I just looked through the injected class again and there is no reference to bows in there.

Iirc it affects every kind of model predicate, in vanilla I think the only items that use them are bows, compasses and clocks. The issue expands a lot on modded since a lot more items use them one way or another

commented

Iirc it affects every kind of model predicate, in vanilla I think the only items that use them are bows, compasses and clocks

Those aren't referenced either, I'll have a look at how bows, clocks, and compasses are rendered.

commented

Iirc it affects every kind of model predicate, in vanilla I think the only items that use them are bows, compasses and clocks

Those aren't referenced either, I'll have a look at how bows, clocks, and compasses are rendered.

Yeah, the thing in common with these items is the use of model predicates to render different states. Those are defined on the item's model json. For example, here's an excerpt from the bow's item model:

    "overrides": [
        {
            "predicate": {
                "pulling": 1
            },
            "model": "item/bow_pulling_0"
        },
        {
            "predicate": {
                "pulling": 1,
                "pull": 0.65
            },
            "model": "item/bow_pulling_1"
        },
        {
            "predicate": {
                "pulling": 1,
                "pull": 0.9
            },
            "model": "item/bow_pulling_2"
        }
    ]

Using Fabric Shield Lib, the predicate never is triggered, so the bow stays in its default model regardless of the pulling progress. I'm not too familiar with model predicates on the code side, but Fabric's wiki seems to have a starting ground here: https://fabricmc.net/wiki/tutorial:model_predicate_providers

commented

Yeah there is a newer way of handling model predicates that I think doesn't require mixing into the renderer class.

commented

I never actually figured out how to get that working as shieldLib existed before the new fabric api for rendering items did.

commented

Can you confirm if this still occurs in v1.6.1-lite-1.19?

As expected, it still does :/

commented

This will probably be fixed whenever we switch to the newer builtInItemRenderer registry with fabric... Which I need to figure out how to do lol

commented

https://github.com/FabricMC/fabric/blob/1.19.3/fabric-item-api-v1/src/client/java/net/fabricmc/fabric/mixin/item/client/HeldItemRendererMixin.java I think this is the mixin that handles that? So it might be a simple as setting a boolean in the shield class.

commented

I don't know this will need to be looked into further

commented

https://gist.github.com/Sunconure11/bfa2a5ed625e43986fe3ac81632b6311

Is this related, by any chance? I thought I filed a crash report here for... something.

commented

https://gist.github.com/Sunconure11/bfa2a5ed625e43986fe3ac81632b6311

Is this related, by any chance? I thought I filed a crash report here for... something.

This is #122 sorry the issue was renamed to be better labelled.