The Registrar#register() method should return the same generics that were passed into the parameters, rather than the registry generics. For example, doing PARTICLE_TYPES.register(name, () -> new SimpleParticleType(false)); returns a RegistrySupplier<ParticleType<?>>, which is fine in a lot of cases, but sometimes RegistrySupplier<SimpleParticleType> is needed, such as when using a @ModifyExpressionValue mixin to replace a vanilla particle field call. Because the mixin handler must return the same type as the field being replaced, e.g., SimpleParticleType.
The
Registrar#register()method should return the same generics that were passed into the parameters, rather than the registry generics. For example, doingPARTICLE_TYPES.register(name, () -> new SimpleParticleType(false));returns aRegistrySupplier<ParticleType<?>>, which is fine in a lot of cases, but sometimesRegistrySupplier<SimpleParticleType>is needed, such as when using a@ModifyExpressionValuemixin to replace a vanilla particle field call. Because the mixin handler must return the same type as the field being replaced, e.g.,SimpleParticleType.