Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Add Advancements API#137

Merged
LukynkaCZE merged 25 commits intoDockyardMC:masterfrom
p1k0chu:advancement
Apr 22, 2025
Merged

Add Advancements API#137
LukynkaCZE merged 25 commits intoDockyardMC:masterfrom
p1k0chu:advancement

Conversation

@p1k0chu
Copy link
Contributor

@p1k0chu p1k0chu commented Apr 4, 2025

meh
no tree builder no node stuff just advancements here (means have to manually set the position)
boop:

val root = AdvancementManager.addAdvancement(
    advancement("dockyard:tab1/root") {
        withTitle("<blue>Dockyard")
        withDescription("On github!!!\nDockyardMC/Dockyard")
        withIcon(Items.LAPIS_BLOCK)
        withBackground(Blocks.CHERRY_LEAVES)
        withPosition(0f, 0f)
    })

val advApi = AdvancementManager.addAdvancement(
    advancement("dockyard:tab1/advancements") {
        withParent(root.id)

        withTitle("Advancements API")
        withDescription("Soon! Maybe! Probably!")
        withIcon(Items.PAPER)
        withPosition(0.5f, 1f)
    })

there are toasts (the only reason you wanted advancements)
Player.showToast extension function that takes title, icon and a frame

also event for when player selects an advancement tab

@LukynkaCZE LukynkaCZE added priority:2 Moderately important. Relied on by some users or impeding the usability area/packets area/other type/cosmetic type/missing-implementation labels Apr 5, 2025
@LukynkaCZE LukynkaCZE linked an issue Apr 5, 2025 that may be closed by this pull request
p1k0chu added 2 commits April 7, 2025 13:00
removed TODO because codefactor shut up
* fix multiple ConcurrentModificationException :skull emoji:
@LukynkaCZE
Copy link
Contributor

How is this going :3

Are you planning on merging to 1.21.4 still? 1.21.5 will take a WHILE

@p1k0chu
Copy link
Contributor Author

p1k0chu commented Apr 13, 2025

yes, im not waiting for 1.21.5,
but i kinda want to make advancements just viewable (so you can send them to individual players)
like with a boss bar

+ need to fix stuff, like when deleting an advancement that has children, clients also delete all the children recursively, so need to keep track of that on server-side too

also might actually make advancements mutable now that advancements will keep track of their children (you need to delete advancement and add it again to update properties, and then you probably need to send all the children again)

@LukynkaCZE
Copy link
Contributor

oki got it

p1k0chu added 7 commits April 15, 2025 14:17
Keep track of advancement's children and parent.
its useless but since progress map is private
might be good to have some public function to get progress
instead of having one billion collections
just send a packet to a client
when you add advancement, or remove, or change progress

* fix: add advancement viewers to the list
* fix: when disposing PlayerAdvancementTracker remove itself
from all visible advancements
because if you send progress of an advancement, you need to send the
full progress of that advancement
dont need to send every advancement tho
p1k0chu added 7 commits April 16, 2025 00:05
also get rid of advancement display,
in favor of just always having it (previously it was nullable).
because displayless advancements are COMPLETELY useless here
cuz it should be static (or even outside of class)
@p1k0chu p1k0chu marked this pull request as ready for review April 21, 2025 20:16
@LukynkaCZE LukynkaCZE changed the title Advancements Add Advancements API Apr 22, 2025
@LukynkaCZE LukynkaCZE merged commit 770bb45 into DockyardMC:master Apr 22, 2025
2 checks passed
@p1k0chu p1k0chu deleted the advancement branch April 22, 2025 18:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/other area/packets priority:2 Moderately important. Relied on by some users or impeding the usability size/XL type/cosmetic type/missing-implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add achievement API

2 participants