-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
23w33a + 23w35a + implement PlayerSpawnInfo object
- Loading branch information
Showing
9 changed files
with
77 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/github/steveice10/mc/protocol/data/game/entity/player/PlayerSpawnInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.github.steveice10.mc.protocol.data.game.entity.player; | ||
|
||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class PlayerSpawnInfo { | ||
private final @NonNull String dimension; | ||
private final @NonNull String worldName; | ||
private final long hashedSeed; | ||
private final @NonNull GameMode gameMode; | ||
private final @Nullable GameMode previousGamemode; | ||
private final boolean debug; | ||
private final boolean flat; | ||
private final @Nullable GlobalPos lastDeathPos; | ||
private final int portalCooldown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import com.github.steveice10.mc.protocol.codec.MinecraftPacket; | ||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos; | ||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; | ||
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerSpawnInfo; | ||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; | ||
import io.netty.buffer.ByteBuf; | ||
import lombok.AllArgsConstructor; | ||
|
@@ -26,15 +27,7 @@ public class ClientboundLoginPacket implements MinecraftPacket { | |
private final int simulationDistance; | ||
private final boolean reducedDebugInfo; | ||
private final boolean enableRespawnScreen; | ||
private final @NonNull String dimension; | ||
private final @NonNull String worldName; | ||
private final long hashedSeed; | ||
private final @NonNull GameMode gameMode; | ||
private final @Nullable GameMode previousGamemode; | ||
private final boolean debug; | ||
private final boolean flat; | ||
private final @Nullable GlobalPos lastDeathPos; | ||
private final int portalCooldown; | ||
private final PlayerSpawnInfo commonPlayerSpawnInfo; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
basaigh
Author
Member
|
||
|
||
public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException { | ||
this.entityId = in.readInt(); | ||
|
@@ -49,19 +42,7 @@ public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IO | |
this.simulationDistance = helper.readVarInt(in); | ||
this.reducedDebugInfo = in.readBoolean(); | ||
this.enableRespawnScreen = in.readBoolean(); | ||
this.dimension = helper.readString(in); | ||
this.worldName = helper.readString(in); | ||
this.hashedSeed = in.readLong(); | ||
this.gameMode = GameMode.byId(in.readByte()); | ||
this.previousGamemode = GameMode.byNullableId(in.readByte()); | ||
this.debug = in.readBoolean(); | ||
this.flat = in.readBoolean(); | ||
if (in.readBoolean()) { | ||
this.lastDeathPos = helper.readGlobalPos(in); | ||
} else { | ||
this.lastDeathPos = null; | ||
} | ||
this.portalCooldown = helper.readVarInt(in); | ||
this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in); | ||
} | ||
|
||
@Override | ||
|
@@ -77,17 +58,6 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOExcepti | |
helper.writeVarInt(out, this.simulationDistance); | ||
out.writeBoolean(this.reducedDebugInfo); | ||
out.writeBoolean(this.enableRespawnScreen); | ||
helper.writeString(out, this.dimension); | ||
helper.writeString(out, this.worldName); | ||
out.writeLong(this.hashedSeed); | ||
out.writeByte(this.gameMode.ordinal()); | ||
out.writeByte(GameMode.toNullableId(this.previousGamemode)); | ||
out.writeBoolean(this.debug); | ||
out.writeBoolean(this.flat); | ||
out.writeBoolean(this.lastDeathPos != null); | ||
if (this.lastDeathPos != null) { | ||
helper.writeGlobalPos(out, this.lastDeathPos); | ||
} | ||
helper.writeVarInt(out, this.portalCooldown); | ||
helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
why the
common
?