Spawning mobs in Overworld ONLY

Started by Eonaut on

Topic category: Advanced modding

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Spawning mobs in Overworld ONLY
Sat, 03/03/2018 - 17:37 (edited)

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

Edited by Eonaut on Sat, 03/03/2018 - 17:37
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 This is wrong: Biome…
Sat, 03/10/2018 - 12:44

 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")));

Joined Jul 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the newer MCreator…
Sat, 04/07/2018 - 01:12

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.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this happens to me too
Sat, 04/07/2018 - 13:34

this happens to me too

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I was able to get it to work…
Sun, 04/08/2018 - 14:25

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.