Code that previously works now throws an error.
dniym opened this issue ยท 0 comments
Make sure you're doing the following
- [x ] You're using the latest build for your server version
- [x ] This isn't an issue caused by another plugin
- [ x] You've checked for duplicate issues
- [x ] You didn't use
/reload
Describe the question
I have a bit of code that detected what entity a player was interacting with which worked in previous implementations however it throws a runtime error now.
API method(s) used
Listening to the USE_ENTITY packet
event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
Expected behavior
should give an entity object based upon the entity sent from the client.
Code
ProtocolLibrary.getProtocolManager().addPacketListener(
new PacketAdapter(plugin, PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent event)
{
try {
Entity entity = event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
//do stuff with entity
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
}
}
}
Additional context
Code worked without throwing a runtime error previously, now in 1.17 with the latest jenkins build of protocollib this error fires whenever a player right clicks on an entity.