This pull request implements tag inheritance. Preferred items will be able to inherit item and block tags from the unified items.
This allows obtaining tags from unified items that are required for gameplay mechanics. A good example would be beacon payment items or mods that use block tags for specifying valid blocks for multiblock structures.
The feature is config-controlled. By default, it does nothing. Two new config options will be populated automatically. This will not break existing configs.
Implementation notes
the whole reload logic was redesigned to fix timing issues and the required data order
tag reloading is now piped through the TagReloadHandler in order to populate the tag maps that are dropped after the process
the TagMap was abstracted and generified in order to support blocks as well
there is still a clear distinction between item and block tag maps since block tag maps are only used for inheritance right now
TagMap creation no longer uses the TagManager and is directly created with the raw tags received from the TagLoader
thus the TagManagerMixin is no longer required
TagReloadHandler#resolveRelations will work on a filtered tag map meaning all tags, that should allow inheriting from, need to be in the unification tags
there is no validation for inheritance tags since they support RegEx
after inheritance is applied, all data objects required to build the AlmostUnifiedRuntime are rebuilt in order to reflect changes by inheritance
this only happens when item tags are changed, block tags are not used elsewhere
item inheritance tags are a map from item tags to item tags
block inheritance tags are a map from block tags to item tags
Example
A really cursed example just to show the functionality. Keep in mind that at least two different namespaces are required or the items won't be unified.
{
"tagOwnerships": {
"c:iron_ingots": [ // treat silicon and coal as if they were iron ingots
"c:silicon",
"c:coal"
],
"minecraft:planks": [ // treat budding blocks as if they were planks
"c:budding_blocks"
]
},
"itemTagInheritance": { // allow inheriting the beacon payment item tag on the dominant item of the coal tag
"minecraft:beacon_payment_items": [
"c:coal"
]
},
"blockTagInheritance": { // allow inheriting the pickaxe mineable block tag on the dominant item of the planks tag
"minecraft:mineable/pickaxe": [
"minecraft:planks"
]
}
}
This pull request implements tag inheritance. Preferred items will be able to inherit item and block tags from the unified items.
This allows obtaining tags from unified items that are required for gameplay mechanics. A good example would be beacon payment items or mods that use block tags for specifying valid blocks for multiblock structures.
The feature is config-controlled. By default, it does nothing. Two new config options will be populated automatically. This will not break existing configs.
Implementation notes
TagReloadHandler
in order to populate the tag maps that are dropped after the processTagMap
was abstracted and generified in order to support blocks as wellTagMap
creation no longer uses theTagManager
and is directly created with the raw tags received from theTagLoader
TagManagerMixin
is no longer requiredTagReloadHandler#resolveRelations
will work on a filtered tag map meaning all tags, that should allow inheriting from, need to be in the unification tagsAlmostUnifiedRuntime
are rebuilt in order to reflect changes by inheritanceExample
A really cursed example just to show the functionality. Keep in mind that at least two different namespaces are required or the items won't be unified.