How do I spawn entities in the village?

Started by Andreius I on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I spawn entities in the village?
I made the "Guardian" entity. How to make it spawn in the village?
You can make it via global…
Thu, 07/22/2021 - 20:17

You can make it via global procedure with trigger "entity spawns".

Use condition "if entity = entity type >villager" then spawn Guardian on XYZ

You can of course make a bit offset, so it will be X+1/2 or Z+1/2, so they don't stack together (though they will move eventually, so it's not that important).

You can also make chance of Guardian spawning, because with procedure above, Guardian will spawn for every villager. So you can make easy additional condition to make it appear, for example, 20% of time, like here:

entity

(yes, I spawned bandit instead of Guardian, serving opposite purpose, but you see, they really need guardians with such cruel modders like me :P)

"Random [0,1]" gives you random between 0 and 1, so if you multiply it by 100, you will get percent drawing procedure.

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you! But when I set…
Fri, 07/23/2021 - 15:27
Thank you! 
But when I set the "Spawn weight" to 1 for example, they spawn everywhere. 
And I need them to spawn ONLY in the village. How to implement this? 
I tried to figure it out myself but failed.
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
First follow exactly what…
Fri, 02/23/2024 - 06:18

First follow exactly what Toma400 said, he was spot on. Then turn off "Enable entity spawning" because were not using that kind of spawning since we made the global procedure

Ecample

 

For anyone new seeing this, on an entity spawn it first checks if the entity is a villager. T

hen I used a [is (random number) the same as (fixed number)] to make odds, the one in my example is 1 out of 7 chance.

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A small change as I'm still…
Fri, 03/01/2024 - 20:06

A small change as I'm still learning myself, you can import a better odds template in the procedure templates, very useful for all procedures to look into it