I have a build problem relating to variables! (2020.2)

Started by JAK_the_Cyborg on

Topic category: Help with MCreator software

Joined May 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have a build problem relating to variables! (2020.2)

So in the Minecraft mod I'm making, I switched to 2020.2. I mostly fixed all the conversion issues with the mod, but one big problem I have is dealing with variables. One of my mod elements has a build error and outputs this to the console:

C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:116: error: incompatible types: possible lossy conversion from double to int                

 _setstack.setCount((Item1));
                                  ^
C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:121: error: incompatible types: possible lossy conversion from double to int               

  _setstack.setCount((Item2));
                                  ^
C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:217: error: incompatible types: possible lossy conversion from double to int               

  _setstack.setCount((Item1));
                                  ^
C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:222: error: incompatible types: possible lossy conversion from double to int                

 _setstack.setCount((Item2));
                                  ^
C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:227: error: incompatible types: possible lossy conversion from double to int                

  _setstack.setCount((Item3));
                                  ^
C:\Users\Owner\MCreatorWorkspaces\versions of mods2\the_elven_forest\build\sources\main\java\net\mcreator\the_elven_forest\procedure\ProcedureQuestElfTurnInQuest.java:232: error: incompatible types: possible lossy conversion from double to int                

 _setstack.setCount((Item4));
                                  ^

I am unsure of why the program thinks it is incorrect, as in a previous version of the mod it was working fine. I believe the arrows are pointing to the space bars. To be clear, the mod element I'm working with is unlocked and within the default editor. If anyone knows how to fix this, let me know! =)

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm... This does seem to be…
Thu, 06/25/2020 - 05:59

Hmm... This does seem to be a glitch with MCreator. I'm assuming that "Item1 - Item4" are local variables? The problem here is that number variables are saved as "double" variables (meaning they can have a decimal point (i.e 2.5 or 3.1 or something)), but when you are trying to set the number of items in the itemstack, it requires an "integer" variable (whole numbers only).

I really think it's time that MCreator lets you choose between Double and Integer variables when making a local variable.

So, what does this mean for you? I don't know, honestly. Perhaps try using the "round" block to round your variables to the nearest whole number?

Joined May 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for the info! However…
Wed, 07/01/2020 - 13:45

Thanks for the info! However, I made a workaround where I used items instead of variables for this. Thx =)

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think I had a similar…
Wed, 07/01/2020 - 15:19

I think I had a similar issue, simply removing the variables from the procedure then re-adding them should fix it