Detecting if a player has an advancement and returning a boolean. #2382
-
I've been prowling through the Minecraft source code using the yarn mappings and I can't find any getter method that looks like: public static boolean hasAdvancement(PlayerEntity player, Advancement advancement) {
...
} Does anyone know of any library that adds this, how to implement it myself, or of any pre-existing method similar to this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Of course there is. Any functionality available in vanilla Minecraft would have an implementation somewhere. That's how coding works. As you are probably aware, static methods are rare - because Java has a better way to represent those. (OOP, as people call it.) It's probably named Let's start from one thing we know: We reach There it is. TL;DR: |
Beta Was this translation helpful? Give feedback.
Of course there is. Any functionality available in vanilla Minecraft would have an implementation somewhere. That's how coding works.
As you are probably aware, static methods are rare - because Java has a better way to represent those. (OOP, as people call it.) It's probably named
has
orget
orisDone
or something like that, on the player or a class related to advancements.Let's start from one thing we know:
ServerPlayerEntity
. (I assume serverside here, clients need to request advancement through packet.) There are two methos with the name "advancement" in it. One of them is clearly not the one we want, so we investigate the other one,getAdvancementTracker
.We reach
PlayerAdvancementT…