how do I make my hostile entity sleep

Started by MTOH on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do I make my hostile entity sleep

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!

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi,   There is a lot of ways…
Mon, 05/22/2023 - 14:36

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!

 

 

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello MrChicken, Yeah, I am…
Mon, 05/22/2023 - 19:46

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!

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
World data section. In the…
Mon, 05/22/2023 - 20:06

World data section.

In the bottom of the world data procedures section theres the get nearest entity and the does entity exist block.

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you, McModded!
Tue, 05/23/2023 - 12:28

Thank you, McModded!

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Update: I made the entity be…
Tue, 05/23/2023 - 14:06

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.

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Im not quite sure but I know…
Tue, 05/23/2023 - 20:33

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

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you!
Wed, 05/24/2023 - 05:08

Thank you!