3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Cancel block change packets for removed actions

Dieser Commit ist enthalten in:
KennyTV 2020-06-08 17:46:18 +02:00
Ursprung d58959fcca
Commit 9c81ba368f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -31,7 +31,17 @@ public class BlockRewriter {
map(Type.UNSIGNED_BYTE); // Action id
map(Type.UNSIGNED_BYTE); // Action param
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
handler(wrapper -> wrapper.set(Type.VAR_INT, 0, blockRewriter.rewrite(wrapper.get(Type.VAR_INT, 0))));
handler(wrapper -> {
int id = wrapper.get(Type.VAR_INT, 0);
int mappedId = blockRewriter.rewrite(id);
if (mappedId == -1) {
// Block (action) has been removed
wrapper.cancel();
return;
}
wrapper.set(Type.VAR_INT, 0, mappedId);
});
}
});
}