stop reading when there is no item to read (#9)

This commit is contained in:
chris 2024-04-10 23:41:45 +02:00 committed by GitHub
parent decce7ce27
commit 94d2cbced9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -246,7 +246,10 @@ public final class GameProtocol {
* @param buffer
*/
private static void fakeItemRead(ByteBuf buffer) {
VarInts.readInt(buffer); // Runtime ID
int id = VarInts.readInt(buffer); // Runtime ID
if (id == 0) { // nothing more to read
return;
}
buffer.skipBytes(2); // count
VarInts.readUnsignedInt(buffer); // damage
boolean hasNetId = buffer.readBoolean();