Actually fix hardcore flag

This commit is contained in:
KennyTV 2020-07-01 20:07:20 +02:00
parent 7f2023176f
commit 3fbeb3e902
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -27,8 +27,11 @@ public class EntityPackets {
public void registerMap() {
map(Type.INT); // Entity ID
handler(wrapper -> {
short gamemode = wrapper.passthrough(Type.UNSIGNED_BYTE);
wrapper.write(Type.BOOLEAN, (gamemode & 0x08) != 0); // Hardcore
short gamemode = wrapper.read(Type.UNSIGNED_BYTE);
boolean hardcore = (gamemode & 0x08) != 0;
gamemode &= ~0x08;
wrapper.write(Type.UNSIGNED_BYTE, gamemode);
wrapper.write(Type.BOOLEAN, hardcore); // Hardcore
});
map(Type.UNSIGNED_BYTE); // Gamemode
map(Type.BYTE); // Previous Gamemode