ds58/Panilla

Different ways to use #120 (crash when breaking a furnace)

Zailer43 opened this issue · 0 comments

Description

Crash #120 was fixed, but in a very hard-coded way without considering what might happen with other blocks. Currently, in 1.20, it doesn't crash but shows a stack trace in the logs. I haven't tested it in 1.18.2 where it was originally reported, but it's possible that it might crash there.

// /give @p furnace{BlockEntityTag:{RecipesUsed:{"minecraft:bow":1}}} 1
// Breaking this furnace in the world will cause a client crash
// https://github.com/ds58/Panilla/issues/120
if (blockEntityTag.hasKey("RecipesUsed")) {
INbtTagCompound recipesUsed = blockEntityTag.getCompound("RecipesUsed");
if (recipesUsed.hasKeyOfType("minecraft:bow", NbtDataType.INT)) {
return NbtCheckResult.CRITICAL;
}
}

NBT

/give @p furnace{BlockEntityTag:{RecipesUsed:{"minecraft:note_block":1}}}