I need help(again)

Started by ILikeAlienDinosaurs on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need help(again)

I want to make a mob attack when it isn’t being looked at. I need a metric butt-ton of help though.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Getting the entity to attack…
Fri, 10/13/2023 - 15:37

Getting the entity to attack or not attack based on a condition is possible; you can use the 'set attack target' function to make the entity hostile towards the player. Deaggroing it is trickier, but also possible, you can summon an invisible, unkillable entity and have the mob target that instead, then despawn the invisible entity. It's awkward, but it works. 

The tricky part here is the look condition. You can get the vector of the player's look direction, and the block they're looking at... but getting the entity will require math. You can use the x/y/z look-angle-vector functions for the player to get the individual components of the direction they're looking at, but you then need a function to somehow check if your mob's position is along the look angle vector of the nearest player. I've done a bit of work with trig functions and entities, but this would probably be a lot more difficult. Smarter people than myself might be able to provide an explanation on how to actually write this. But yes, essentially, a function that checks if the mob's position is within a certain range of the player's look vector.

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Uhh very confusing, but…
Mon, 10/16/2023 - 17:14

Uhh very confusing, but thanks

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, any idea how to make a…
Mon, 10/16/2023 - 17:14

Also, any idea how to make a bleed effect that changes the texture of your healthbar?