ProtocolLib

3M Downloads

How can I read a Enum/Varint

Nerd10000 opened this issue · 4 comments

commented

kép

commented

I want to read the Type field

commented

Hello,
For exemple from my function :

public static PacketContainer createPacketNES(UUID uuid, int entityID, Location location) {
    PacketContainer nesPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
    nesPacket.getModifier().writeDefaults();
    var spawnPacketModifier = nesPacket.getModifier(); // to get Values uses .getValues()

    spawnPacketModifier.write(0, entityID);
    spawnPacketModifier.write(1, uuid);
    spawnPacketModifier.write(2, 122); // ID for player
    spawnPacketModifier.write(3, location.getX());
    spawnPacketModifier.write(4, location.getY());
    spawnPacketModifier.write(5, location.getZ());
    spawnPacketModifier.write(6, getCompressedAngle(location.getYaw()));
    spawnPacketModifier.write(7, getCompressedAngle(location.getPitch()));

    return nesPacket;
}
commented

Okay is there a website where I can read the Entity IDs?

commented

From my issue #2856

By following the documentation that you can find here: https://wiki.vg/Protocol#Spawn_Entity it seems that index 2 is now a VarInt corresponding to https://wiki.vg/Entity_metadata#Player.