help required with mob coding (making mob detect sudden moves)

Started by Magadeer_og on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
help required with mob coding (making mob detect sudden moves)
Fri, 10/22/2021 - 02:00 (edited)

so ive searched through all the forms and browsed through everything related to this topic and nothing seemed to have worked or really help me. to put it simply I'm trying to code a mechanic where a mob would not attack a player if they are moving while sneaking/crouching or not moving at all. I'm trying to code it for 1.16.5 and my mcreator version is 2021.2.

 

event trigger: (no external trigger)

if: [is {event/target entity} sneaking] = false, 

do: ( if: [x velocity of {event/target entity} (does not =) 0,

do: return=true),

return=false

 

this is last attempted code to make this mechanic work, its meant to be a condition for the AI and honestly i cant see what's wrong with it and why it is not working

Edited by Magadeer_og on Fri, 10/22/2021 - 02:00
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could try by setting the…
Fri, 10/22/2021 - 02:18

you could try by setting the mobs attack to 0, and make it target player. then when entity attacks trigger

if event target entity is type: Player

do deal damage # to event target entity

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oh sorry, put an AND is…
Fri, 10/22/2021 - 02:18

oh sorry, put an AND is event target entity crouching

on the if condition