Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to get the byte array of chunk packet #1852

Closed
4 tasks done
ham1255 opened this issue Aug 15, 2022 · 1 comment
Closed
4 tasks done

unable to get the byte array of chunk packet #1852

ham1255 opened this issue Aug 15, 2022 · 1 comment

Comments

@ham1255
Copy link

ham1255 commented Aug 15, 2022

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);
            }
        });
@Aurelien30000
Copy link

This format with a simple byte array is obsolete, see #1592

@ham1255 ham1255 closed this as completed Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants