How do i make mobs to only spawn in caves?

Started by Callofmc on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i make mobs to only spawn in caves?

I have this mob i want to only spawn underground/caves however i do not see a way to do it now i could be blind but i don't see a way to do it

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A safe way to do this would…
Wed, 06/12/2019 - 18:02

A safe way to do this would be to make the entity spawn below y = 50 or so. This is below sea level so they will not spawn above ground.

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where is this at, thank you
Thu, 06/20/2019 - 18:44

Where is this at, thank you

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
rmsandegs, but how to do it?
Mon, 02/17/2020 - 13:05

rmsandegs, but how to do it?

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do we make it spawn…
Thu, 06/25/2020 - 08:56

How do we make it spawn below y=50 ??

 

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Dang, this is dedication. I…
Thu, 06/25/2020 - 16:44

Dang, this is dedication. I didn't get email notifications for the other ones but I did for that last one.

Anyways, create a procedure that triggers "on entity initial spawn" that checks "if y >= 50" if that is true, then your mob is above the ground, so despawn it using the "despawn mob" block.

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, and you can also check…
Thu, 06/25/2020 - 16:46

Oh, and you can also check if "get block at x y z = CAVE_AIR", which is a special kind of air that only spawns in caves underground. 

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
rmsandegs Thx a lot dude   
Fri, 06/26/2020 - 11:58

rmsandegs Thx a lot dude 

 

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
rmsandegs can you teach me…
Fri, 06/26/2020 - 17:03

rmsandegs can you teach me how to do everything you just explained (i just started MCreator 3 days ago and im a huge noob sorry)

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sure, so in the "triggers"…
Sun, 06/28/2020 - 18:34

Sure, so in the "triggers" section of your entity, create a procedure in the "initial entity spawn" section that detects if

A. Y is less than 50 or so (Y can be found in the Minecraft section of the procedure menu), or

B. Block at x, y, z == Cave Air

I suggest B because it is a little more versatile, for example ground level is much higher in extreme hills than, say, the ocean. So a hard value of y = 50 might not be ideal for a "one-size-fits-all" solution.

https://imgur.com/a/KkYErQf

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey,  I recently came across…
Mon, 06/29/2020 - 17:16

Hey, 

I recently came across this post and honestly Option B worked amazingly, however, is there a way to make it so if the mob is deliberately spawned (Spawn Egg or command) that they don't despawn? So this way they can only spawn naturally in caves but can be spawned elsewhere (kind of like bats)

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm... This is an…
Mon, 06/29/2020 - 17:51

Hmm... This is an interesting one. With commands, you can force a mob to never despawn by using the NBT tag {PersistenceRequired:1}. This works for all mobs.

As for spawn eggs, though, the only way I could see this being done is to detect a player within 5 blocks of where the entity spawns (this procedure block is only available in the 2020.4 snapshots), then setting the PersistenceRequired tag to 1 using the /data merge command in the "execute command" procedure block. This shouldn't have any false positives because mobs are programmed to spawn a minimum of 20 blocks away from any players.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Alright, I'm going to try…
Mon, 06/29/2020 - 18:42

Alright, I'm going to try this, thank you!

Also as someone who is new to modding and Mcreator, I just want to ask will I be able to update my current project to the latest updates, and will switching to newer snapshots mess stuff up?

Thanks again!

Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would always back up you…
Mon, 06/29/2020 - 18:48

I would always back up you project before updating to snapshots, I learned that the hard way :p

So far, I've been using 2020.4 since the first snapshot launched and I haven't had problems, but you never know.

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello! I have problems with…
Fri, 01/22/2021 - 15:37

Hello! I have problems with the construction of the procedure itself, could you attach a screenshot, option B please?