How do I spawn entities in the village?

Started by Andreius I on Thu, 07/22/2021 - 18:25

Topic category: Help with modding (Java Edition)

Last seen on 19:10, 3. Aug 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I spawn entities in the village?
Thu, 07/22/2021 - 18:25
I made the "Guardian" entity. How to make it spawn in the village?
Last seen on 07:43, 19. Sep 2021
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
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.

Last seen on 19:10, 3. Aug 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.