Development Assistance Riding NMS entity not working

Discussion in 'Plugin Help/Development/Requests' started by KingOfAdventure, May 13, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    KingOfAdventure

    Hi guys,

    I have a problem when trying to ride a NMS entity, when I use the following code, the player will ride the entity for the server but doesn't for the client self. When you try to move you will be set back to the entity in the riding position while you don't ride it as the client. Also, no entity ride packets will be send when this happens.
    I have tried using this code:

    Code:
    ((EntityHuman) ((CraftPlayer) pl).getHandle()).mount(myCustomEntity);
    //And this
    myCustomEntity.getBukkitEntity().setPassenger(player);
    With both ways it still gives the same result as said above.

    Any help and ideas are helpful :)!

    Edit: I'm using 1.8 spigot
     
    Last edited: May 13, 2015
  2. Offline

    Zombie_Striker

    Try getting the actuall Player instead of Craftplayer and use Entity#setPassager(Player);
     
  3. Offline

    KingOfAdventure

    Thanks for the reply :) @Zombie_Striker , I have tried this :


    Code:
    // player is the org.bukkit.entity.Player class
    myNmsEntity.getBukkitEntity().setPassenger(player);
    But is still gives the same result... I may have to make my entity ridable or something, my custom entity is :


    Code:
    public class CustomEntityBlaze extends EntityBlaze{
      
        public CustomEntityBlaze(World world) {
            super(world);
        }
        //To double the velocity
        public void g(double d0, double d1, double d2) {
            this.motX += d0*2;
            this.motY += d1*2;
            this.motZ += d2*2;
         
        }
    }
    To spawn it :


    Code:
    myNmsEntity = new CustomEntityBlaze(world);
    world.addEntity(myNmsEntity);
    myNmsEntity.setPosition(location.getX(),location.getY(),location.getZ());
    Edit: I think if I find a way to send a ride packet it will work. When I set a zombie as passenger it works fine, but I think I need to send a mount packet to the player in order to get the client to work. Does anyone know how you can send that kind of packet with ProtocolLib 1.8?
     
    Last edited: May 14, 2015
  4. Offline

    Zombie_Striker

    @KingOfAdventure set the Player as the passenger for the Zombie. You could also set a SilverFish/Endermite to replace the zombie, because they are smaller and closer to the actual custom entity.
     
  5. Offline

    KingOfAdventure

    @Zombie_Striker Thanks for the suggestion, but I need to recieve a custom ride event from a custom Armor Stand...

    Some more details about the problem:
    When I spawn and set a Zombie as passenger it works. The zombie is riding the ArmorStand. I can see it because the legs are in the riding position. I have been testing this with an armor stand since that doesn't evolve difficult things, but when I tried a pig, it was not existing for me as client, but is was existing on the server since the server was sending pig sounds when I was around. Maybe this has something to do with variable that I don't set in the constructor.
     
  6. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  7. Offline

    KingOfAdventure

    Uhm, wait, this is not a Bukkit alternative I think, this is more a bug in my code since a plugin called Echopets have done this...
     
    Last edited: May 14, 2015
  8. Offline

    timtower Administrator Administrator Moderator

    How is Spigot or 1.8 for that sake not an alternative if I may ask?
     
  9. Offline

    KingOfAdventure

    Sorry, I thought that post about spigot were allowed here, but I was wrong... Btw, I'm using the craftbukkit part of spigot so technicly this is about craftbukkit...
     
  10. Offline

    timtower Administrator Administrator Moderator

    @KingOfAdventure Yet it is 1.8, don't recall that the Bukkit team released that
     
  11. Offline

    KingOfAdventure

Thread Status:
Not open for further replies.

Share This Page