Help Arraylist

Started by Nasphy on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help Arraylist

Ok... I'm coding a multiplayer shop for a Minecraft server. And I don't know now how to create an array list... I found an addon but it can't create a list stored on the global map, only on the global session. Do I have to go through custom elements ?

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can't create an…
Sat, 01/06/2024 - 18:28

You can't create an ArrayList from the MCreator interface, so you will have to use custom elements.

An ArrayList is a list of something. What do you want your list to contain? e.g. is it a list of items, a list of itemstacks...?

 

If you want to create a list of item stacks:

Create an empty procedure, save it, select it in the menu, click "Lock/unlock", then double-click on the procedure.

Then, right after the line that says "public class WhateverProcedure {", add a line that says "public static ArrayList<ItemStack> shop = new ArrayList<>();".