SamsTheNerd / inline

A minecraft mod for rendering in line with text
GNU Lesser General Public License v3.0
4 stars 0 forks source link

Support for glowing items #1

Closed u9g closed 2 months ago

u9g commented 2 months ago

Hi, first of all this is a super cool mod, Thanks for making it!

but it seems like a small change of making the item matcher show an item with a glint hard crashes the mod.

        InlineClientAPI.INSTANCE.addMatcher(new RegexMatcher.Simple("<item:([a-z:\\/_]+)>", itemMatcherID, (MatchResult mr) ->{
            Item item = Registries.ITEM.get(new Identifier(mr.group(1)));
            if(item == null) return null;
            ItemStack stack = new ItemStack(item);
            stack.addEnchantment(Enchantments.FORTUNE, 3);
            HoverEvent he = new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ItemStackContent(stack));
            return new DataMatch(new ItemInlineData(stack), Style.EMPTY.withHoverEvent(he));
        }, MatcherInfo.fromId(itemMatcherID)));

This code for example adds fortune 3 to the item, but the glint rendering code seems to break something and the entire mod crashes, so I'd appreciate if support for that could be added.