Fabric API

Fabric API

108M Downloads

Allow registering argument types without interacting with the class map

haykam821 opened this issue ยท 0 comments

commented

In Minecraft 1.18.2, argument types can be registered to using a helper method:

ArgumentTypes.register(id.toString(), CustomArgumentType.class, serializer);

In Minecraft 1.19, registering an argument type is more difficult than simply registering to the registry because the class map (a private field) must also be modified:

Registry.register(Registry.COMMAND_ARGUMENT_TYPE, id, serializer);
ArgumentTypesAccessor.getClassMap().put(CustomArgumentType.class, serializer);

Ideally, Fabric API should provide a helper method that registers an argument type without requiring a stringified identifier or private access to ArgumentTypes.CLASS_MAP.