Give an advancement to a player when a mob is spawned into the world

Started by TrueFreesia on

Topic category: Help with modding (Java Edition)

Last seen on 03:19, 18. Aug 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Give an advancement to a player when a mob is spawned into the world
Mon, 08/05/2024 - 21:02 (edited)

Edit: Solved :D


-Hi, I'm making a mod where I make bosses out of my friends.

An issue I'm having is that I want to make advancements that are given to the player once the boss is spawned into the world. The problem is, the way to spawn the bosses is through structures/shrines.

I've looked on forums and youtube for days and I can't seem to find anyone with the exact same issue as me.

How exactly would I check if the entity exists in the world, and how would I give the advancement to the player once the entity exists?

I think this would be similar code to how the wither works, where its if the wither exists in the world, then all of the players in a certain range of the wither are given the advancement for it.

Thanks in advance :))

Edited by TrueFreesia on Mon, 08/05/2024 - 21:02
Last seen on 14:26, 16. Aug 2024
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use on tick update for the…
Mon, 08/05/2024 - 12:24

Use on tick update for the entity and use a procedure like the following:

for each entity as entity iterator at x: y: z: in square cube with size 30

if not is entity iterator the same entity as event/target entity

add advancement (your advancement) to entity iterator

 

at least this is how I did it with my boss mob

Last seen on 03:19, 18. Aug 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
EMC thank you so much it…
Mon, 08/05/2024 - 21:02

EMC thank you so much it worked perfectly!!!