feather
feather copied to clipboard
Feature QueryBlockNbt
Feature Request
Implement rudimentary support for the QueryBlockNbt packet.
Description
Implement rudimentary support for the QueryBlockNbt request. When a player/client presses Shift+F3+I the overview specifies what block the players is looking at. This is done by sending this request to the server. The client specifies a xyz of a block it would like to query.
It is one of 33 packets in feather/server/src/packet_handlers.rs that are not handled.
Describe the solution you'd like
To implement this feature properly we would have to check for line of sight, else a hacked client could use this feature for x-ray and player radar. The minimal viable solution is to just check that the block in question is within a, lets say, 6 block radius of the caller.
Allowing a client to query any arbitrary position is probably a bad idea anyway, because timing of the response could tell if a chunk is loaded or not. Therefore we should never allow someone to call this on a position further away then max render distance.
The file feather/common/src/world.rs:122 has a function for querying the world about a block position. And it is accessible through the variable game.
I have twice noticed that people have tried implementing this feature but hit the same issue. The client appears to never send the packet, even if pressing Shift+F3+I. The current theory is that it has something to do with opt levels. I don't understand what the issue is, but for anyone interested here is a link to the last time it was mentioned in the discord. https://discord.com/channels/619316022800809995/805342116057579520/890973148516843571
The first problem is to even get the client to send the packet the client needs to be send a packet telling it that it's OP level >= 3, There is also no concept of block NBT data yet. So that would have to be implemented to properly implement this.