Mob spawn when player get close to block (like twilight forest boss)

Started by Spayzers on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mob spawn when player get close to block (like twilight forest boss)

Im making a custom spawner that spawn a mob when the player get to close, and then break the block, kinda like the boss spawner from the twilight forest. Im asking if people could send a screen because i already tried to do it, but it says it as missing dependencies. Thank in advance. 

Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I quickly put this procedure…
Thu, 07/11/2024 - 19:17

I quickly put this procedure together and have it run for the "Update tick" trigger on the block itself. Don't have "Tick randomly" enabled because you want the block to recognize the player pretty much immediately. I used the default tick rate of 10 for my testing and it wasn't immediate, but it was still very quick and reliable. You shouldn't notice any delay once you up the distance in the procedure.

One concern is that naturally-placed blocks don't tick unless Tick randomly is enabled. I don't know if typical structures count as naturally placed or not. I tested this with one of my custom structures that is actually generated via another structure, which I've done due to its size.

You may not need to do this, so just try the procedure on the block first and see if it works for your structure.
However, if it doesn't work, what I've done is I have a "structure" that just generates an invisible mob. That mob then has an "On entity tick update" trigger procedure that places the structure I want at its position. You just need a "Place at z: y: z: with rotation: mirror: structure:" block to generate the structure, and then a "Despawn Event/target entity" block for that procedure.

Here's what I've got:


But here's all you really need: