PacketPlayInUseEntity help

Discussion in 'Spigot Plugin Development' started by ckamps2020, May 22, 2016.

  1. Hey there!

    I'm trying to get the right click of a villager that I spawn in! In the code below I am using a command to test the spawning, and it works perfectly. I have been looking, and found the packet I need to use but I am not sure the correct format to detect it.

    Code (Text):
    if (cmd.getName().equalsIgnoreCase("test")) {
                CraftPlayer p = (CraftPlayer) player;
                Location loc = player.getLocation();
                WorldServer world = ((org.bukkit.craftbukkit.v1_8_R3.CraftWorld) loc.getWorld()).getHandle();

                EntityVillager villager = new EntityVillager(world);
                villager.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
                villager.setCustomName(ChatColor.GREEN + "Packet V");

                PacketPlayOutSpawnEntityLiving packedt = new PacketPlayOutSpawnEntityLiving(villager);

                p.getHandle().playerConnection.sendPacket(packedt);
            }
     
  2. Bump. Still need some help with this.