Package net.minecraftforge.registries
Class ObjectHolderRegistry
java.lang.Object
net.minecraftforge.registries.ObjectHolderRegistry
Internal registry for tracking
ObjectHolder
references-
Field Summary
Modifier and TypeFieldDescriptionprivate static org.apache.logging.log4j.Logger
private static org.objectweb.asm.Type
private static org.objectweb.asm.Type
private static Set<Consumer<Predicate<ResourceLocation>>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addHandler(Consumer<Predicate<ResourceLocation>> ref)
Exposed to allow modders to register their own notification handlers.static void
static void
applyObjectHolders(Predicate<ResourceLocation> filter)
static void
static boolean
Removed the specified handler from the notification list.private static void
scanClassForFields(Map<org.objectweb.asm.Type,String> classModIds, org.objectweb.asm.Type targetClass, String value, Class<?> clazz, boolean extractFromExistingValues)
private static void
scanTarget(Map<org.objectweb.asm.Type,String> classModIds, Map<org.objectweb.asm.Type,Class<?>> classCache, org.objectweb.asm.Type type, String annotationTarget, String value, boolean isClass, boolean extractFromValue)
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
objectHolders
-
OBJECT_HOLDER
private static final org.objectweb.asm.Type OBJECT_HOLDER -
MOD
private static final org.objectweb.asm.Type MOD
-
-
Constructor Details
-
ObjectHolderRegistry
public ObjectHolderRegistry()
-
-
Method Details
-
addHandler
Exposed to allow modders to register their own notification handlers. This runnable will be called after a registry snapshot has been injected and finalized. The internal list is backed by a HashSet so it is HIGHLY recommended you implement a proper equals and hashCode function to de-duplicate callers here. The default @ObjectHolder implementation uses the hashCode/equals for the field the annotation is on. -
removeHandler
Removed the specified handler from the notification list. The internal list is backed by a hash set, and so proper hashCode and equals operations are required for success. The default @ObjectHolder implementation uses the hashCode/equals for the field the annotation is on.- Returns:
- true if handler was matched and removed.
-
findObjectHolders
public static void findObjectHolders() -
scanTarget
-
scanClassForFields
-
applyObjectHolders
public static void applyObjectHolders() -
applyObjectHolders
-