Code block causes compilation errors (bug report)

Started by CupcakesForAngels on

Topic category: Troubleshooting, bugs, and solutions

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Code block causes compilation errors (bug report)

I didn't see a proper bug report section so I thought I'd throw this here. 

 

If you make a code block like this the block will fail to compile:

It seems to work with most instances of using a null entity.

 

This is how it generates the code: (ignore the 'test' double)

I'm new to coding for Minecraft but even I can see the issue here. 'null' is never going to be an instance of LivingEntity, and trying to check if it is causes the error.
 

The simple solution is to change it like so:

Maybe there is an over all better and more correct way to do this sort of thing, but either way it seems like you want to avoid throwing compilation errors at a user when they use code blocks.