Jump to content

[1.16.5] get ArrayList of all structures


ThatSandwich

Recommended Posts

i have a function that gets a random structure from a array of specific structures, but in order for it to work i have to make a list of every structure i want it to work with, which means for it to work with other mods i would have to set them all as dependencies and etc, is there a way to make it so it just gets an array of all the structure for ever mod installed?

my current code:

 Random rndm = new Random(); 
                ArrayList<Structure> structureList = new ArrayList<Structure>();
                
                structureList.add(Structure.MINESHAFT);
                structureList.add(Structure.PILLAGER_OUTPOST);
                structureList.add(Structure.WOODLAND_MANSION);
                structureList.add(Structure.JUNGLE_TEMPLE);
                structureList.add(Structure.DESERT_PYRAMID);
                structureList.add(Structure.IGLOO);
                structureList.add(Structure.RUINED_PORTAL);
                structureList.add(Structure.SHIPWRECK);
                structureList.add(Structure.SWAMP_HUT);
                structureList.add(Structure.OCEAN_MONUMENT);
                structureList.add(Structure.BURIED_TREASURE);
                structureList.add(Structure.VILLAGE);
                
                Structure rndmElem = structureList.get(rndm.nextInt(structureList.size()));
                BlockPos structureLocation = new BlockPos(overworld.findNearestMapFeature(rndmElem, playerPos, 100, false));
                
                double xLocation = structureLocation.getX();
                double yLocation =  playerLocation.y;
                double zLocation = structureLocation.getZ();

 

Edited by ThatSandwich
Link to comment
Share on other sites

  • ThatSandwich changed the title to [1.16.5] get ArrayList of all structures

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.