Better Variables

Upvotes: 5
Issue description

Procedures were an amazing addition to MCreator. Now nearly everything is possible. However, variables are still very limited.

At the moment, making something with variables makes a lots of troubles: if you use a local variable, it resets every tick, if you use a global variable, it resets when you close minecraft and it's shared between all the worlds.

So, here are my suggestions:

1. Renaming local variables to local tick variables

2. Renaming global variables to something like "minecraft session variable" (I'm bad at thinking of names)

3. Adding world-dependent variables that aren't shared between worlds and aren't reset when closing Minecraft

4. Adding player-dependent variables: they can be useful for new overlay bars, advancements like "collect all these items" and something more advanced like custom extra-inventory slots (I don't want to explain them here but with player-dependent variables they are possible to make)

5. Adding item/block/mob dependent variables stored in NBT data of the item/block/mob

I hope you will add some of these

Sorry for bad English

Issue comments

Thank you for opening this ticket. We will indeed improve this in the future, but the names will remain the same. Local variables are local per procedure, that's the reason for such name. Global variables might be renamed to Global world variables though.

Other requests will be considered in future updates.

@Klemen, the name for Global variables are perfectly fine. They are accessible in all aspects of the program they inhabit (thus, global.) Useless or less for Minecraft, but it meets the definition of what a global variable is. Am I being pedantic? Maybe. Am I trying to ensure MCreator doesn't teach bad habits when people make the transition from MCreator to Java or another language? Absolutely.

You are right, though, @RaolTheBest, that variables are basically useless for most practical purposes as they are now. We NEED, at the very least, instance-specific (the value can differ between each copy of an object) variables.

with my mod I need the block dependent variables.

The problem I have is that global variables are across all worlds. I need a 'world variable' that is only active in one world.

We will add the following new variables types in MCreator 1.8.3:

  • block specific variables (NBT) that are saved
  • entity specific variables (NBT) that are saved
  • map global variables that are saved
  • dimension global variables that are saved
  • Minecraft client session variables that are not saved

I am closing this ticket now.

Awesome! 1.8.3 will be a revolution! :D

Nearly everything will be possible...



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.