CraftTweaker

CraftTweaker

151M Downloads

Passing string argument to GameStages failed

Prunoideae opened this issue ยท 1 comments

commented

Issue Description:

I'm trying to use custom functions to wrap up IRecipeAction and IRecipeFunction to make it looks better, but the problem came when I tried to pass string argument to player.hasGameStage and player.addGameStage which provided by GameStages.

What happens:

Type 'crafttweaker/api/player/IPlayer' (current frame, stack[1]) is not assignable to 'java/lang/String'

What you expected to happen:

The string argument should be passed to these two methods correctly like when I use a "" string

Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):

https://pastebin.com/0z7C9C1h

crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):

https://pastebin.com/mrsw4QGw


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2796
  • Crafttweaker: 1.12-4.1.13
  • Using a server: No
  • If yes, does the client have the exact same scripts?

Your most recent log file where the issue was present:

https://pastebin.com/pmEUTCXt

commented

CrT does not support capturing variables.
All variables used inside a function(){ body need to either have been declared inside the function body or they need to be statically accessible.