Bug Closed · Resolved

Random Death Animation

#4431 opened by Unknown 2 years ago

Unknownreported this bug

This does not happen often but sometimes when a mob with a model spawns, the death animation will instantly play and from that point on, the model is stuck on the last frame of the death animation. It'll still walk around and attack (if it's hostile). Basically, acting like a normal mob. The only thing I can think of that may be causing it is setting the mob's max health and health:

mob.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(30D);
mob.setHealth(30D);

But it's too random and out of nowhere to really understand what is going on.

Unknowncommented

Would be nice if there is a consistent way to replicate that, but I will take a look if setting health causes that.

Unknowncommented

If it helps, I am applying the model in a spawn consumer. Maybe that has something to do with it? I found out it also happens to mobs where I don't change any of their attributes, so I don't think that's it.

This is the code that is being used in a spawn consumer that it has happened with:

            ModeledEntity modeled = ModelEngineAPI.createModeledEntity(e);
            modeled.setBaseEntityVisible(false);
            ActiveModel model = ModelEngineAPI.createActiveModel("model");
            modeled.addModel(model, true);
Unknowncommented

Sorry for the late reply. It just occurred to me that the summon command is also using consumers now, and I have been spamming the command for quite a bit without any problems. Is it possible that you are spawning the entity from an async thread or something weird?

Sign in to join the discussion.