Minecraft 1.16 support + RGB ChatColor preview
This commit is contained in:
@@ -67,21 +67,24 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x1F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x21 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x20 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x21 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x21 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x20 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Login.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x23 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x25 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x26 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x26 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x25 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Chat.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x0F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x0E ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x0F )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x0F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x0E )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Respawn.class,
|
||||
@@ -91,12 +94,14 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x35 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x38 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x3A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x3B )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x3B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x3A )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
BossBar.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x0C ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x0D )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x0D ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x0C )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
PlayerListItem.class, // PlayerInfo
|
||||
@@ -105,14 +110,16 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x30 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x33 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x34 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x34 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x33 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
TabCompleteResponse.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_8, 0x3A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x0E ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x10 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x11 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x11 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x10 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
ScoreboardObjective.class,
|
||||
@@ -160,7 +167,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x18 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x19 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x18 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x19 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x19 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x18 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Kick.class,
|
||||
@@ -168,7 +176,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x1A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x1B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x1A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1B )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1A )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Title.class,
|
||||
@@ -177,7 +186,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x4B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x50 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x50 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x4F )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
PlayerListHeaderFooter.class,
|
||||
@@ -188,7 +198,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x4A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x4E ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x53 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x54 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x54 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x53 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
EntityStatus.class,
|
||||
@@ -196,21 +207,25 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_9, 0x1B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x1C ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x1B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1C )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1C ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1B )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Commands.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x11 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x12 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x12 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x11 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
GameState.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1F )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1E )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
ViewDistance.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x41 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x42 )
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x42 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x41 )
|
||||
);
|
||||
|
||||
TO_SERVER.registerPacket(
|
||||
@@ -220,7 +235,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
|
||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x0B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x0E ),
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x0F )
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x0F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_16, 0x10 )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
Chat.class,
|
||||
|
@@ -28,6 +28,7 @@ public class ProtocolConstants
|
||||
public static final int MINECRAFT_1_15 = 573;
|
||||
public static final int MINECRAFT_1_15_1 = 575;
|
||||
public static final int MINECRAFT_1_15_2 = 578;
|
||||
public static final int MINECRAFT_1_16 = 735;
|
||||
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
|
||||
"1.8.x",
|
||||
"1.9.x",
|
||||
@@ -36,7 +37,8 @@ public class ProtocolConstants
|
||||
"1.12.x",
|
||||
"1.13.x",
|
||||
"1.14.x",
|
||||
"1.15.x"
|
||||
"1.15.x",
|
||||
"1.16.x"
|
||||
);
|
||||
public static final List<Integer> SUPPORTED_VERSION_IDS = Arrays.asList(
|
||||
ProtocolConstants.MINECRAFT_1_8,
|
||||
@@ -60,7 +62,8 @@ public class ProtocolConstants
|
||||
ProtocolConstants.MINECRAFT_1_14_4,
|
||||
ProtocolConstants.MINECRAFT_1_15,
|
||||
ProtocolConstants.MINECRAFT_1_15_1,
|
||||
ProtocolConstants.MINECRAFT_1_15_2
|
||||
ProtocolConstants.MINECRAFT_1_15_2,
|
||||
ProtocolConstants.MINECRAFT_1_16
|
||||
);
|
||||
|
||||
public enum Direction
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -16,14 +17,21 @@ import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
public class Chat extends DefinedPacket
|
||||
{
|
||||
|
||||
private static final UUID EMPTY_UUID = new UUID( 0L, 0L );
|
||||
private String message;
|
||||
private byte position;
|
||||
private UUID sender;
|
||||
|
||||
public Chat(String message)
|
||||
{
|
||||
this( message, (byte) 0 );
|
||||
}
|
||||
|
||||
public Chat(String message, byte position)
|
||||
{
|
||||
this( message, position, EMPTY_UUID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
@@ -31,6 +39,10 @@ public class Chat extends DefinedPacket
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT )
|
||||
{
|
||||
position = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
sender = readUUID( buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +53,10 @@ public class Chat extends DefinedPacket
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT )
|
||||
{
|
||||
buf.writeByte( position );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
writeUUID( sender, buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -547,6 +547,9 @@ public class Commands extends DefinedPacket
|
||||
PROVIDERS.put( "minecraft:entity_summon", VOID );
|
||||
PROVIDERS.put( "minecraft:dimension", VOID );
|
||||
PROVIDERS.put( "minecraft:time", VOID ); // 1.14
|
||||
PROVIDERS.put( "minecraft:uuid", VOID ); // 1.16
|
||||
PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug
|
||||
PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug
|
||||
}
|
||||
|
||||
private static ArgumentType<?> read(String key, ByteBuf buf)
|
||||
@@ -617,6 +620,7 @@ public class Commands extends DefinedPacket
|
||||
PROVIDERS.put( "minecraft:ask_server", ASK_SERVER );
|
||||
registerDummy( "minecraft:all_recipes" );
|
||||
registerDummy( "minecraft:available_sounds" );
|
||||
registerDummy( "minecraft:available_biomes" );
|
||||
registerDummy( "minecraft:summonable_entities" );
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,14 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufInputStream;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -8,6 +16,8 @@ import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import se.llbit.nbt.NamedTag;
|
||||
import se.llbit.nbt.Tag;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@@ -18,7 +28,11 @@ public class Login extends DefinedPacket
|
||||
|
||||
private int entityId;
|
||||
private short gameMode;
|
||||
private int dimension;
|
||||
private short previousGameMode;
|
||||
private Set<String> worldNames;
|
||||
private Tag dimensions;
|
||||
private Object dimension;
|
||||
private String worldName;
|
||||
private long seed;
|
||||
private short difficulty;
|
||||
private short maxPlayers;
|
||||
@@ -26,13 +40,36 @@ public class Login extends DefinedPacket
|
||||
private int viewDistance;
|
||||
private boolean reducedDebugInfo;
|
||||
private boolean normalRespawn;
|
||||
private boolean debug;
|
||||
private boolean flat;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
entityId = buf.readInt();
|
||||
gameMode = buf.readUnsignedByte();
|
||||
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
previousGameMode = buf.readUnsignedByte();
|
||||
|
||||
worldNames = new HashSet<>();
|
||||
int worldCount = readVarInt( buf );
|
||||
Preconditions.checkArgument( worldCount < 128, "Too many worlds %s", worldCount );
|
||||
|
||||
for ( int i = 0; i < worldCount; i++ )
|
||||
{
|
||||
worldNames.add( readString( buf ) );
|
||||
}
|
||||
|
||||
dimensions = NamedTag.read( new DataInputStream( new ByteBufInputStream( buf ) ) );
|
||||
Preconditions.checkArgument( !dimensions.isError(), "Error reading dimensions: %s", dimensions.error() );
|
||||
}
|
||||
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
dimension = readString( buf );
|
||||
worldName = readString( buf );
|
||||
} else if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||
{
|
||||
dimension = buf.readInt();
|
||||
} else
|
||||
@@ -48,7 +85,10 @@ public class Login extends DefinedPacket
|
||||
difficulty = buf.readUnsignedByte();
|
||||
}
|
||||
maxPlayers = buf.readUnsignedByte();
|
||||
levelType = readString( buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
levelType = readString( buf );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_14 )
|
||||
{
|
||||
viewDistance = readVarInt( buf );
|
||||
@@ -61,6 +101,11 @@ public class Login extends DefinedPacket
|
||||
{
|
||||
normalRespawn = buf.readBoolean();
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
debug = buf.readBoolean();
|
||||
flat = buf.readBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,12 +113,35 @@ public class Login extends DefinedPacket
|
||||
{
|
||||
buf.writeInt( entityId );
|
||||
buf.writeByte( gameMode );
|
||||
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
buf.writeInt( dimension );
|
||||
buf.writeByte( previousGameMode );
|
||||
|
||||
writeVarInt( worldNames.size(), buf );
|
||||
for ( String world : worldNames )
|
||||
{
|
||||
writeString( world, buf );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
dimensions.write( new DataOutputStream( new ByteBufOutputStream( buf ) ) );
|
||||
} catch ( IOException ex )
|
||||
{
|
||||
throw new RuntimeException( "Exception writing dimensions", ex );
|
||||
}
|
||||
}
|
||||
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
writeString( (String) dimension, buf );
|
||||
writeString( worldName, buf );
|
||||
} else if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||
{
|
||||
buf.writeInt( ( (Number) dimension ).intValue() );
|
||||
} else
|
||||
{
|
||||
buf.writeByte( dimension );
|
||||
buf.writeByte( ( (Number) dimension ).byteValue() );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||
{
|
||||
@@ -84,7 +152,10 @@ public class Login extends DefinedPacket
|
||||
buf.writeByte( difficulty );
|
||||
}
|
||||
buf.writeByte( maxPlayers );
|
||||
writeString( levelType, buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
writeString( levelType, buf );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_14 )
|
||||
{
|
||||
writeVarInt( viewDistance, buf );
|
||||
@@ -97,6 +168,11 @@ public class Login extends DefinedPacket
|
||||
{
|
||||
buf.writeBoolean( normalRespawn );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
buf.writeBoolean( debug );
|
||||
buf.writeBoolean( flat );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,12 +1,14 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@@ -15,20 +17,32 @@ import net.md_5.bungee.protocol.DefinedPacket;
|
||||
public class LoginSuccess extends DefinedPacket
|
||||
{
|
||||
|
||||
private String uuid;
|
||||
private UUID uuid;
|
||||
private String username;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
uuid = readString( buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
uuid = readUUID( buf );
|
||||
} else
|
||||
{
|
||||
uuid = UUID.fromString( readString( buf ) );
|
||||
}
|
||||
username = readString( buf );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( uuid, buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
writeUUID( uuid, buf );
|
||||
} else
|
||||
{
|
||||
writeString( uuid.toString(), buf );
|
||||
}
|
||||
writeString( username, buf );
|
||||
}
|
||||
|
||||
|
@@ -16,16 +16,28 @@ import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
public class Respawn extends DefinedPacket
|
||||
{
|
||||
|
||||
private int dimension;
|
||||
private Object dimension;
|
||||
private String worldName;
|
||||
private long seed;
|
||||
private short difficulty;
|
||||
private short gameMode;
|
||||
private short previousGameMode;
|
||||
private String levelType;
|
||||
private boolean debug;
|
||||
private boolean flat;
|
||||
private boolean copyMeta;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
dimension = buf.readInt();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
dimension = readString( buf );
|
||||
worldName = readString( buf );
|
||||
} else
|
||||
{
|
||||
dimension = buf.readInt();
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||
{
|
||||
seed = buf.readLong();
|
||||
@@ -35,13 +47,29 @@ public class Respawn extends DefinedPacket
|
||||
difficulty = buf.readUnsignedByte();
|
||||
}
|
||||
gameMode = buf.readUnsignedByte();
|
||||
levelType = readString( buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
previousGameMode = buf.readUnsignedByte();
|
||||
debug = buf.readBoolean();
|
||||
flat = buf.readBoolean();
|
||||
copyMeta = buf.readBoolean();
|
||||
} else
|
||||
{
|
||||
levelType = readString( buf );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
buf.writeInt( dimension );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
writeString( (String) dimension, buf );
|
||||
writeString( worldName, buf );
|
||||
} else
|
||||
{
|
||||
buf.writeInt( ( (Number) dimension ).intValue() );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||
{
|
||||
buf.writeLong( seed );
|
||||
@@ -51,7 +79,16 @@ public class Respawn extends DefinedPacket
|
||||
buf.writeByte( difficulty );
|
||||
}
|
||||
buf.writeByte( gameMode );
|
||||
writeString( levelType, buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
|
||||
{
|
||||
buf.writeByte( previousGameMode );
|
||||
buf.writeBoolean( debug );
|
||||
buf.writeBoolean( flat );
|
||||
buf.writeBoolean( copyMeta );
|
||||
} else
|
||||
{
|
||||
writeString( levelType, buf );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user