CraftTweaker

CraftTweaker

151M Downloads

[1.16.5] Class HashMap does not implement the requested interface IData

ZigTheHedge opened this issue ยท 3 comments

commented

Issue description

Trying to cast IData, received from casting IItemStack.tag to MapData (I used getId() to ensure it is of type 10). When trying to do anything with this object, I'm getting this crash.

Steps to reproduce

No response

Script used

https://pastebin.com/3gmBnKF9

The crafttweaker.log file

https://pastebin.com/t2kgsGiD

Minecraft version

1.16

Forge version

36.1.32

CraftTweaker version

7.1.0.366

Other relevant information

No response

The latest.log file

https://gist.github.com/ZigTheHedge/cf1d728db50a16c843c7bf2825f5c10f

commented

I don't think the script you gave us compiles.

Oh, sorry, too much Ctrl+Z's :) It was

var newTag as MapData = inputs[1][1].tag.asMap();

That should be

Thanks! I'll try that out!

commented

I don't think the script you gave us compiles.

But over here:

var newTag MapData = inputs[1][1].tag.asMap();

That should be

var newTag = inputs[1][1].tag as MapData;

Doing asMap turns it into a Map/HashMap, which is different than MapData.

commented

Yep, everything works! Thank you and sorry for bothering!