Integrated Dynamics

Integrated Dynamics

63M Downloads

ValueObjectTypeItemStack$ValueItemStack cannot be cast to ValueTypeOperator$ValueOperator

almightyju opened this issue ยท 4 comments

commented

So I'm trying to get my head around operators and pipes etc and managed to crash the game, most likely because I've done something wrong again. I've managed to reproduce and get a more minimal save before and after. A download link is at https://drive.google.com/file/d/1lQv8nBb2anocc39UderPfob_CXLl0LmL/view?usp=sharing

This is for version 1.12.2 and the Working save has a single operator called item0WithSize0 which if you put in the display will crash the game.

Essentially I have (I think, still getting confused), is a list of items from an inventory reader, get the first item, pipe that item into apply(0, flip(with_size))

Full trace is

java.lang.ClassCastException: org.cyclops.integrateddynamics.core.evaluate.variable.ValueObjectTypeItemStack$ValueItemStack cannot be cast to org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypeOperator$ValueOperator
	at org.cyclops.integrateddynamics.core.evaluate.OperatorBuilders.lambda$static$10(OperatorBuilders.java:237) ~[OperatorBuilders.class:?]
	at org.cyclops.integrateddynamics.core.evaluate.operator.IterativeFunction.evaluate(IterativeFunction.java:28) ~[IterativeFunction.class:?]
	at org.cyclops.integrateddynamics.core.evaluate.operator.OperatorBase.evaluate(OperatorBase.java:148) ~[OperatorBase.class:?]
	at org.cyclops.integrateddynamics.core.evaluate.expression.LazyExpression.evaluate(LazyExpression.java:41) ~[LazyExpression.class:?]
	at org.cyclops.integrateddynamics.core.evaluate.expression.LazyExpression.getValue(LazyExpression.java:63) ~[LazyExpression.class:?]
	at org.cyclops.integrateddynamics.core.part.panel.PartTypePanelVariableDriven.update(PartTypePanelVariableDriven.java:127) ~[PartTypePanelVariableDriven.class:?]
	at org.cyclops.integrateddynamics.core.part.panel.PartTypePanelVariableDriven.update(PartTypePanelVariableDriven.java:57) ~[PartTypePanelVariableDriven.class:?]
	at org.cyclops.integrateddynamics.core.network.PartNetworkElement.update(PartNetworkElement.java:135) ~[PartNetworkElement.class:?]
	at org.cyclops.integrateddynamics.core.network.Network.update(Network.java:410) ~[Network.class:?]
	at org.cyclops.integrateddynamics.core.TickHandler.onTick(TickHandler.java:65) ~[TickHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1251_TickHandler_onTick_TickEvent.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:266) ~[FMLCommonHandler.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:712) ~[MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:279) ~[chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
commented

Could you fill in the proper issue template please?

commented

Dont see how it will help more than the save with the exact issue and the exact step to break it but sure:

Issue type:

  • ๐Ÿ› Bug

Short description:

The game crashses from putting a pipe(getItemOp, setSize(item) op) variable into a display

Steps to reproduce the problem:

There's really difficult to remember the exact steps but I think it was something like below (really just download the save since it has all the variable cards done which cause this exact issue)

  1. inventory reader items-> chestItems
  2. proxy chestItems -> inventoryItems
  3. uniq(inventoryItems) -> uniq(inventoryItems)
  4. operator(isNotNull) -> isNotNull(x)
  5. filter(isNotNull(x), uniq(inventoryItems) -> uniqueItemsInChest
  6. Integer 0 -> 0
  7. operator(list get) -> listGet
  8. operator(withSize) -> withSize(item, int) (got the name wrong in the save i just noticed, id:20)
  9. flip(withSize(item, int)) -> withSize(int,item)
  10. apply(withSize(int,item), 0) -> withSize0
  11. apply2(listGet, uniqueItemsInChest, 0) -> item0
  12. pipe(item0, withSize0) -> item0WithSize0
  13. put item0WithSize0 in display

Expected behaviour:

It not to crash, I was expecting to get the first item in the list (chest:64) with a size of 0.


Versions:

  • CommonCApabilities: 2.4.5
  • CyclopsCore 1.6.1
  • IntegratedDynamics 1.1.2
  • integrated tunnels 1.6.7
  • jei 4.15.0.289
  • optifine 1.12.2
  • Minecraft: 1.12.2
  • Forge: 14.23.5.2847

Log file:

https://pastebin.com/gxE4M2vi

Pastebin
commented

Thanks!

commented

So I've worked out what causes this, it's because on this line:

IOperator first = getSafeOperator(input.getValue(0), secondInputType);

input.getValue(0) is of type ValueObjectTypeItemStack.ValueItemStack and the secondInputType is the same type so it passes input checks, but getSafeOperator expects a value operator so the cast happens and fails and the only exception handling on the stack is for an eval exception.

I've fixed this locally by doing some crazy stuff that's not right at all by adding an operator that simply has a fixed value to pass into the getSafeOperator but this then serialises the output of the operator that got evaluated to the ValueItemStack and not the operator itself which should be serialised.

Hope that helps but at least I got my save back working in the mean time.