Fabric API

Fabric API

108M Downloads

Request: Backport Conventional Tags to Versions Prior to 1.18

CringeStar opened this issue ยท 7 comments

commented

Versions 1.17 and earlier are lacking conventinal tag functionality. I dont know if this is due to them being hard to implement or just not done yet, but it would be realy appriciated. I develop a mod relying on this functionality for something (specifically the c:shields tag), and the lack of convention tags has complicated backporting.

commented

The convention tags module doesn't seem to add any behaviour. All I can see there is TagKeys for convenience.

Are you aware tags are merged? There doesn't have to be a particular mod creating the tag. If your mod provides a tag JSON for c:shields, it'll work fine with any other mod that does the same.

Our mod relies on pulling the list of all items with c:shield to do something to them, and we get the list through the ConventionalTags class, so we don't know how else to implement it in another way.

commented

Fabric API is generally not updated for anything besides the two most recent versions (1.19.4 & 1.20.1). You are best off making a JiJ-able library containing the features you want for anything older.

commented

The convention tags module doesn't seem to add any behaviour.
All I can see there is TagKeys for convenience.

Are you aware tags are merged? There doesn't have to be a particular mod creating the tag. If your mod provides a tag JSON for c:shields, it'll work fine with any other mod that does the same.

commented

I am not sure if older vanilla versions even have the tag->item list map feature. However, you can implement it (inefficiently) by iterating the item registry and checking if each item has the tag. Make sure to cache that so it's only run whenever tags reload.

commented

The convention tags module doesn't seem to add any behaviour. All I can see there is TagKeys for convenience.
Are you aware tags are merged? There doesn't have to be a particular mod creating the tag. If your mod provides a tag JSON for c:shields, it'll work fine with any other mod that does the same.

Our mod relies on pulling the list of all items with c:shield to do something to them, and we get the list through the ConventionalTags class, so we don't know how else to implement it in another way.

Use TagKey.of() with c:shields and the registry ID for the item registry as arguments. TagKeys are keys, they aren't the actual tags. The contents of a tag are tracked by the registry the tag is for. Two TagKeys with the same id and registry key are equivalent.

This is what I meant by the conventions module containing TagKeys for convenience. You don't need to use those instances. They're just there because it's more convenient if mod devs don't have to make TagKey instances themselves.

Sidenote: TagKeys are actually interned, TagKey.of() always returns the same instance for the same arguments. I refer to different instances of TagKey only because it's simpler to explain that way.

commented

@Daomephsta Since this is pre-1.18 backport, TagKeys are irrelevant.

commented

We don't have plans to backport functionality to very old versions. You can define the tag entries yourself.