Fabric API

Fabric API

106M Downloads

Living Entities cannot be spawned unless they exist in a final ImmutableMap [1.16 builds]

JSJBDEV opened this issue ยท 6 comments

commented

A LivingEntity cannot be spawned and results in an error like this https://hastebin.com/uwizotumay.css (this entity extends PigEntity) It has been deduced that the reason this is is because in newer version every MC mob has been added to an immutableMap DEFAULT_ATTRIBUTE_REGISTRY = ImmutableMap.builder().put(EntityType.ARMOR_STAND, LivingEntity.createLivingAttributes().build()).put... in net\minecraft\entity\attribute\DefaultAttributeRegistry.java to register it default Attributes on spawn, as my entity doesnt exist in this list, a nullPointer is thrown and thus it doesnt spawn.

From what I can see this means you MUST use a Mixin to register mobs correctly for them to spawn, so it would preferable if there was a direct way to add entries to this map.
[B0undaryBreaker reccommened I file this here, conversation happened on the Fabric discord]

commented

Oh my god... this following the structure map...

Mojang... why?!

commented

This should probably go into FabricEntityType stuff, I think.

commented

ImmutableMaps, yay

commented

FabricDefaultAttributeRegistry is already a thing, does this not cover what your after?

commented

Can't say I knew that existed, no one else mentioned it either, Ill see if it works for that, I will say, I was following the old tutorial on the fabric website.

commented

By the looks of it that works, Maybe I'll right a mob tutorial or something for 1.16 if I get through it, thanks!