Curios API (Forge/NeoForge)

Curios API (Forge/NeoForge)

140M Downloads

[Bug] Curio Crashes when you have null NBT for ItemStacks

Speiger opened this issue ยท 1 comments

commented

Forge. Current Source Code.

https://github.com/TheIllusiveC4/Curios/blob/1.16.x-forge/src/main/java/top/theillusivec4/curios/common/event/CuriosEventHandler.java#L512

This function crashes if someone implements a curio and doesn't put in "null" protection in writeSyncData.
ItemStacks are known to have "null" NBTTags which should be supported by curio and not require that you Validate that mcs ItemStacks NBT is not null. Would be nice if you could fix that.

Steps to reproduce:
Write a Curio that is always sync-able and use a item that can have a null NBTTag and get it to have a null as NBT.

Why it happens:
LazyOptional.map sadly does not allow to have null objects to be returned.

And people would assume (Happened to me) that writeSyncData could just copy the way mc handles it and just link to "getSharedTag" and that's it. The moment your NBT is null you get kicked from a server with a crash that curio is bugged out.

(I fixed it on my side but still this should be at least Documented so people know does not support null or fix it that null NBT is supported)

commented

Thanks.