Fabric Shield Lib

Fabric Shield Lib

3M Downloads

FabricShieldLib mixin error for `class_1657` & `class_7923`

otavio-silva opened this issue ยท 38 comments

commented
commented

I found this relating to our library:
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinPreProcessorException: Attach error for fabricshieldlib.mixins.json:PlayerEntityMixin from mod fabricshieldlib during activity: [Transform -> Method disableShieldHead(ZLorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> GETSTATIC -> net/minecraft/class_7923::field_41178:Lnet/minecraft/class_7922;]
So the code causing this is:

 @Inject(at = @At(value = "HEAD"), method = "disableShield(Z)V", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
    private void disableShieldHead(boolean sprinting, CallbackInfo callbackInfo) {
        PlayerEntity player = (PlayerEntity) (Object) this;
        ItemStack activeItemStack = player.getActiveItem();
        Item activeItem = activeItemStack.getItem();

        ShieldDisabledCallback.EVENT.invoker().disable(player, player.getActiveHand(), activeItemStack);

        if (activeItem instanceof FabricShield) {
            FabricShield shield = (FabricShield) activeItem;

            float f = 0.25F + (float) EnchantmentHelper.getEfficiency(player) * 0.05F;
            if (sprinting) {
                f += 0.75F;
            }

            if (player.getRandom().nextFloat() < f) {
                if (!FabricShieldLibConfig.universal_disable){
                    player.getItemCooldownManager().set((Item) shield, shield.getCooldownTicks());
                    player.clearActiveItem();
                    player.world.sendEntityStatus(player, (byte) 30);
                    callbackInfo.cancel();
                } else if (FabricShieldLibConfig.universal_disable){


                    Optional<RegistryEntryList.Named<Item>> opt = Registries.ITEM.getEntryList(ConventionalItemTags.SHIELDS);
                    List<Item> list = new ArrayList<>();
                    if (opt.isPresent()){
                        list = opt.get().stream().map(entry -> entry.value()).toList();
                    }

                    for(int amountOfShields = list.size(); amountOfShields > 0; amountOfShields--) {

                        if (list.get(amountOfShields-1) instanceof ShieldItem){
                            player.getItemCooldownManager().set(Items.SHIELD, 100);
                        } else if(list.get(amountOfShields-1) instanceof FabricShield){
                            player.getItemCooldownManager().set(list.get(amountOfShields-1), ((FabricShield)list.get(amountOfShields-1)).getCooldownTicks());
                        }
                        player.clearActiveItem();
                        player.world.sendEntityStatus(player, (byte) 30);
                    }
                }
            }
        } else if (activeItem instanceof ShieldItem){
            if (FabricShieldLibConfig.universal_disable){


                Optional<RegistryEntryList.Named<Item>> opt = Registries.ITEM.getEntryList(ConventionalItemTags.SHIELDS);
                List<Item> list = new ArrayList<>();
                if (opt.isPresent()){
                    list = opt.get().stream().map(entry -> entry.value()).toList();
                }

                for(int amountOfShields = list.size(); amountOfShields > 0; amountOfShields--) {

                    if (list.get(amountOfShields-1) instanceof ShieldItem){
                        player.getItemCooldownManager().set(Items.SHIELD, 100);
                    } else if(list.get(amountOfShields-1) instanceof FabricShield){
                        player.getItemCooldownManager().set(list.get(amountOfShields-1), ((FabricShield)list.get(amountOfShields-1)).getCooldownTicks());
                    }
                    player.clearActiveItem();
                    player.world.sendEntityStatus(player, (byte) 30);
                }
            }
commented

I am not able to adress this issue right now, as it is exam week for me. @CrimsonDawn45 could you work on this?

commented
commented

Hmmm, I'm not sure what that is... It's saying one of the classes we are trying to inject into doesn't exist? But it definitely does. It's class_1657 Which is PlayerEntity so I'm not sure how to fix this. Now that I'm thinking I think that this is an older issue resurfacing bc I remember having this exact same problem awhile ago... I don't ever remember finding a solution for it.

commented

I'm not sure this will definitely need more looking into

commented

Hi! I'm crashing too https://mclo.gs/o07v21f
If I roll back to 1.6.1 it works fine

commented

Having the same issue. It appears patchouli is mentioned in the log.

VazkiiMods/Patchouli#629

commented

Tried disabling Patchouli, it keeps crashing
https://mclo.gs/K4LCbAb

commented

After a bit of looking around i found the error

    private void getEntryList(PlayerEntity player) {
        Optional<RegistryEntryList.Named<Item>> opt = Registries.ITEM.getEntryList(ConventionalItemTags.SHIELDS);

In here Registries is used, this works all well and good for 1.19.3, but collapses on lower versions (1.19.2, 1.19.1....) since this dosn't exist yet

This issue should be simply reproducable by trying to use 1.19.2 with this mod

commented

I'll try adding a quick version check

commented

Nvm, I think that won't work. We might just have to designate versions 1.6.3 and up for 1.19.3 and up only

commented

Nvm, I think that won't work. We might just have to designate versions 1.6.3 and up for 1.19.3 and up only

I was expecting we where going to have to do that anyway because their where so many changes in 1.19.3.

commented

At least we know what causes the issue when we backport 1.6.1 to previous versions

commented

At least we know what causes the issue when we backport 1.6.1 to previous versions

Wait, wouldn't we be migrating 1.6.3/1.6.4 to previous versions?

commented

Isn't that the one that breaks previous versions?

commented

Idk I guess it would still be called 1.6.3/4 but just remove that code lol

commented

1.6.1 is the latest one which works fine in 1.19.2

commented

Isn't that the one that breaks previous versions?

no but 1.6.2 had important bug fixes, and was the one that updated to 1.19.3, so 1.6.1 has bugs in it

commented

Tried disabling Patchouli, it keeps crashing https://mclo.gs/K4LCbAb

I read more through this crash log and noticed mention of net.minecraft.class_7923

commented

After a bit of looking around i found the error

    private void getEntryList(PlayerEntity player) {
        Optional<RegistryEntryList.Named<Item>> opt = Registries.ITEM.getEntryList(ConventionalItemTags.SHIELDS);

In here Registries is used, this works all well and good for 1.19.3, but collapses on lower versions (1.19.2, 1.19.1....) since this dosn't exist yet

This issue should be simply reproducable by trying to use 1.19.2 with this mod

Yeah, I guess I hadn't properly went though everything until now but class_7923 is the minecraft registry class

commented

I believe this should be fixed with 1.7 but I'll leave this up for awhile just in case someone else needs to report an issue

commented

Could you port a build of this to 1.19.2? I'm stuck dealing with a few mod dev's decisions, unfortunately, in their refusal to port to 1.19.3, and instead, waiting for 1.20.

commented

Once we fix #127 and get 1.7 out of pre-release, then we will backport to 1.19.2 and previous versions.

commented

Any news on this?

commented

@CringeStar Sorry if I'm bugging you, but anything? It's been a few weeks.

commented

Sorry, but I'm not the one working on the full release if 1.7 right now nor do I have the time currently. Maybe @StellarWind22 can help?

commented

@CringeStar Does Stellar have any other contact info?

commented

I plan on working on this, my computer is currently broken. I have ordered the parts to fix it.

commented

Alright

commented

This probably won't be resolved until we figure out #127, as that is the last thing we need to so before we can backport to previous versions.

commented

Anything new here @StellarWind22?

Worst case scenario, I could send someone over to aid in fixing this

commented

@CringeStar @StellarWind22 Have one of you considered finding someone who can help you with this? I lack the knowledge to do so, but I'm sure there is someone who does have the knowledge.

commented

The weekend and a break is coming up, so I will try to fix #127 so that I can finally release 1.7.0, and thatz
when I will backport to 1.19.2 to fix this. If I can't, I will ask on the fabric wiki.

commented

Once #132 is merged, I will release 1.7 and backport it to 1.19.2 and earlier to resolve this.

commented

This issue should be resolved by simply using the 1.7-1.19.2 version of the mod, which will be released later today. Once you have tried it and confirmed the issue no longer happens, please comment on this issue.

commented

The version is now available for download on CurseForge and Modrinth.

commented

I do not believe this issue is present anymore, but I will keep an eye out, just in case, since I'm stomping out incompats with other mods unrelated to this one.

commented

Thanks, I will close this issue.