CraftTweaker

CraftTweaker

151M Downloads

1.21 (NeoForge): NPE using a Tooltip Function

kindlich opened this issue ยท 0 comments

commented

Issue description

Orignal Discord Discussion: https://canary.discord.com/channels/136877912698650625/1253211465645686824/1254212984348082288

It seems like the Game can crash when applying Tooltip functions.

Steps to reproduce

From the discord convo it seems that this happened for one itemStack, but e.g. diamonds were fine.

Script used

<item:minecraft:diamond>.modifyTooltip((stack, tooltip, context, flag) => {
    tooltip.insert(1, Component.literal("Your game will crash"));
});

The crafttweaker.log file

N/A

Minecraft version

1.21

Modloader

NeoForge

Modloader version

neoforge-21.0.21-beta

CraftTweaker version

CraftTweaker-neoforge-1.21-20.0.4.jar

Other relevant information

The NPE seems to originate here:

Services.CLIENT.getTooltips().get(ingredient).forEach(function -> {

The get(..) returns null for whatever reason, was the used ItemStack not implementing hashcode/equals properly?

The latest.log file

https://paste.bot.blamejared.com/136877912698650625/1253211465645686824/1254215026479337482/latest.log