Integrated Dynamics

Integrated Dynamics

88M Downloads

Using a list of type `integrateddynamics:any` in `Ingr.with_items` generated a error message that crashes the game

shBLOCK opened this issue ยท 6 comments

commented

Issue type:

  • ๐Ÿ› Bug

Steps to reproduce the problem:

  1. Make a list variable of type any, but with itemstacks in it, or it can just be empty. (I'm not sure if list is intended to be able to have type any)
  2. Make an empty ingredients variable
  3. Make a variable card using Ingr.with_items and the aforementioned list and empty ingredients
  4. Try putting the card in a proxy block
  5. Try putting the card in a display panel

About list of type any:
The easiest way of making one is probably using an NBT edit mod to edit a constant variable card?
I'm not sure if a list of type any is intended behavior, if not, I'll make another issue and report how I got one of these through normal operations.

Short description:

(See the "Steps to reproduce" section for context)
The list variable of type any is the key here, with a normal itemstack typed list it works just fine.
The resulting variable in a proxy block or similar shows an empty ERROR in the gui (also shows up in the blockentity NBT as an empty (errors: {collection: []})), but no error is generated.
The resulting variable in a display panel crashes the server when a client has the gui open, with out the gui open you get a The part integrateddynamics:display_panel at position BlockPos{...} was errored and is removed.


Versions:

  • This mod: all latest on CurseForge (Core: 2.9.7; ID: 1.25.0; ITunnels: 1.8.32, ICrafting: 1.1.13)
  • Minecraft: 1.21.1
  • Mod loader version: NeoForge 21.1.93

Log file:

[Server thread/ERROR] [integrateddynamics/]: The part integrateddynamics:display_panel at position BlockPos{x=5, y=67, z=7} was errored and is removed.
com.google.gson.JsonParseException: This value needs to be parsed as component; This value needs to be parsed as component
	at MC-BOOTSTRAP/[email protected]/com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287)
	at TRANSFORMER/[email protected]/net.minecraft.network.chat.Component$Serializer.serialize(Component.java:164)
	at TRANSFORMER/[email protected]/net.minecraft.network.chat.Component$Serializer.toJson(Component.java:170)
	at TRANSFORMER/[email protected]/org.cyclops.cyclopscore.persist.nbt.NBTClassType$15.writePersistedField(NBTClassType.java:389)
	at TRANSFORMER/[email protected]/org.cyclops.cyclopscore.persist.nbt.NBTClassType$15.writePersistedField(NBTClassType.java:385)
	at TRANSFORMER/[email protected]/org.cyclops.cyclopscore.persist.nbt.NBTClassType$CollectionNBTClassType.writePersistedField(NBTClassType.java:657)
	at TRANSFORMER/[email protected]/org.cyclops.cyclopscore.persist.nbt.NBTClassType$CollectionNBTClassType.writePersistedField(NBTClassType.java:640)
	at TRANSFORMER/[email protected]/org.cyclops.cyclopscore.persist.nbt.NBTClassType.writeNbt(NBTClassType.java:496)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase.writeToNBT(PartStateActiveVariableBase.java:156)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.core.part.panel.PartTypePanelVariableDriven$State.writeToNBT(PartTypePanelVariableDriven.java:300)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.api.part.PartTypeAdapter.toNBT(PartTypeAdapter.java:53)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.core.helper.PartHelpers.writePartToNBT(PartHelpers.java:202)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.core.helper.PartHelpers.writePartsToNBT(PartHelpers.java:222)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.capability.partcontainer.PartContainerDefault.serializeNBT(PartContainerDefault.java:208)
	at TRANSFORMER/[email protected]/org.cyclops.integrateddynamics.core.blockentity.BlockEntityMultipartTicking.saveAdditional(BlockEntityMultipartTicking.java:175)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.block.entity.BlockEntity.saveWithoutMetadata(BlockEntity.java:114)
... (rest of call stack not relavant)

The crash log of the aforementioned server crash:
crash-2025-01-09_21.46.14-server.txt

commented

Sure, lists of type any are possible. You can even define this through the LP.

commented

Oh yeah. I never clicked the next button enough times to see it can be Any.

FYI, temporary workaround for this issue is to do a concat of an empty list of type itemstack and the any-typed list to "cast" the list to the itemstack type.

But is there a proper way to cast it into a typed list? Or is this the best way to do it?

commented

No, once a list has been created, there's no way to change the type.
In theory, an operator for that could be created, but that depends if the need for that really exists.

commented

Wow, what a fast response.
Still not sure if a list of type any is intended behavior?
If so, then is there a proper way to cast the type of the list?

commented

Thanks for reporting!

commented

FYI, temporary workaround for this issue is to do a concat of an empty list of type itemstack and the any-typed list to "cast" the list to the itemstack type.