Unable to get list of list.

For some reason its not letting me .get() any of the inner-most lists.
No description
36 Replies
JavaBot
JavaBotā€¢11mo ago
āŒ› This post has been reserved for your question.
Hey @š“pothicon! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
š“pothicon
š“pothiconOPā€¢11mo ago
I tried taking away the List.of(0) in the test and putting a breakpoint and it showed that 'test' was indeed a list containing two lists but when I try to .get() either list it doesnt return a list
š“pothicon
š“pothiconOPā€¢11mo ago
not even this works
No description
š“pothicon
š“pothiconOPā€¢11mo ago
doing the .get(0) directly instead of doing it like test.get(0) does get the list
No description
š“pothicon
š“pothiconOPā€¢11mo ago
very strange
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
well i cant specify a specific type because there are several different types of objects in the list
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
I have a list of maps that each contain a list of lists list > map > list > list
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
whats difficult about it? only other thing i could think of was doing List<List<?>> instead of List<?> but that didnt solve it either (without the .get(0))
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
nope they both implement FeatureElement but they dont extend the same of anything
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
im not im putting a list of entitytype blocks and a number into the same list
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
so really the datastructure is more like list>map>block/list>list>entitytype/int/list>block bc ive never heard of a record before lol
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
never heard of that before
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
the number is how many of the block needs to be surrounding the position in order for the mob to spawn there so
List.of(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
List.of(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
means that there needs to be 4 grass or tall grass next to the position for the chicken to spawn
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
ye
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
No description
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
well the map still needs a list of 'SpawnGenerator" but yeah
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
how? I did list.of() and seperated them with commas lol
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
Map.of(Blocks.GRASS_BLOCK, List.of(
new SpawnParameters(EntityType.SHEEP, List.of(Blocks.WHEAT), 1),
new SpawnParameters(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
)),
Map.of(Blocks.GRASS_BLOCK, List.of(
new SpawnParameters(EntityType.SHEEP, List.of(Blocks.WHEAT), 1),
new SpawnParameters(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
)),
see this example there is a list containing two SpawnParameters records aka they are seperate elments However I now can't get that list of spawn parameters for some reason
š“pothicon
š“pothiconOPā€¢11mo ago
No description
š“pothicon
š“pothiconOPā€¢11mo ago
its saying this is a List<capture of ?>
List.of(
new SpawnParameters(EntityType.SHEEP, List.of(Blocks.WHEAT), 1),
new SpawnParameters(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
)
List.of(
new SpawnParameters(EntityType.SHEEP, List.of(Blocks.WHEAT), 1),
new SpawnParameters(EntityType.CHICKEN, List.of(Blocks.GRASS, Blocks.TALL_GRASS), 4)
)
instead of a List<SpawnParameters> (and I can try changing it to want a list<?> but then I cant do .get() on it)
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢11mo ago
ah
JavaBot
JavaBotā€¢11mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server