#How to grant an advancement based off if you have certain advancements already?

1 messages · Page 1 of 1 (latest)

autumn oyster
#

Hey, I'm trying to make a custom Advancement that is granted when you have unlocked multiple advancements as a reward for completing them.

I've have no trouble setting up the advancement other than getting the criterion to work, being how to detect if the player has gotten the advancements needed or not.

I've tried using a ServerTickEvents.START_SERVER_TICK event in my ModInitalizer class and then check every tick to see if they have the advancement completed using ServerPlayerEntity..getAdvancementTracker().getProgress(), but I have no idea how to get the AdvancementEntry needed for the getProgress() method.

I also don't see any vanilla criteria for this purpose, nor do I know of any events that detect when an advancement has been completed by a player.

Please let me know if you know any way to solve this, as it's the last major part of the mod that I have until release. Thank you very much!

violet raptor
#

Try creating a custom advancement criterion instead

autumn oyster
violet raptor
#

Create your own advacement criterion

#

How do you think vanilla knows when to grant advacements

autumn oyster
#

but how do i set it up to check if the player has the advancement or not?

#

i need to code it somehow

violet raptor
#

You have access to a serverplayerentity, right?

violet raptor
#

Get their advacement tracker

autumn oyster
#

this is the example of what i have as a custom criterion

autumn oyster
violet raptor
#

Get the entry from the serveradvancementloader

#

You can get the loader from the server

autumn oyster
#

i got this, but then how do you trigger the criterion?

#

or am i setting it up incorrectly?

autumn oyster
#

i ended up doing this, but it's probably not the best way

#

especially cuz u said eariler abt it

#

but i cant think of another way atm

#

definitely less bloated though