Closed Chubel10 closed 4 years ago
Sorry for the long wait, I looked at this when you made it but didn’t accept it (because of the following reasoning). I didn’t close it either because I wanted to give some reasoning for closing it but haven’t had much free time.
Entities don’t exist when items are registered (the registry order is blocks -> items -> everything else in alphabetical order) so a reference to the entity type rather than the type itself (which would be null
at the time) needs to be passed to the egg. Therefore I pass ModEntityTupes.WILD_BOAR
(a RegistryObject<EntityType>
is effectively a Supplier<EntityType>
I.e. a reference to the EntityType
) to the egg. Calling get
on the EntityType
when the egg is being registered would yield null
and cause issues or crashes (NPEs or registry issues) later down the line.
Since ModEntityTypes.WILD_BOAR is of type RegistryObject<EntityType>. I thought that maybe it was incorrect because .get() need to get called in order to return the EntityType.