Started by
a23709g3
on
Topic category: Help with Minecraft modding (Java Edition)
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?
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.
"if" blocks got different actions but some of them are same for each "if" block (swing hand, play same sound, damage itemstack etc)
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
i mean't multiple "if" with different conditions and some outputs of each "if" is same
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.
only some of their outputs are same