Started by
MTOH
on
Topic category: Help with Minecraft modding (Java Edition)
Hello guys!
I am making a mod and want to make an aggressive mob that sleeps whenever it hasn't got a target and is wounded. With sleeping I mean playing a sleeping animation, getting regen 1 and sitting still until it is healed or finds a target. I have tried to program it myself twice but it always doesn't work.
Does anyone have an idea what to do?
Cheers!
Hi,
There is a lot of ways to do this, but first I am curious if you are using the Geckolib plugin or not. If not, it is a different process.
If you are using Geckolib, I would recommend looking into it as you could make a procedure that whenever it becomes low on health and there is no player nearby (using an if block to check it's health and then checking if players are nearby) then you can use a Geckolib block to make it play an animation, and give it regen until it finds a target. Here is a great Geckolib forum topic that should help you: https://mcreator.net/forum/93274/tutorial-how-use-nerdys-geckolib-plugin-40-20224
Cheers MTOH!
Hello MrChicken,
Yeah, I am using the Geckolib plugin to make custom animations. I have tried something similar but it did not seem to work. Maybe I did the execution poorly, but I will surely try again. By the way, could you tell me which block detects players and, if it exists, a block to prevent the mob from moving, because I cannot seem to find them.
Thanks for the help!
Cheers!
World data section.
In the bottom of the world data procedures section theres the get nearest entity and the does entity exist block.
Thank you, McModded!
Update:
I made the entity be able to sleep and it is ok, but if it's not too much work could you tell my clueless butt how to lock the head rotation, because it is turning around while it is sleeping.
Im not quite sure but I know 3 procedure blocks that might help.
1: Entity Data, Head pitch of event/target entity in degrees
2: Entity Management, set rotation of event/target entity yaw: num pitch num
3: Entity Management, make event/target entity look at x y z
Thank you!