performance procedure question

Started by a23709g3 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
performance procedure question

a procedure that has several if blocks, and they have some actions repeat, in that case is making new logic variable for those actions gonna perform better?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would say put an image of…
Thu, 10/09/2025 - 18:46

I would say put an image of your procedure. You mean make local variables? If that reduces your block code then it may improve performance.

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"if" blocks got different…
Thu, 10/09/2025 - 20:06

"if" blocks got different actions but some of them are same for each "if" block (swing hand, play same sound, damage itemstack etc)

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You mean you have multiple…
Fri, 10/10/2025 - 18:36

You mean you have multiple if clauses with the same conditions but they all have different outputs? Or the same triggers? So you're asking if you can put all of them into a single if clause and whether that will reduce performance?

I don't get how variables come into play, unless you mean an if triggers on multiple conditions and rather than check for all 3 you make another procedure to toggle a variable when any of the 3 are triggered (which is just doing the same thing), thereby triggering the if clause? If that's the case then that's just making the workspace look nicer it's not providing any benefits

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i mean't multiple "if" with…
Fri, 10/10/2025 - 19:15

i mean't multiple "if" with different conditions and some outputs of each "if" is same

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So you have multiple 'if'…
Fri, 10/10/2025 - 20:18

So you have multiple 'if' statements which have the same output. So you can just put them all into one if clause. Use AND blocks and XOR and OR respectively, depends on the specific conditions. If they are all independent of each other then just use basic OR.

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
only some of their outputs…
Sat, 10/11/2025 - 04:55

only some of their outputs are same