mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
fix: update RespawnPacket to use dataToKeep bitset
This commit is contained in:
parent
5bcc72b911
commit
e146a9393e
@ -487,7 +487,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
refreshHealth();
|
||||
|
||||
sendPacket(new RespawnPacket(getDimensionType().toString(), instance.getDimensionName(),
|
||||
0, gameMode, gameMode, false, levelFlat, true, deathLocation, portalCooldown));
|
||||
0, gameMode, gameMode, false, levelFlat, RespawnPacket.COPY_ALL,
|
||||
deathLocation, portalCooldown));
|
||||
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(this);
|
||||
EventDispatcher.call(respawnEvent);
|
||||
@ -1039,7 +1040,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
final PlayerInfoUpdatePacket addPlayerPacket = getAddPlayerToList();
|
||||
|
||||
RespawnPacket respawnPacket = new RespawnPacket(getDimensionType().toString(), instance.getDimensionName(),
|
||||
0, gameMode, gameMode, false, levelFlat, true, deathLocation, portalCooldown);
|
||||
0, gameMode, gameMode, false, levelFlat, RespawnPacket.COPY_ALL,
|
||||
deathLocation, portalCooldown);
|
||||
|
||||
sendPacket(removePlayerPacket);
|
||||
sendPacket(destroyEntitiesPacket);
|
||||
@ -1439,7 +1441,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
"The dimension needs to be different than the current one!");
|
||||
this.dimensionType = dimensionType;
|
||||
sendPacket(new RespawnPacket(dimensionType.toString(), dimensionName,
|
||||
0, gameMode, gameMode, false, levelFlat, true, deathLocation, portalCooldown));
|
||||
0, gameMode, gameMode, false, levelFlat,
|
||||
RespawnPacket.COPY_ALL, deathLocation, portalCooldown));
|
||||
refreshClientStateAfterRespawn();
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,19 @@ import static net.minestom.server.network.NetworkBuffer.*;
|
||||
|
||||
public record RespawnPacket(String dimensionType, String worldName,
|
||||
long hashedSeed, GameMode gameMode, GameMode previousGameMode,
|
||||
boolean isDebug, boolean isFlat, boolean copyMeta,
|
||||
boolean isDebug, boolean isFlat, byte dataToCopy,
|
||||
DeathLocation deathLocation, int portalCooldown) implements ServerPacket {
|
||||
|
||||
public static final byte COPY_ATTRIBUTES = 0x1;
|
||||
public static final byte COPY_METADATA = 0x2;
|
||||
public static final byte COPY_ALL = COPY_ATTRIBUTES | COPY_METADATA;
|
||||
|
||||
public RespawnPacket(@NotNull NetworkBuffer reader) {
|
||||
this(reader.read(STRING), reader.read(STRING),
|
||||
reader.read(LONG), GameMode.fromId(reader.read(BYTE)),
|
||||
GameMode.fromId(reader.read(BYTE)),
|
||||
reader.read(BOOLEAN), reader.read(BOOLEAN),
|
||||
reader.read(BOOLEAN), reader.read(DEATH_LOCATION),
|
||||
reader.read(BYTE), reader.read(DEATH_LOCATION),
|
||||
reader.read(VAR_INT));
|
||||
}
|
||||
|
||||
@ -31,7 +36,7 @@ public record RespawnPacket(String dimensionType, String worldName,
|
||||
writer.write(BYTE, previousGameMode.id());
|
||||
writer.write(BOOLEAN, isDebug);
|
||||
writer.write(BOOLEAN, isFlat);
|
||||
writer.write(BOOLEAN, copyMeta);
|
||||
writer.write(BYTE, dataToCopy);
|
||||
writer.write(DEATH_LOCATION, deathLocation);
|
||||
writer.write(VAR_INT, portalCooldown);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user