BLOCK_PLACE or USE_ITEM packets are missing blockposition
Opened this issue ยท 3 comments
Describe the bug
When a player sends a block place packet they also include the location of the block in the packet, I am unable to obtain said location from the packet using protocol lib for one reason or another. I tried reading the USE_ITEM packet also but to no avail.
To Reproduce
if(e.getPacketType() == USE_ITEM){
Bukkit.broadcastMessage(e.getPacketType().name());
BlockPosition bp =e.getPacket().getBlockPositionModifier().readSafely(0);
Bukkit.broadcastMessage(bp + " "
+ e.getPacket().getFloat().readSafely(0)
+ " " + e.getPacket().getIntegers().readSafely(0)
+ " " + e.getPacket().getDoubles().readSafely(0)
+ " " + e.getPacket().getShorts().readSafely(0)
+ " " + e.getPacket().getStrings().readSafely(0));
//all will be null
}else if(e.getPacketType() == BLOCK_PLACE){
Bukkit.broadcastMessage(e.getPacketType().name());
BlockPosition bp =e.getPacket().getBlockPositionModifier().readSafely(0);
Bukkit.broadcastMessage(bp + " "
+ e.getPacket().getFloat().readSafely(0)
+ " " + e.getPacket().getIntegers().readSafely(0)
+ " " + e.getPacket().getDoubles().readSafely(0)
+ " " + e.getPacket().getShorts().readSafely(0)
+ " " + e.getPacket().getStrings().readSafely(0));
//all will be null
}
Expected behavior
a not-null block position or int/double/float fields from one of the packets. Seems like the use item packet (hand,timestamp) is both of these protocollib packets.
Screenshots
If applicable, add screenshots to help explain your problem.
Version Info
ProtocolLib Version: ProtocolLib v4.6.0-SNAPSHOT-b472
Bukkit Version: 1.16.1-R0.1-SNAPSHOT
Server Version: git-Paper-130 (MC: 1.16.1)
Java Version: 13.0.2
use item is just the right click, it just has the hand: https://wiki.vg/Protocol#Use_Item
block place contains the position https://wiki.vg/Protocol#Player_Block_Placement
maybe its encoded as a vec3?
Both of these packets are identical in protocol lib, both are in the format of the use item packet, timestamp and hand.