Lib Block Attributes

Lib Block Attributes

853k Downloads

java.lang.IllegalStateException: The ItemStack that is stored has been changed! Made the game crash once and don't know how to reproduce it

natanfudge opened this issue · 5 comments

commented

This happened when creating a new instance of a block entity that is an inventory provider.
https://hasteb.in/woxupaqa.yaml

commented

spatialcrafting.hologram.HologramBlock.activate(HologramBlock.kt:104)

However when I look at the source:

100 | hologramEntity.insertItem(player.getStackInHand(hand)) // is it crashing here?
101 | if (!player.isCreative) player.getStackInHand(hand).count--
102 |  logDebug {
103 |   "Inserted item into hologram. New Content: " + hologramEntity.getItem()
104 |  } // When it ways it's crashing here?
105 | }

Do you know what version of the source this crash report was generated with?

Also, in the title you said it crashed once - has this happened multiple times, or are you just not sure how to make it happen again? (Or are there any other reproduction steps needed to make this happen?)

commented

Do you know what version of the source this crash report was generated with?

it had not been pushed yet. I will push it tomorrow.

Also, in the title you said it crashed once - has this happened multiple times, or are you just not sure how to make it happen again? (Or are there any other reproduction steps needed to make this happen?)

The error occured exactly once, during a common operation, seemingly for no reason. It occured when a HologramBlockEntity which is an inventory provider was created as part of a multiblock in my mod.

commented

Looking at the stack trace it seems that maybe I had accidentally inserted an item as the hologram was created (which still shouldn’t crash). What does the error you throw here mean about the situation?

commented

The first stack trace is the exception that was actually thrown (and crashed the game).

The second stack trace was the first call stack that marked that item stack instance to be "unmodifiable".

(This basically tracks item stack instances to determine if one has been added to an inventory, and then changed without telling the inventory that it should be changed).