Solved The setPassenger(); does not work under water

Discussion in 'Plugin Development' started by MrRandom37, Aug 6, 2017.

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

    MrRandom37

    Hello everyone,

    I am developing a plugin that is designed to put an ArmorStand on a Squid. For this, I use the famous line:

    Code:
    squid.setPassenger(armorstand);
    This line works perfectly but the problem is that when the Squid plunges into the water (from 2 blocks deep) is ArmorStand this detaches from the Squid and falls into the water.

    So, how to "block" the setPassenger() so that when the Squid goes down, the ArmorStand does not detach?

    Here is the code:

    Code:
    Squid squid = (Squid) p.getWorld().spawnEntity(p.getLocation(), EntityType.SQUID);
                           
    ArmorStand armorstand = (ArmorStand) p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
    EntityArmorStand eas = ((CraftArmorStand) armorstand).getHandle();
                           
    armorstand.setGravity(false);
    armorstand.setBasePlate(false);
    eas.setSmall(true);
    eas.setEquipment(4, new ItemStack(Item.getById(152)));
    eas.setHeadPose(new Vector3f(0f, 0f, 0f));
                           
    squid.setPassenger(armorstand);
    Thank you in advance for your answers.
     
  2. Offline

    MrGriefer_

    I don't think you can place armor stands in water.
     
  3. Offline

    MrRandom37

    Okay, but even for the player the squid can not suppress them.

    Would anyone have an idea ?
     
Thread Status:
Not open for further replies.

Share This Page