Skip to content

unable to get the byte array of chunk packet #1852

Closed
@ham1255

Description

@ham1255

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
has chunk packet contains an byte array for chunk data as per wiki.vg
so created that code can be seen below , to get that packet. then getting byte array
which throws com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
due fact getByteArrays is empty.

API method(s) used
PacketContainer#getByteArrays()
StructureModifier#read(int fieldIndex)

Expected behavior
should return the byte array?

Code

protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.LOWEST, PacketType.Play.Server.MAP_CHUNK) {
            @Override
            public void onPacketSending(PacketEvent event) {
                byte[] data = event.getPacket().getByteArrays().read(0);
            }
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions