Jump to content

Recommended Posts

Posted (edited)

I'm concerned the answer might be painfully simple, since I've been slightly off base today - but I'm trying to get an Array of all of the "TagKey<Biome>" fields defined in Tags.Biomes (I'll be iterating through them to check for biome tags, and using the keys instead of raw text tags is better for language compatibility). The ones such as "IS_HOT", "IS_LUSH", "IS_MOUNTAIN", etc.. I cannot for the life of me figure out how and where to pull a list of all these from. I would just copy them in manually but that presents potential compatibility issues if another mod chooses to add new tags. Any help?

Edited by SpectralGerbil
Posted

If you are iterating over tags, you are almost certainly doing it wrong.

Tags are meant as a kind of flag to say "does this object have this property".

 

They can change dynamically, e.g. if somebody changes and reloads datapacks while minecraft is running.

That means you should not do any preprocessing or caching based on their values at any one specific point in time.

 

If you really want to do it. For a datapack registry it looks something like this:

@EventBusSubscriber(modid = MODID)
public class Test {

    @SubscribeEvent
    public static void listBiomesTagKeys(ServerStartingEvent event) {
        var biomes = event.getServer().registryAccess().registryOrThrow(Registries.BIOME);
        biomes.getTagNames().forEach(tagKey -> LOG.info(tagKey.toString()));
    }
}

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.