Tag-holding registry objects contain a method called #is in either their registry object or state-aware class to check whether the object belongs to a certain tag. They then can compare if the registry object has a tag using Holder#is. Non-Forge registry objects use either Registry#getHolder or Registry#getHolderOrThrow to get the current holder. Additionally, other streamlined operations can be performed using ITagManager. TagKeys can then be obtained via ITagManager#createTagKey.įorge wrapped registry objects can grab their associated holder using IForgeRegistry#getHolder. Forge wrapped registries can create a tag using ITagManager via IForgeRegistry#tags. Some vanilla defined helpers are also available to create wrappers via *Tags#create where * refers to the name of the registry object. Tags wrappers can be created using TagKey#create where the registry the tag should belong to and the tag name are supplied. Blocks, Items, EntityTypes, Fluids, and GameEvents are special cased as they have Holders allowing for available tags to be accessible through the object itself. Tags for all registries are automatically sent from the server to any remote clients on login and reload. This acts as a finer grained version of the Vanilla replace option. Any values listed here will be removed from the tag. You may declare a remove array of the same format as the values array. There is also a Forge extension on the Vanilla syntax. See the Vanilla wiki for a description of the base syntax. Values listed that are not present will cause the tag to error unless the value is listed using an id string and required boolean set to false, as in the following example: If replace is true, then all entries before the json specifying replace will be removed. For example, to add your own mod’s saplings to the Vanilla sapling tag, you would specify it in /data/minecraft/tags/blocks/saplings.json, and Vanilla will merge everything into one tag at reload, if the replace option is false. Similarly, you may append to or override tags declared in other domains, such as Vanilla, by declaring your own JSONs. Tags for Blocks, Items, EntityTypes, Fluids, and GameEvents use the plural forms for their folder location while all other registries use the singular version ( EntityType uses the folder entity_types while Potion would use the folder potion). For example, a TagKey with a given identifier of modid:foo/tagname will reference a tag at /data//tags/blocks/foo/tagname.json. Tags are declared in your mod’s datapack. 4 Using Tags in Recipes and Advancements.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |