Jump to content

[SOLVED] [1.12.2] Naturally spawning entity in multiple biome types


Recommended Posts

Posted (edited)

How can I make an entity naturally spawn in multiple biome types? Like, for example, how could I make it spawn in plains biomes, forest biomes and desert biomes at the same time?
 

    @SubscribeEvent
    public void onEntityRegistry(RegistryEvent.Register<EntityEntry> event) {
    	event.getRegistry().register(EntityEntryBuilder.create().entity(EntityShinobi.class).id
    			(new ResourceLocation(References.mod_id, "mobs"), References.ENTITY_SHINOBI).name("RogueShinobi").tracker
    			(50, 1, true).spawn(EnumCreatureType.CREATURE, 45, 1, 6, BiomeDictionary.getBiomes(BiomeDictionary.Type.PLAINS)).egg
    			(16770207, 000000).build());
    	
    }

 

Edited by FlashHUN
marked as solved
Posted
1 hour ago, diesieben07 said:

The spawn method asks for either an array of biomes or an Iterable of biomes. Just create a List and put all the biomes you want in there.

		List<Set<Biome>> biomes = new ArrayList<Set<Biome>>();
		biomes.add(BiomeDictionary.getBiomes(BiomeDictionary.Type.PLAINS));
		biomes.add(BiomeDictionary.getBiomes(BiomeDictionary.Type.FOREST));
		biomes.add(BiomeDictionary.getBiomes(BiomeDictionary.Type.SANDY));
		
    	event.getRegistry().register(EntityEntryBuilder.create().entity(EntityShinobi.class).id
    			(new ResourceLocation(References.mod_id, "mobs"), References.ENTITY_SHINOBI).name("RogueShinobi").tracker
    			(50, 1, true).spawn(EnumCreatureType.CREATURE, 45, 1, 6, biomes).egg
    			(16770207, 000000).build());

 

Alright, but how should I make that list? This gives me an error in the spawn method and I have no idea how to make that list

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.