Jump to content

[1.12.2] Code-triggered multiple step advancement


Kinniken

Recommended Posts

Hi,

 

I would like to add to my mods some "multi-step" advancements, like the vanilla "balanced diet" one. Is this doable without having to add every "step" in the JSON file, in the same way that you can have single-step advancements with a custom trigger in the JSON that's actually handle code-size?

 

If not I guess I'll have to write an advancement file generator ;)

 

Thanks

Link to comment
Share on other sites

Use JSON whenever possible so resource packs (and data packs in 1.13) can override your stuff.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

22 minutes ago, Kinniken said:

For something like this I disagree, the advancements in question are core features and tied with other functionalities in my mod. If mod pack makers want to add advancements that refer to my mod that's great, but the default ones should be left as is.

It should still be done in JSON. Take a look at the format here.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I know how the format works, that's not my issue.

 

However for what I want to do I would need dozens of triggers, with more added every time I add content. It would be a real pain to do this manually. If there is no better way, I guess I'll have to choose between handling it code-side without showing intermediary progress or coding a bit of code that generates the JSON from my mod's data, but that's really clunky.

Link to comment
Share on other sites

1 hour ago, Kinniken said:

However for what I want to do I would need dozens of triggers

Describe what you would want to do from an end user perspective and we might be able to help more.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

My mod adds villages (nothing to do with the vanilla ones) with a large number of different villager types, more than a hundred split over several cultures. And that list is moving from update to update - I add new ones regularly and occasionally remove some too. I wand to add advancements for meeting them all, probably split by cultures.

 

If I do a trigger per villager type in JSON, it will be a nightmare to maintain, except if I generate the JSON from code, which is doable but ugly.

 

Alternatively, I can forgot about the "partial progress" bar and just grant the advancement when the player has completed the list, that's easy to do from the code.

Link to comment
Share on other sites

12 hours ago, Kinniken said:

If mod pack makers want to add advancements that refer to my mod that's great, but the default ones should be left as is.

What if they disagree, and want to change stuff? If you have it all in code they will have to create a copy of your mod, edit it, redistribute it etc. If you do it in JSON all then need to do is edit the JSON file.

9 hours ago, Kinniken said:

generate the JSON from code

Very doable, and not that ugly.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

If there's no option but that I guess I'll go with it. But really that focus on outside edits is a bit beside the point, once again these new advancements will be tied to hard coded features, this is not something mod pack makers would venture in. On the contrary, having those advancements containa statically defined list of my villagers is bad for external content creators as it means that their villagers won't get auto-included.

 

Plenty of stuff in my mod can be changed without touching the code, in fact it's possible to add entire new cultures with their own villagers and buildings and quests without touching a line of Java. It's a lot more open that Minecraft itself in that respect. But for this feature it's just beyond the point.

Link to comment
Share on other sites

5 minutes ago, Kinniken said:

external content creators as it means that their villagers won't get auto-included.

This is exactly WHY you should use JSON, they will add their villages with JSON.

 

I'm arguing for JSON advancements because thats the standard (How vanilla does it). If you want to use another method just make sure that it will support data packs etc.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Alright, so 

31 minutes ago, Kinniken said:

On the contrary, having those advancements containa statically defined list of my villagers is bad for external content creators as it means that their villagers won't get auto-included.

 

18 minutes ago, Cadiboo said:

This is exactly WHY you should use JSON, they will add their villages with JSON.

I think there's a misunderstanding here.  Correct me if I'm wrong, but to me it looks like Kinniken is saying that the code handling his achievements is actually automatically detecting villagers from other mods (presumably completely procedurally, without any specification needed), which would allow a great amount of flexibility without the authors of said mods actually doing anything at all?  Basically, without other mod/modpack authors doing a thing, it automatically detects other mods' villagers?

 

Wouldn't a system like that cause all kinds of issues if it were rewriting portions of JSON every run?  Quite possibly portions modpack authors had changed?

 

IF I'm actually right about all that, wouldn't all the workarounds beyond that point have their own sets of issues with more workarounds needed?  *IF* I'm right about that stuff above...now I'm curious.

Link to comment
Share on other sites

47 minutes ago, Cadiboo said:

This is exactly WHY you should use JSON, they will add their villages with JSON.

 

I'm arguing for JSON advancements because thats the standard (How vanilla does it). If you want to use another method just make sure that it will support data packs etc.

As a general rule you are right, in this case it just doesn't make sense. I already have a dynamic system to add content to my mod that's flexible and works well. In this new feature content discovered by the player, whether my own or added by other creators, will get tracked in a new UI, automatically, with no extra work for content creators. Having the advancement part being static in JSON is just more work for people, and if they don't do it, will lead to inconsistencies (my UI and the advancement system reporting different numbers).

Also you are thinking of mod pack makers. That's one use case but not the main one for me. I have a lot of user-created content that can be downloaded and installed separately by players (check the site: https://www.millenaire.org/library/ and yes I know it needs a solid UI update ;) ). Independently each of them could override advancements with their extra content, but what happens when the player wants to add more than one?

Lastly thinking about it thanks to this discussion, there is the matter of updates. I've always tried hard to keep Millénaire as backward compatible as possible with outside content. If I do this JSON thing, it means that outside content that override my advancements won't include villagers and buildings added by later updates to the mod. That's really a killer.

I would have liked to have those neat looking progressive advancements but after all these discussions I think the impact on content creators just isn't worth it. I'll just grant them straight when the player has finished the list.

Link to comment
Share on other sites

@Kinniken What you should probably do in this case is have a built in creator of the Jsons. That will create them at runtime if they do not exist. Then prompt the user to restart the game in order to load the newly generated Advancements if there are any new ones and they haven't been loaded. It should all be done through Json, unless you are going to add the ability to change things in your way of loading custom cultures, etc.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Your drivers are in a broken state, follow the guide in the FAQ: https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/#:~:text=How do I update my drivers%3F
    • A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc3fe22b60, pid=15228, tid=5140 # # JRE version: OpenJDK Runtime Environment Microsoft-8035246 (17.0.8+7) (build 17.0.8+7-LTS) # Java VM: OpenJDK 64-Bit Server VM Microsoft-8035246 (17.0.8+7-LTS, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) # Problematic frame: # C [atio6axx.dll+0x192b60] # # No core dump will be written. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # https://aka.ms/minecraftjavacrashes # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug i have no idea why please help
    • Quick-Books is great with regards to coordinating your monetary data. You can decide to live talk with a specialist at Quick-Books to get the answer for your questions. You will actually want to get to the talk going to the landing page and call us +1855-210-1428.
    • Update: I managed to make the item not disappear after crafting, but it doesn't remove any durability. import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.UnbreakingEnchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class NuggetHammer extends Item { private boolean damage; public NuggetHammer(Properties p_i48487_1_) { super(p_i48487_1_); } @Override public int getMaxDamage(ItemStack stack) { return 54 - 1; } public boolean isBarVisible(ItemStack stack) { return false; } @Override public ItemStack getContainerItem(ItemStack stack) { ItemStack copy = stack.copy(); copy.setCount(1); if (!this.damage) return copy; int unbreaking = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, stack); for (int i = 0; i < unbreaking; i++) { if (UnbreakingEnchantment.shouldIgnoreDurabilityDrop(stack, unbreaking, random)) return copy; } copy.setDamageValue(stack.getDamageValue() + 1); if (copy.getDamageValue() > stack.getMaxDamage()) return ItemStack.EMPTY; return copy; } }  
  • Topics

×
×
  • Create New...

Important Information

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