1.7.10 Using NMS to create NPCs (1.7.10)

Discussion in 'Spigot Plugin Development' started by BigWaveSurfer, Mar 31, 2020.

  1. According to the error, PacketPlayOutPlayerInfo takes 0 arguments. You put one argument in there when it expected nothing.
  2. With due respect, the spigot 1.7 api is not supported in that forum in the theory. The only thing I can tell u; use the latest spigot api

    Enviado desde mi Redmi Note 7 mediante Tapatalk
    • Agree Agree x 1
  3. His problem has nothing to do with the Spigot API...
    • Agree Agree x 1
  4. I think I fixed it.
    When I removed the arg it asked for one again. Its weird...

    I'll send code snips if it works. Just have to test on server.
  5. I know, but read the rules...

    Enviado desde mi Redmi Note 7 mediante Tapatalk
  6. It works.

    Code (Java):
            public void getKitmap(Player p, double x, double y, double z, float yaw, float pitch){
                    MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
                    WorldServer world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();

                    UUID uuid = UUID.fromString("2ab2e9c5-37ee-452e-8801-8696b3a1f76c");

                    EntityPlayer npc = new EntityPlayer(server, world,
                            new GameProfile(uuid, "Click to Join!"),
                            new PlayerInteractManager(world));

                    npc.setLocation(x, y, z, yaw, pitch);

                    PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(npc, (byte) ((yaw * 256.0F) / 360.0F));

                    PlayerConnection connection = ((CraftPlayer)p).getHandle().playerConnection;

                    connection.sendPacket(new PacketPlayOutPlayerInfo().addPlayer(npc));
                    connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));

  7. @BigWaveSurfer If you want to write or read data from a packet and there isn't an available constructor, what you could do is use a PacketDataSerializer to serialize data so that it can be stored to and read from packets.

    @SolitaSolaa As I said, his problem has nothing to do with the Spigot API. Telling him to update his API version will not solve his problem. Questions about NMS is common on the forum and I don't see how that violates any rule. The version tag in front of thread titles are there for a reason.