Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ private void decodeLegacy(ByteBuf buf, ProtocolVersion version) {
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_9_1)) {
this.dimension = buf.readInt();
} else {
this.dimension = buf.readByte();
// Read as signed byte, then convert to unsigned for modded dimension IDs > 127
// (e.g. dimension 180 would be read as signed byte -76, but should be stored as 180).
// Preserve -1 (Nether) as-is since it is the only standard negative dimension ID.
int raw = buf.readByte();
this.dimension = (raw < -1) ? (raw & 0xFF) : raw;
}
if (version.noGreaterThan(ProtocolVersion.MINECRAFT_1_13_2)) {
this.difficulty = buf.readUnsignedByte();
Expand Down