Solved Packets? whats wrong?

Discussion in 'Plugin Development' started by jolbol1, Apr 9, 2015.

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

    jolbol1

    Get an error in my IDE
    Code:
    PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(effect,(float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
    Cant resolve constructor? Whats the fix?
     
  2. Offline

    dlange

    @jolbol1 I believe it is PacketPlayerOutWorldParticles(EnumEffect, v, v2, v3, ,v4, v6, v7, v8, v9)

    i.e:
    PacketPlayOutWorldParticles(EnumParticle.PORTAL, false, (float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z), 0, 0, 0, 0, 1);
     
  3. Offline

    CheesyFreezy

    Somewhere in the arguments you've got to set a Player, for who the particle plays. I thought the first argument, but i'm not sure.
     
  4. Offline

    dlange

    @CheesyFreezy To send the packet to a player you use ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet)
     
  5. Offline

    CheesyFreezy

    @dlange, i know but in the PacketPlayOutWorldParticles you have to set a Player in one of the arguments.
     
  6. Offline

    dlange

    @CheesyFreezy Not from what i have used... This is what i do for particles.

    Code:
                PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(enumParticle
                        , false, (float) (loc.getX()), (float) (loc.getY()), (float) (loc.getZ()), 0, 0, 0, 0, 1);
                for (Player player2 : Bukkit.getServer().getOnlinePlayers()) {
                    ((CraftPlayer) player2).getHandle().playerConnection.sendPacket(particles);
                }
    
     
  7. Offline

    CheesyFreezy

    @dlange ow my wrong, i read something wrong, i made a custom Method where it plays a particle and you had to set a Player in that method xD. Ignore me..... feeling stupid
     
    dlange likes this.
  8. Offline

    Msrules123

    This is for spigot users.
     
  9. Offline

    dlange

    @Msrules123 Ah yes, i use spigot haha that is probs why it was different to what most threads out there said when i tried to learn haha
     
    Msrules123 likes this.
  10. Offline

    jolbol1

    Im on spigot too so this worked, Thanks for the help. One last thing. I have a list of entities and would like to set their health and get their health. I have done for(Entity e : myEntities) but there is no e.getHealth or e.setHealth.
     
    dlange likes this.
  11. Offline

    dlange

    @jolbol1 Could you post what you have tried here?
     
  12. Offline

    jolbol1

    So i have this
    for(Entity e : entities) {


    Code:
      for(Entity e : entities) {
                     
                        if(!e.hasMetadata("vortex")) {
                         
                         
    
    
                        }
                    }
    What I want to do is damage all entities in that list by a certain amount.
     
  13. Offline

    dlange

    @jolbol1 ah sorry but i haven't mad much experience with Entities and their MetaData, i'm afraid i won't be on much help in this situation ;c
     
  14. Offline

    jolbol1

    Solved using LivingEntity.
     
  15. Offline

    nverdier

    @jolbol1 Please mark your thread as solved. See this for more info.
     
Thread Status:
Not open for further replies.

Share This Page