Negative varints are not handled correctly because in Python, numbers are represented with infinite bits instead of 32 or 64, meaning right shift including sign bits does not exist, meaning this implementation only does regular right shift. This causes varints (at the moment) to be able to handle positive integers from 0 to 2 ** 35 - 1 instead of the true range minecraft uses of integers from -2 ** 31 to 2 ** 31 - 1. I predict no one has noticed this before because in this script's usual function, the varint implementation is only used for reading text length, and since text length is never negative it has never been noticed.
Negative varints are not handled correctly because in Python, numbers are represented with infinite bits instead of 32 or 64, meaning right shift including sign bits does not exist, meaning this implementation only does regular right shift. This causes varints (at the moment) to be able to handle positive integers from 0 to 2 ** 35 - 1 instead of the true range minecraft uses of integers from -2 ** 31 to 2 ** 31 - 1. I predict no one has noticed this before because in this script's usual function, the varint implementation is only used for reading text length, and since text length is never negative it has never been noticed.