SpongeForge icon indicating copy to clipboard operation
SpongeForge copied to clipboard

Get Custom Biomes from Mods

Open NitroxydeX opened this issue 11 years ago • 5 comments

Hey guys,

is there at the moment the option to get custom biomes out of an other mod e.g. biomes o plenty to use it in the world generator?

NitroxydeX avatar Nov 27 '15 20:11 NitroxydeX

Yes, GameRegistry#getType(Class,String) can be used to get a BiomeType instance for any biome, including mod added biomes. The ids are formatted as modid:name.

This biome type can be used like any other when it comes to world generation.

Deamon5550 avatar Nov 27 '15 21:11 Deamon5550

Is there any list of available biomes?

// edit: maybe GameRegistry#getAllOf(Class)

FabiUnne avatar Nov 27 '15 21:11 FabiUnne

Yes gameRegistry.getAllOf(BiomeType.class) will return all known biome types.

Deamon5550 avatar Nov 27 '15 21:11 Deamon5550

Okay, in this example, I want to load a BiomesOPlenty biomeType. But e.g. the id 'BiomesOPlenty:Bayou' throws a java.util.NoSuchElementException. (i tried to get the BiomeType). If I print out all biomes, also BiomsOPlenty biomes are displayed. But if I invoke the #getId() method of one displayed Biome, an java.lang.AbstractMethodError is thrown. How can I get the correct Ids?

FabiUnne avatar Nov 27 '15 22:11 FabiUnne

Ah looks like getId was not implemented on biomes, I'll add it to the world generation api implementation branch which should be merged soon. See: SpongeCommon#253

Deamon5550 avatar Nov 27 '15 22:11 Deamon5550