Started by
-Seba-San-
on
Topic category: Help with Minecraft modding (Java Edition)
Hello! I'm having some trouble coding my mod for more achievements.
I have a rudimentary understanding of coding but I don't know how to make an achievement that when the player picks up a block/item, the achievement is given to the player.
I have an image of what i have so far, but I'm quite stuck and need help. If anyone knows the proper code for such an achievement, I would be very grateful!
Thank you!
Edited by -Seba-San- on Sun, 08/11/2019 - 02:51
I can't see your screenshot. Are we talking about the player just picking up a random block/item or a specific one?
Terribly sorry! The image was a print screen. Here's a imgur link: https://imgur.com/a/agFQKuS
I'm trying to give the player the "Tree Puncher" achievement when the player picks up any vannila log.
The player won't get the achievement when there's no external or additional trigger for this procedure to trigger. Use either the "OnPlayerTick" or "WhenPlayerPicksUpItem" trigger but the way I recommend is to edit the .json file of your advancement because that's how minecraft does it. Search for this:
"criteria": {
"<AchievementName>": {
"trigger": "<AchievementName>"
}
},
select the "trigger" line part and replace it with this:
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:log"
}
]
}
And then you should get your advancement once the Player has a Log in his/her inventory. If it doesn't work then the advancement won't be shown in the advancement GUI/Tab thingy.
Thank you so much! This helps a lot!
Despite my appreciation, I'm quite confused on where to put this code. I unlocked the code on the asset it's self and cant find the specific line you are talking about:
I also went to the file it's self in the file explorer, no dice; the file wasn't there. All were .class files.
Am i looking in the wrong place?
The word <AchievementName> is not literally there. I was jsut trying to show that that's where your achievements registry name would be. If you still don't find it just select the entire line that has the word "trigger" in it and replace it with the piece of code I showed you before.
It seems I didn't clarify my point, I physically cannot find the trigger line; it's non-existent. I will provide screenshots for more info.
https://imgur.com/a/pgKJdEw
Again, am i looking in the wrong place or am i doing something wrong?
You have to open the .Json file NOT the .Java file
Okay I found and succesfully edited the .json file and added the line of code you added, however it still wont work.
I edited the code from the unlocked source code and didnt lock it back, as it would "reset" the code and undo my changes.
Once more; am I doing something wrong?
Images: https://imgur.com/a/ZVKVuva
Add one more bracket above "parent"
And then put another bracket under it then add a comma
Lakas i want to make a custom totem of undying how do i get the achievment when it is used? help me pls