Code snippets for Custom Triggers

Started by dimondking2016 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Code snippets for Custom Triggers
Wed, 01/04/2023 - 10:11 (edited)

I noticed that you can't use custom code snippets as the trigger but you can call other procedures using custom code snippets.

Is there a way without locking my code to edit it to have custom triggers?

 

A trigger normally in code looks like this.

public static void execute(LevelAccessor world, double x, double y, double z) {

This is what I want to do.

public static void execute(LevelAccessor world, double x, double y, double z, double tx, double ty, double tz) {

 

Called the procedure I can do, it seems quite simple with custom code snippets, swapping out the call procedure block with a code snippet.

EventProcedure.execute(world, x, y, z);

Code snippet to call the procedure.

EventProcedure.execute(world, x, y, z, tx, ty, tz);

 

EDIT: To anyone who is finding this now: use the dependency blocks found in the advanced section. Also, stop programming at 2 am because that is the only reason you're having this issue. 

Edited by dimondking2016 on Wed, 01/04/2023 - 10:11
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This could be implemented by…
Tue, 12/27/2022 - 02:05

This could be implemented by having additional arguments addable to the call procedure block.

And additional arguments addable to the existing Event Trigger or a new event trigger in advanced that can have additional arguments.

 

Also, looking at the code what is the point of having call procedure vs called procedure at x y z? In code, they are the exact same.

You can add new custom…
Tue, 12/27/2022 - 09:14

You can add new custom dependencies by putting a custom dependency block in the procedure, not sure if that would help in this case fully, though.

Also, looking at the code what is the point of having call procedure vs called procedure at x y z? In code, they are the exact same.

At x y z procedure variant, you can swap out x y z for a custom location

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where are the custom…
Wed, 01/04/2023 - 10:09

Where are the custom dependency blocks?

Also, I think this isn't what I'm going for anyway... *checked one last time and found block* this is exactly what I was looking for and my 2 am brain couldn't comprehend that. Thank you very much!

 

Oh yea, that was my 2 am brain being a little silly. Thanks.

At x y z procedure variant, you can swap out x y z for a custom location