ViaRewind icon indicating copy to clipboard operation
ViaRewind copied to clipboard

Fix block data values for BLOCK_CRACK and BLOCK_DUST particles for 1.7 players

Open ShinyDialga opened this issue 4 years ago • 0 comments

1.7 clients send block ids from particles as (block id + (4096 * data value)), which breaks the BLOCK_CRACK and BLOCK_DUST (TILE_BREAK and TILE_DUST for 1.8 spigot) particles for any block data values > 0. For these particles, viarewind currently reads the data value as 0 no matter what, and reads the id as it is provided by the client.

To give an example of how this breaks, we'll use orange wool (id 35, data value: 1). The current viarewind gives an id of (35 + (4096 * 1)) = 4131, and a data value of 0. Since the id 4131 isn't in any valid range of ids, the packetwrapper cancels.

This PR takes the modulo of the id to remove the data value from the id, and divides the id by 4096 to get the data value from the id. This fixes issue #92

ShinyDialga avatar Mar 23 '21 03:03 ShinyDialga