Solved Trying to make an arrow look like a silverfish

Discussion in 'Plugin Development' started by NonameSL, Jul 9, 2014.

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

    NonameSL

    I have tried a bunch of ways to try and make my arrow look like a silverfish:

    1. Searched a way to disguise projectiles - didnt find one.
    2. Tried to send a PacketPlayOutEntityDestroy with the arrow, and make the silverfish it's passenger - the silverfish went flying down.
    3. Tried to not modify the arrow, and just make the silverfish it's passenger - Kills the silverfish / lets it survive.
    How can I fix my problem?
    Thanks in advance! [cake][cake][cake]
     
  2. Offline

    dsouzamatt

    NonameSL Maybe you could remove the arrow and spawn a silverfish in place of it, with the arrow's velocity?
     
  3. Offline

    welsar55

    dsouzamatt I do this with one of my plugins but I think he wants damage like a arrow.
     
  4. Offline

    NonameSL

    dsouzamatt IDK why now it is spawning 7 silverfish that die instantly. My code:
    Code:java
    1. Arrow arrow = player.launchProjectile(Arrow.class);
    2. Silverfish silverfish = (Silverfish) player.getWorld().spawnEntity(player.getLocation(), EntityType.SILVERFISH);
    3. arrow.setPassenger(silverfish);
    4. //MobSpeedModyfier.setSpeed(silverfish, 0.3);
    5. silverfish.setMaxHealth(1D);
    6. silverfish.setHealth(1D);
    7. silverfish.setVelocity(arrow.getVelocity());
    8. PacketManager.destroyEntity(arrow);

    destroyEntity method:
    Code:java
    1. PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]{id});
    2. for(Player p : Bukkit.getOnlinePlayers())sendPacket(p, packet);
    3.  


    dsouzamatt That is exactly what I want.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    TheMrGong

    Try making the silverfish ride the arrow BUT listen for an silverfish being damaged by an arrow and if so cancel it.
    Because you CAN ride an arrow as a player in creative.
     
  6. Offline

    TheHandfish

    Are packets necessary at all? Why not spawn the creature, set his velocity to the arrow's, remove the arrow, then remove the silverfish using a Delayed Task?
     
  7. Offline

    TheMrGong

    TheHandfish the velocity from mobs and the velocity for projectiles are different.
     
  8. Offline

    Zupsub

    You can hide the arrow using ProtocolLib. There's a tut out here.
     
  9. Offline

    libraryaddict

    Actually Lib's Disguises allows you to disguise all entities.
    You can disguise a arrow as a silverfish.
    And a silverfish as a arrow.

    Rather simple.

    DisguiseAPI.disguiseToAll(arrow, new MobDisguise(DisguiseType.SILVERFISH));
     
    NonameSL likes this.
Thread Status:
Not open for further replies.

Share This Page