Jump to content

Spawning mobs in all overworld biomes


ghostwolf_

Recommended Posts

Hey guys, i was wondering about how to go about this.

 

i tried adding them via the entityregistry.addspawn() but i dont quite understand how to use the biomedictionary.

 

i also tried this: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials/1571414-how-to-use-the-forge-biomedictionary

 

but since its outdated i got stuck again.  so what should i use to register a mob spawn in all overworld biomes, i made an entity that extends the zombie class and i added some loot and a different texture (altough somewhat hacky)

and i would like it to have the same spawn conditions as a zombie.

 

Link to comment
Share on other sites

3 hours ago, diesieben07 said:

The methods in BiomeDictionary are pretty straightforward, are they not?

reasonably, yes.

 

public static void initSpawns () {
		
		BiomeDictionary.Type[] types = {
				BiomeDictionary.Type.BEACH,
				BiomeDictionary.Type.COLD,
				BiomeDictionary.Type.CONIFEROUS,
				BiomeDictionary.Type.DEAD,
				BiomeDictionary.Type.DENSE,
				BiomeDictionary.Type.DRY,
				BiomeDictionary.Type.FOREST,
				BiomeDictionary.Type.HILLS,
				BiomeDictionary.Type.HOT,
				BiomeDictionary.Type.JUNGLE,
				BiomeDictionary.Type.LUSH,
				BiomeDictionary.Type.MAGICAL,
				BiomeDictionary.Type.MESA,
				BiomeDictionary.Type.MOUNTAIN,
				BiomeDictionary.Type.OCEAN,
				BiomeDictionary.Type.PLAINS,
				BiomeDictionary.Type.RARE,
				BiomeDictionary.Type.RIVER,
				BiomeDictionary.Type.SANDY,
				BiomeDictionary.Type.SAVANNA,
				BiomeDictionary.Type.SNOWY,
				BiomeDictionary.Type.SPARSE,
				BiomeDictionary.Type.SPOOKY,
				BiomeDictionary.Type.SWAMP,
				BiomeDictionary.Type.VOID,
				BiomeDictionary.Type.WASTELAND,
				BiomeDictionary.Type.WATER,
				BiomeDictionary.Type.WET
		};
		
		SpawnListEntry spawnKabaneri = new SpawnListEntry(EntityKabaneri.class, Config.KabaneriSpawnChance, 1, 2);

		
		for (BiomeDictionary.Type t : types) {
			Set<Biome> biomes = BiomeDictionary.getBiomes(t);
			
			Iterator biomeIterator = biomes.iterator();
			
			while(biomeIterator.hasNext()) {
				Biome currentBiome = (Biome) biomeIterator.next();
				
				currentBiome.getSpawnableList(EnumCreatureType.MONSTER).add(spawnKabaneri);
			}
			
		}
		
	}

 

 

this is how i currently solved it, but i was wondering if there was a better way to do it, i couldnt really find a tag in the biomedictionary for overworld.

 

also i called this function in the post-init within my common-proxy is that the right place to call it? it seems to work and i figured i should call it after all mods have registed their biomes but since this is my first time modding these kind of things i figured id ask just to be sure.

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

If you are only interested in non-world-gen spawning, you are better off using WorldEvent.PotentialSpawns, which will allow you to add spawn choices based on dimension directly, instead of based on biome.

sounds like a better solution then i what i currently have which is this:

 

	BiomeDictionary.Type[] types = {
				BiomeDictionary.Type.BEACH,
				BiomeDictionary.Type.COLD,
				BiomeDictionary.Type.CONIFEROUS,
				BiomeDictionary.Type.DEAD,
				BiomeDictionary.Type.DENSE,
				BiomeDictionary.Type.DRY,
				BiomeDictionary.Type.FOREST,
				BiomeDictionary.Type.HILLS,
				BiomeDictionary.Type.HOT,
				BiomeDictionary.Type.JUNGLE,
				BiomeDictionary.Type.LUSH,
				BiomeDictionary.Type.MAGICAL,
				BiomeDictionary.Type.MESA,
				BiomeDictionary.Type.MOUNTAIN,
				BiomeDictionary.Type.OCEAN,
				BiomeDictionary.Type.PLAINS,
				BiomeDictionary.Type.RARE,
				BiomeDictionary.Type.RIVER,
				BiomeDictionary.Type.SANDY,
				BiomeDictionary.Type.SAVANNA,
				BiomeDictionary.Type.SNOWY,
				BiomeDictionary.Type.SPARSE,
				BiomeDictionary.Type.SPOOKY,
				BiomeDictionary.Type.SWAMP,
				BiomeDictionary.Type.VOID,
				BiomeDictionary.Type.WASTELAND,
				BiomeDictionary.Type.WATER,
				BiomeDictionary.Type.WET
		};
		
		SpawnListEntry spawnKabaneri = new SpawnListEntry(EntityKabaneri.class, Config.KabaneriSpawnChance, 1, 2);

		
		for (BiomeDictionary.Type t : types) {
			Set<Biome> biomes = BiomeDictionary.getBiomes(t);
			
			Iterator biomeIterator = biomes.iterator();
			
			while(biomeIterator.hasNext()) {
				Biome currentBiome = (Biome) biomeIterator.next();
				if (BiomeDictionary.hasType(currentBiome, BiomeDictionary.Type.END) || BiomeDictionary.hasType(currentBiome, BiomeDictionary.Type.NETHER)) {
					
				} else {
					currentBiome.getSpawnableList(EnumCreatureType.MONSTER).add(spawnKabaneri);		
				}	
			}
			
		}

 

altough this would also mean that if people add new dimensions they should also spawn there, so ill leave it like this for now. but ill probably switch to your suggestion at some point. thanks for the tip.

Link to comment
Share on other sites

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.