Jump to content

[1.12.2] Recommanded way of adding custom advancements?


Kinniken

Recommended Posts

Hi all,

 

I've been reading up on adding advancements in 1.12 and it seems like recommended practices have shifted quite a bit since the first Forge releases. I'm specifically looking for advancements triggered by custom triggers in code, plus maybe some inventory-based ones for a few cases.

 

Is there a good tutorial or model with the clean way of doing this now?

 

Thanks

Link to comment
Share on other sites

While you can create complex trigger criteria using the JSON, I found it easier to create the criteria in code and cause a simple trigger. To me this is more flexible and bypasses a lot of the hassle of JSON. If you're interested you can look at my tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-modding-advancements.html

  • Thanks 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I had actually checked your tutorial, one of the first thing I do for new features ;) I just didn't know if it was up to date to changes in Forge, like that merge of Moar Advancements (if it changes anything to it). I was indeed looking for something code-based, I'm not a big fan of overly complicated JSON triggers.

 

And if I can use this occasion for a small bit of feedback on your very useful tutorials, could you add the date at which a tutorial was written? It's often really useful to know if it's recent or not.

Link to comment
Share on other sites

Advancement triggers are pretty simple.

 

Thttps://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/advancement/FoundOreTrigger.javahat looks like a lot, but its 90% the same across all triggers.

 

You pretty much start with the test() function and work backwards until all the errors are gone.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

20 hours ago, jabelar said:

While you can create complex trigger criteria using the JSON, I found it easier to create the criteria in code and cause a simple trigger. To me this is more flexible and bypasses a lot of the hassle of JSON. If you're interested you can look at my tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-modding-advancements.html

 

Hi jalebar, I was going through your tutorial again because your generic trigger mechanism would be perfect for my needs, but the code you posted in your tutorial is broken, it even has syntax errors (maybe encoding issues), for example:

 

 private final Set> listeners = Sets.>newHashSet();

 

I could fix quite a lot of them with a bit of guesswork but not all. Would it be possible for you to post the actual class? Thanks!

Link to comment
Share on other sites

6 hours ago, Kinniken said:

 

Hi jalebar, I was going through your tutorial again because your generic trigger mechanism would be perfect for my needs, but the code you posted in your tutorial is broken, it even has syntax errors (maybe encoding issues), for example:

 


 private final Set> listeners = Sets.>newHashSet();

 

I could fix quite a lot of them with a bit of guesswork but not all. Would it be possible for you to post the actual class? Thanks!

 

Where exactly are you seeing these errors? When I look at it in my browser the code doesn't have the encoding issues you're showing, plus I have all the imports in the code so you shouldn't have to guess at any class.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

It's because the HTML conversion fucked up:

<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">

  private final Set<icriteriontrigger .listener="" ustomtrigger.instance="">> listeners = Sets.<icriteriontrigger .listener="" ustomtrigger.instance="">>newHashSet();</icriteriontrigger></icriteriontrigger>

</span>

You can see what bits were there to start with, but which got converted to HTML tags instead.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, Draco18s said:

It's because the HTML conversion fucked up:


<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">

  private final Set<icriteriontrigger .listener="" ustomtrigger.instance="">> listeners = Sets.<icriteriontrigger .listener="" ustomtrigger.instance="">>newHashSet();</icriteriontrigger></icriteriontrigger>

</span>

You can see what bits were there to start with, but which got converted to HTML tags instead.

Yeah, I'll need to look at that. Looks like the generic angle brackets are confusing it. Thanks for pointing it out.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.