New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.15.x] Rewrite docs for Registries #312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good stuff, much needed improvements. Just a couple small things that need addressing and then it's good to go.
------------------------------------- | ||
|
||
It is possible to have Forge inject values from registries into `public static final` fields of classes. This is done by annotating classes and fields with `@ObjectHolder`. If a class has this annotation, all the `public static final` fields within are taken to be object holders too, and the value of the annotation is the namespace of the holder (i.e. every field uses it as the default namespace for the registry name of the object to inject). If a field has this annotation, and the value does not contain a namespace, the namespace is chosen from the surrounding class's `@ObjectHolder` annotation. If the class is not annotated in this situation, the field is ignored with a warning. If it does contain a namespace, then the object to inject into the field is the object with that name. If the class has the annotation and one of the `public static final` fields does not, then the resource path of the object's name is taken to be the field's name. The type of the registry is taken from the type of the field. | ||
It is possible to have Forge inject registered object from registries into the `public static` fields of classes. This is done by annotating classes or fields with `@ObjectHolder` and supplying enough information to construct a `ResourceLocation` that identifies a specific object in a specific registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section should take a back seat to a section about RegistryObject
which should also be documented. If you are injecting third-party entries this is the far superior way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I only recently learned that RegistryObject
s can be instantiated; I thought that it was a DeferredRegister
class.
I'm going to make a new section on this.
Also, everything in here is relevant for 1.14.x too, so it should target that branch. |
Since 1.14.x is essentially the same as 1.15.x in terms of registries, I'll integrate these reviews into the 1.14.x branch and close this PR. Thank you. |
Rewrote the documentation for [Concepts > Registries]:
This is an update of my earlier PR for 1.14.x. See that PR for earlier reviews.
Closes #275 and #85.