Package com.llamalad7.mixinextras.sugar
Annotation Interface Share
Allows you to share values between handler methods in the same target method. This is generally preferable to storing
the value in a field because this is thread-safe and does not consume any long-term memory.
You must provide an ID for the shared value and the annotated parameter's type must be one of the
LocalRef
family.
The parameter's name is irrelevant and only the ID in the annotation is used to share matching values.
The same reference objects will be passed to all handler methods requesting a given ID within a given target method invocation. IDs are per-mixin, and it is impossible to share a value between two mixins, so you don't need to worry about including your modid or anything similar in them.
Note: If a @Shared value is read from before it has been written to, no exception is thrown and it will simply return
the default value for that type (0, 0f, null, etc), much like a field.
See the wiki article for more info.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe id for this shared value.
-