Step by step guide on setting up entity "behaviour"

Discussion in 'Plugin Development' started by BeastyBoo, Aug 5, 2019.

  1. Offline

    BeastyBoo

    Hello there!

    I'm trying to add a sort of behaviour to all AbstractHorse entities. Basically, I have made a plugin where you can claim AbstractHorses, and their UUID, owners uuid, speed, jump strength etc gets stored in an object, which again gets stored in files etc..

    Another field I have in my object though, is an enum personality field. When you claim an entity, it gets a random personality out of the selection of 4 personalities.

    What the personalities does is either one of these things listed below when a human comes within 10 block radius of the AbstractHorse entity:
    Personality 1 = 40% chance of running toward human
    Personality 2 = 80% chance of running toward human
    Personality 3 = 40% chance of running from human
    Personality 4 = 80% chance of running from human

    Now, I need help setting up the part where they either run towards or from the human, I've tried some stuff but not sure if playerMoveEvent is enough, or if I need to create custom AI's.

    Please help me out, giving me a step by step guide, or something to start out of.

    Kind regards <3
     
  2. Offline

    Machine Maker

    This might be out of date, but you will probably want to use some NMS or Reflection to actually create ai. That will be better than the Move event.

    Here is a video as well.
     
  3. Offline

    The_Xman249

    I think you can use horse.setTarget(player) , if you get the horse object .
     
  4. Offline

    BeastyBoo

    Ehm, Already tried some of this, however it is not efficient. And im not sure how I would setup the AI for EntityHorseAbstract class to make it do what I want. Which is why I wondered if anyone could setup a quick little todo list for me :p


    @The_Xman249 @Machine Maker
     

Share This Page