Executable code at specified coordinates - Simplified

Started by CEntertain on

Topic category: Feature requests and ideas for MCreator

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Executable code at specified coordinates - Simplified

Hey, I'm opening this request not because I feel like it might be necessary as there are always workarounds to do this, but I feel like it would simplify the workflow and offer more ways to optimize code made with the code blocks.

Essentially, I feel like it would be nice to have a block in the "World Management" section that is called something like "At X Y Z do..."
The reason why I feel this is useful is simple. Of course, you can achieve the same by summoning an entity at certain coordinates with a special name and have it execute code. Or you can use the "Call Procedure [] at X Y Z" block to do the same, but I feel like having a solution that has no need for in world modifications and something you can just do inside of a procedure without the need to create a new one would do MCreator good. It would simplify things a bit more, and there is no need to complicate your workspace more, because every procedure you create increases build time, and decreases performance, as every procedure that's called has to be with its own class and method system, instead of just being a method inside an already existing procedure.

But I wanna hear your opinion about it.
Do you think it would be useful? And if not, feel free to comment why not, or what I missed.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
'at procedure' block…
Tue, 08/01/2023 - 07:48

'at procedure' block executes method with coordinates as arguments. I don't know how exactly this new block could work from java code perspective (probably it'd create a lambda expression <anonymous method> and pass new coordinates as arguments). 

From what I know, creating many classes doesn't affect program's performance itself, it affects class loader but it's ran only once on the first time you create an object of that class or use a static method, however many classes might take more memory. 

Between normal methods and lambda expressions there's no significant difference in performance, to prefer one. Choosing which to use is most often based on what method is supposed to do and code readability. 

Keep in mind that optimization should always be based on actual performance measurements, not guesses.

How about using local variables for different coordinates instead, or, if you want to use that algorithm in other procedures as well, create separate procedure for it? 

I think it'd be cool to have a function system that would add possibility to create multiple methods in one class (addionaly each with global trigger), but I'm afraid from how mcreator is created, i think it might be hard to implement.