Topic category: Advanced modding
I really want to make some of my mobs spawn in any biome, but only biomes in the Overworld, but I cannot figure out how to do this. If I set them to not be biome restricted, they spawn in every dimension, but having them be biome restricted only allows them to spawn in one biome.
As far as I can tell this string makes a mob spawn in the sepcific biome (in this case, oceans):
Biome.REGISTRY.getObject(new ResourceLocation("ocean")));
After hours of experimentation, I figured out that the code works for any two biomes if the string is like this:
Biome.REGISTRY.getObject(new ResourceLocation("ocean", "forest")));
However, as soon as I add a third biome, to the list, I get this error and it makes no sense at all PLEASE HELP ME! (If there is a simpler way to just have the code say "spawn in all biomes in dimension ID=0"
:clean
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_plast.java:90: error: incompatible types: String cannot be converted to int
Biome.REGISTRY.getObject(new ResourceLocation("ocean","plains","desert")));
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
BUILD FAILED
This is wrong: Biome.REGISTRY.getObject(new ResourceLocation("ocean","plains","desert")));
This is correctly:
Biome.REGISTRY.getObject(new ResourceLocation("ocean")));
Biome.REGISTRY.getObject(new ResourceLocation("desert")));
Biome.REGISTRY.getObject(new ResourceLocation("plains")));
In the newer MCreator versions, there is an option where you can restrict the biome spawn thing. But also have it spawn in multiple biomes & also keep the mob in the OverWorld.
I hope that helped.
this happens to me too
I was able to get it to work with hakann;s code. It was very very long, but it worked. I still just wish there was a spawn-by-dimension option so that it would alos spawn in overworld biomes introduced by other mods, like biomes o plenty or such. My main issue was just getting them to not spawn in the end, so I'm happy it worked.