Posted December 27, 20204 yr So, I've recently been trying to create a new chunk generator for my mod. Because I want individual chunk generators per biome, and because the biome class itself can't be extended anymore, I decided to create a hash map with a resource location as an input and a custom class(with the chunk gen) as an output. The thing is, everytime I want to access this hash map with the resource location of the biome, it returns null. After a quick debugging sessions it turns out that the method Biome#getRegistryName always returns null, even on vanilla and hardcoded biomes. How can I solve/avoid this problem? Help would be appreciated. -Budschie Edited December 27, 20204 yr by Budschie
December 27, 20204 yr Author So, here is my code: Calling Biome#getRegistryName Biome biome = worldGenRegion.getBiome(new BlockPos(posXStart + x, 0, posZStart + z)); BiomeGeneratorBase biomeGenerator = BiomeDataHandler.getBiomeData(biome.getRegistryName()).getBiomeGenerator(); Setup of the BiomeDataHandler: BiomeDataHandler.addBiomeData(new ResourceLocation(References.MODID, "green_forest_biome"), new GreenForestBiomeData()); BiomeDataHandler.addBiomeData(new ResourceLocation(References.MODID, "deepnether"), new DeepnetherBiomeData()); Here is my GitHub-Repo: https://github.com/Budschie/Deepnether-Mod/tree/1.16.3
December 28, 20204 yr Author Is there maybe something else that could identify a biome uniquely, besides from the registry name?
December 31, 20204 yr It's not guaranteed to return a proper value. You should pass the biome instance into the biome registry held within DynamicRegistries and do a reverse lookup instead to grab the associated resource location.
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.