Reagenchant

Reagenchant

19.5k Downloads

[1.14.4] Client side crash when enchanted modded chestplate with obsidian in the slot

noobanidus opened this issue ยท 10 comments

commented

Lag caused me to remove the item and put it back in a couple of times, and then I crashed with this crash on a Multiplayer server.

commented

I am unable to reproduce the issue. Which mod is the chestplate from?

commented

The chestplate was from Mystical World, sorry. I believe it was either a copper chestplate or an amethyst chestplate.

commented

I've tested again and I am still unable to reproduce the issue. Does it occur every time or is it random? Would you mind testing with only LibraryEx, Reagenchant, and Mystical World?

commented

Certainly can try! Can't guarantee it will be today, but it's on my list.

commented

Are you using a modpack? If so, which one?

Edit: I am assuming you're using the OpenDevCraft modpack?

commented

Yes, sorry. I've just added it to my local version (most recent version that I'm working on releasing) and, as it was a client-side crash, it doesn't appear to do so. I'll try to get a local server running and test it, but it was potentially a one-off or a temporary bad interaction with some other mod.

commented

So, I can't replicate it, however I have identified what the issue was, and it has the potential to crop up again, although as it's hidden behind a else if(!this.minecraft.player.abilities.isCreativeMode) check, testing it in a creative mode world is going to result in nothing.

ReagentTableScreen.java:277-281

                        if(!reagentStack.isEmpty())
                        {
                            Reagent reagent = Reagenchant.REAGENT_MANAGER.getReagent(reagentStack.getItem());

                            if(reagent.getEnchantments().contains(enchantment))

There doesn't appear to be any previous checks, and as getReagent is actually @Nullable (because the default return value when a value is not contained within the map is null), reagent can be null and thus the reagent.getEnchantments() call can produce a null pointer exception.

I'd recommend:

                        if(!reagentStack.isEmpty())
                        {
                            Reagent reagent = Reagenchant.REAGENT_MANAGER.getReagent(reagentStack.getItem());

                            if(reagent != null && reagent.getEnchantments().contains(enchantment))
commented

Thanks for finding the issue. I'll get a fix out soon.

commented

Awesome, thanks! Just waiting on a new release for this in order to update the OpenDevCraft 7 pack.

commented

The fix is in testing and it should be out soon if there are no issues.