How to pass values ​​when executing other procedures within a procedure

Started by Ayunoshioyak1 on

Topic category: Help with MCreator software

Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to pass values ​​when executing other procedures within a procedure

I'm working on a feature where energy consumption values vary depending on the skill being used. I want to manage these values in a centralized way so that they can be accessed from various parts of the code. However, I want to avoid using global variables as they can make the code harder to read.

Ideally, I’d like to encapsulate this in a Java class so that it can’t be modified externally. My goal is to pass a value and receive the corresponding energy consumption value in return. I also need to retrieve these values within different procedures. However, I’m unsure how to pass values to a procedure in Mcreator, as I will be using this in many different contexts (like for items and entities), so declaring specific variables for each use case might not be feasible.

Could someone guide me on how to structure the procedure or class to achieve this? Any advice would be appreciated!

Thanks in advance!