2024-12-10 17:54:16|Myriagame |source:minecraft skins
This tutorial is set by the author to use the CC by-NC protocol.
Anno principle
Anno essentially uses the runtime annotation+reflection method to obtain static fields from the registry | registry class, and then perform various operations.
The operation process is integrated to the (resolva | Resolver) interface implementation, and registered at Annoresolvers for calling.
Specific process:
Call the analysis method in Annoresolvers in the module -related loading method, and analyze the specified class->
Get the field, instance, registryClass-> Try the packaging field (this process is judged whether there are annotations and judgments as expected types)
Registered resolvers cycle analysis (the specificization process depends on the corresponding resolver)
Register
Exemplary example
Brief description of example registration form
(Registration | Registry) is also a class (class | class), which stores instances of related elements in the form of static variables.
The registry must be @id (String namespace) as the namespace of the registry, most of the time is Modid.
Core annotation
@Id (String Value) is used to bind ID.(All fields must be @id to be parsed)
General annotation
@Reg (String RegistryName) is used for registration;
@Burnable (int Time) is used to add new fuel.
Genetic annotation annotation
@Parent (String Path) is used to generate a model with a
@GENRATED is used to generate 1 general model item; (the material path comes from the registry @id and items @ID)
@Handheld is used to generate 1 handheld model; (the material path is the same as @GENERATED)
@Cubeall is used to generate a simple square model with the same six sides and the blockState;
@Lang (String Langcode, String Value) is used to generate language files.
Analyze
Brief description
The analysis process will obtain the field instance and the corresponding annotation,
In this process, other operations can be combined, such as combined with DataGeneration to achieve automatic generation.
And our registry takes effect to analyze, the specific operation is as follows:
The onInitialize () method of the module master calls Annoresolvers.Resolve (Class <?> Registration);
The onInitializedataGERATOR (ARG ...) of the Module DataGENETION class calls annoresolvers.dataGen (ARG ...).
The class <?> Registration is the class of the registry.
Exemplary example
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22