Missing Importable Packets

Discussion in 'Plugin Development' started by Agentleader1, Apr 23, 2015.

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

    Agentleader1

    I saw some threads that I was interested in executing. Only issue was when I use the packets, they ask to "create class, etc."

    I'm missing; Packet29DestroyEntity, Packet24MobSpawn, Packet33RelEntityMoveLook, and probably a lot of others.
     
  2. Offline

    mine-care

    @Agentleader1 packets have changed names awhile ago and are no longer containing numbers in their names, they are marked as packetPlayOut(name) for outgoing packets and PacketPlayIn(name) for incoming packets.
    So the above will be
    PacketPlayOutEntityDestroy
    PacketPlayOutEntitySpawn
    PacketPlayOutEntityHeadRotation

    Not sure if I got the names correctly, I'm on phoney :3
     
  3. Offline

    Agentleader1

    @mine-care Thanks for telling me this. The first one exists, the second however, does not.
     
  4. Offline

    mine-care

    @Agentleader1 yes yes ik it is my bad :3 i didnt remember it at the time, it is PacketPlayOutSpawnEntity :p
    Alternatively, referinmg to living entities PacketPlayOutSpawnEntityLiving
    and there is always PacketPlayOutNamedEntitySpawn
    If you need further help let me know! :D
     
  5. Offline

    Agentleader1

    @mine-care Thank you so much. Another issue posed by The rel movement packet.

    PacketPlayOutEntity.a is not visible. How shall I fix this?

    Bump

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

    Konato_K

    @Agentleader1 You can use reflection to modify a private field
     
  7. Offline

    Agentleader1

    @Konato_K Do you know what the modified code would look like for this?:
    Code:
    Packet24MobSpawn packet = new Packet24MobSpawn()
    {
    packet.a = id; //Entity UDID
    packet.b = 50; //id for creeper
    packet.c = Math.floor(loc.getX() * 32d);
    packet.d = Math.floor(loc.getY() * 32d);
    packet.e = Math.floor(loc.getZ() * 32d);
    packet.f = (byte) loc.getYaw();
    packet.g = (byte) loc.getPitch();
    packet.h = packet.f;
    Field metadata = packet.getClass().getDeclaredField("i");
    metadata.setAccessible(true);
    metadata.set(packet, field);
    return packet;
     
  8. Offline

    mine-care

    @Agentleader1 Err be carefull since not only the packet names changed. Fields in them might have changed too! (not sure in whitch the change occurd but be careful)
    Anyway in your code above you get a field called i from the class, set it accessible, and then set it's value for the object packet to something called field :p
    instead of field you have to add the value and Kablam! you got it.
     
  9. Offline

    Agentleader1

    @mine-care So would it successfully set packet.a correctly in this:
    Code:
    Field metadata = packet.getClass().getDeclaredField("a");
    metadata.set(packet, id);
    ?
     
  10. Offline

    Gater12

    @Agentleader1
    It's not a public field so you have to set it to be accessible then set.
     
  11. Offline

    mine-care

    That :- ) You can look for "Reflection utils" that are classes with methods ment to do the work.
     
  12. Offline

    Agentleader1

    @mine-care A code example that WILL work for the above packet settings?
     
  13. Offline

    mine-care

    @Agentleader1 I dont really like to giveout code examples so:
    The structure:
    Create the packet object
    Create a Field that represents the field from the packet you want to change
    set it accessible
    and then set it to whatever value :p
     
Thread Status:
Not open for further replies.

Share This Page