1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Creating mountable entities

Discussion in 'Development' started by SteveDev386, Mar 6, 2018.

  1. SteveDev386

    SteveDev386 Silverfish

    Messages:
    17
    GitHub:
    dschwartz783
    I'm somewhat on the right track I think, but I'm looking to make certain entities mountable. The
    InteractPacket::ACTION_MOUSEOVER seems to be what I need to check for, but I'm not sure what to do at that point to make the mount button show up. If anyone has a clue, I'm all eyes. Thanks.

    EDIT: I might be completely wrong about needing to check for that, now that I think about it. Meh.
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Have you tried using the Entity::DATA_INTERACTIVE_TAG metadata? I think that should be it.
    PHP:
    /**@var Entity $entity */
    $entity->getDataPropertyManager()->setString(Entity::DATA_INTERACTIVE_TAG"Button Text");
     
  3. SteveDev386

    SteveDev386 Silverfish

    Messages:
    17
    GitHub:
    dschwartz783
    How exactly do you get the client to take it? I've tried setting it before I call spawnToAll() because there seems to be some logic in there that does it, but I haven't managed to get the button to show up yet.
     
  4. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Actually, you have to set the interactive tag to the viewer of the entity, rather than the entity itself. :p
     
    Muqsit likes this.
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Oh, interesting. Does this require listening to InteractPacket?
     
  6. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    To make this work properly without too many hacks an API is required, on mouse over in interact packet you should set an interact tag to the player if the entity has one, and if the entity does not, you remove the interact tag. Without the API you can't do that for every entity however, because an entity AI may have it implemented as well, and you'll have to do some hacky delayed task.
     
  7. SteveDev386

    SteveDev386 Silverfish

    Messages:
    17
    GitHub:
    dschwartz783
    Well, I can also just use the DataPacket events and process the packets manually. Also kinda hacky, but also kinda works. ¯\_(ツ)_/¯
    Seems obvious now that you mention it... The button is displayed to the player. Oh well. xD
     
    Last edited: Mar 6, 2018
  8. SteveDev386

    SteveDev386 Silverfish

    Messages:
    17
    GitHub:
    dschwartz783
    Does anyone know exactly how to get mounting to work?
     
  9. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You could have a look at BlockPets, I implemented it in the `BasePet` class there.
     
    NickTehUnicorn likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.