Is it better to store data for a modular system in sets of arrays or to use reflection to get the data straight from a class?
13:24 05 Apr 2026

I am self-taught, so I apologize if the title uses terms incorrectly.

I am trying to write a Minecraft mod that adds some RPG mechanics to the game. BUT more importantly, for this question, it potentially allows other users to add their own RPG systems to the mod, creating a growing list of variables.

Right now, the variables are declared in "RPG System Classes" and loaded into another "Register Class" that houses several arrays, one for each variable. I got to thinking "Where is that data going to be stored?" and I don't actually know, but I was worried it might be stored in RAM memory. So then, if you get enough variables, or RPG systems, or both, it could cause some bloat that is unneeded.

So I looked into other ways of assessing the information and found that I could load the "RPG System Classes" themselves into an array in the "Register Class" as strings. Then I can use reflection to access the variables. And I'm hoping that's a RAM friendly way of going about things.

So a sub question is: Does either method affect RAM like I think it does or am I totally in the wrong?

But my main question is: What is the best practice for saving this kind of modular information to a Java program? Is it the arrays, reflection, or some other implementation I'm unaware of?

Thank you in advance.

java arrays reflection minecraft minecraft-forge