Custom Enumeration Variables and Implementation

Started by Big Martin on Sat, 05/27/2023 - 08:10

Topic category: Feature requests and ideas for MCreator

Last seen on 13:34, 6. Jul 2023
Joined Nov 2022

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Enumeration Variables and Implementation
Sat, 05/27/2023 - 08:18 (edited)

Currently, there is already enumeration implementation for both directions and dimensions. It would greatly improve Mcreator to include custom enumeration implementation.

Enumeration variables would be identical to direction variables but with custom options, rather than the pre-existing "Down, Up, North, South, West, East". 

One way this could be implemented is through a mod element. An "Enum" mod element is created, which opens a tab to add options to its list. Once saved, this enumeration is then added to the "Variable Type" list with its corresponding list showing under the "Initial Value" dropdown. Each new enumeration would be added to the Variable Type list.



For commands, current implementation of "Literal" parameters requires creating different procedures for every single literal parameter. This is extremely tedious and would be better for every Mcreator user to be able to replace literal parameters with an enumeration parameter from a previously created enum mod element and simply use "If" blocks to compare which enumeration option is used within a single procedure. In the "Command" mod element, the "String" parameter block already uses an enum for differentiating between a "single_word" and "quotable text", as well as the entity parameter block for its dropdown menu. An enum parameter could use this implementation by selecting which enum in the first button, using the double click popup menu filled with available enumerations, then the second option would be a dropdown menu, which would populate with the options of the enum that was selected first. This block would act like a "Literal" parameter, but we would be able to compare it within a procedure (see below), instead of creating different procedures for each "Literal" block. 



In procedures, enums are used when a double-click is required to open a menu to select between pre-existing options. When comparing an enum command parameter, that popup menu could be used to choose which enum list to use for comparison, then have a following dropdown menu, identical to the direction block, which lists all the options of the chosen enum list.



Custom enumerations would also be viable for global implementation, including local variables, logic, and potentially more.


I hope to see this in future and currently supported versions of Mcreator.

Edited by Big Martin on Sat, 05/27/2023 - 08:18