Data Organizer [ List and Map(key and value) ]

Published by BaR1BoD on
Supported MCreator versions
2024.1
2024.2
Tags / plugin type
Procedures
Variables
MCreator plugin
Downloads:
143
Upvotes: 4
About the plugin

Data Organizer is a plugin that adds two new variables, List and Map (key and value).

 

Examples:

 

List example:

 

Map example:

Map example

 

Advanced stuff:

 

Sublist:

 

Sublist example

  • The first index should not be negative

  • The second index should not be greater than list size

  • The first index should not be greater than the second index

  • If the first and second indexes are equal, it returns an empty list

list = [a, b, c, d, e, f, g]
anotherList = [b, c, d, e]

 

 

  • You can use sublist in blocks that require a list(clear, shuffle, reverse, sort, etc) so that block only affects that part of that list

 

    For example the clear block in this picture will only remove c, d, e and after that the list will look like this: [a, b, f, g]

 

List Filter:

 

  • The List Filter block sends each element of the list to the procedure, and if the procedure returns True, that element remains in the list, but if it returns False, that element will be removed from the list

  • The List Filter block does not affect the original list

  • Make sure that the procedure you use for filtering has only one dependency Object, and that object will be the elements of the list

  • If your list is not of only one type (for example, only numbers), you can use these blocks to filter each type separately

 

List Mapping:

 

  • The List Mapping block sends each element of the list to the procedure, and the action performed in the procedure is performed on each of the elements and creates a new list of new values.

  • The List Mapping block does not affect the original list

  • Make sure that the procedure you use for mapping has only one dependency Object, and that object will be the elements of the list

  • The mapping procedure return value must be an Object

 

More complex List Mapping:

 

  • A new procedure template called list full check has been added, which is long if-elseif and if you want to check each type of data separately, you can use it.


Supported Versions:

  • Forge 1.19.2

  • Forge 1.19.4

  • Forge 1.20.1

  • NeoForge 1.20.4

  • NeoForge 1.20.6

 

Changelog 

2.1.0:

  • Port to MCreator 2024.2
  • Added Forge-1.19.2, Forge-1.19.4 support
  • Added subcategory Compatibilities
  • Added File Manager plugin compatibility
  • Added normal for loop
  • Fixed Sublist block
  • Fixed Get list size block

2.0.0:

  • Added blocks to check the Object variable type
  • Added advanced blocks such as List Filter, List Mapping, Sublist
  • Fixed some bugs
  • Fixed some spelling mistakes

1.0.0:

  • Initial release
License
GNU General Public License version 3 (GPLv3)

Plugin downloads
DataOrganizer.zip - DataOrganizer.zipUploaded on: 07/16/2024 - 17:48   File size: 122.56 KB

Comments

It doesn't work. I think it's a syntax mistake in the plugin. I'm in mcreator 2024.1 and NeoForge 1.20.4. Here's an image: https://ibb.co/tKB1Yqh. Can you tell me what's wrong or correct it?

Thank you for reporting, I added a semicolon by mistake for the Get size block.
I will fix it.
If you need it now, you can open the Procedure code and delete the semicolons inside if statement.

What about How to sort the keys of a map and sort the values along with it. so like 439=apple,263=pear,319=banana,153=kivi -->>153=kivi,263=pear,319=banana,439=apple

How to sort the keys of a map and sort the values along with it. so like 4=apple,2=pear,3=banana,1=kivi -->>1=kivi,2=pear,3=banana,4=apple

Sorry, a mistake in the "for each element" block.
This is the modified version
https://s8.uupload.ir/files/screenshot_2024-06-27_203531_w7l2.png

When making a List or Map global variable, the only available scope is GLOBAL_SESSION. Is this an oversite, or a limitation? Would it be possible to add PLAYER -bound lists?

Did you add a normal (for) block?. Also is this mod gonna be compatible with the file manager plugin?

https://ibb.co/FWKvJF1
I want you to make something like this. You see the blank space.. that's where you type a variable. The problem is that variable can't be used inside the for block as it can only be typed. That's the problem

Is there something for organising them in descending to ascending order? Also can you attach strings in lists?. Bec if not then array list plugin would still be better. Keeping in mind that array list plugin allows adding of all variable types like entities direction. Etc

plz add sorting procedure i need it very much. its as simple as using bubble sort or quicksort. here is one i made for array list plugin(bubble sort) for every data type.

for (int i = (int) 0; i < (int) (assort.size() - 1); i++) {
for (int j = (int) 0; j < (int) ((assort.size() - i) - 1); j++) {
if ((assort.get((int) j) instanceof Double _d ? _d : 0) < (assort.get((int) (j + 1)) instanceof Double _d ? _d : 0)) {
temp = assort.get((int) j) instanceof Double _d ? _d : 0;
assort.set((int) j, (assort.get((int) (j + 1)) instanceof Double _d ? _d : 0));
assort.set((int) (j + 1), temp);
}
}
}