Add support for 20w22a

This commit is contained in:
RednedEpic 2020-06-03 20:33:08 -05:00
parent 6004e4af74
commit 1205c36965
9 changed files with 47 additions and 6 deletions

View file

@ -5,7 +5,7 @@
<groupId>com.github.steveice10</groupId> <groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId> <artifactId>mcprotocollib</artifactId>
<version>20w21a-SNAPSHOT</version> <version>20w22a-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>MCProtocolLib</name> <name>MCProtocolLib</name>

View file

@ -2,8 +2,8 @@ package com.github.steveice10.mc.protocol;
public class MinecraftConstants { public class MinecraftConstants {
// General Constants // General Constants
public static final String GAME_VERSION = "20w21a"; public static final String GAME_VERSION = "20w22a";
public static final int PROTOCOL_VERSION = 718; public static final int PROTOCOL_VERSION = 719;
// General Key Constants // General Key Constants
public static final String PROFILE_KEY = "profile"; public static final String PROFILE_KEY = "profile";

View file

@ -645,6 +645,7 @@ public class MagicValues {
register(UpdatedTileType.STRUCTURE_BLOCK, 7); register(UpdatedTileType.STRUCTURE_BLOCK, 7);
register(UpdatedTileType.END_GATEWAY, 8); register(UpdatedTileType.END_GATEWAY, 8);
register(UpdatedTileType.SIGN, 9); register(UpdatedTileType.SIGN, 9);
register(UpdatedTileType.SHULKER_BOX, 10);
register(UpdatedTileType.BED, 11); register(UpdatedTileType.BED, 11);
register(UpdatedTileType.JIGSAW_BLOCK, 12); register(UpdatedTileType.JIGSAW_BLOCK, 12);
register(UpdatedTileType.CAMPFIRE, 13); register(UpdatedTileType.CAMPFIRE, 13);
@ -835,6 +836,18 @@ public class MagicValues {
register(ParticleType.DOLPHIN, 55); register(ParticleType.DOLPHIN, 55);
register(ParticleType.CAMPFIRE_COSY_SMOKE, 56); register(ParticleType.CAMPFIRE_COSY_SMOKE, 56);
register(ParticleType.CAMPFIRE_SIGNAL_SMOKE, 57); register(ParticleType.CAMPFIRE_SIGNAL_SMOKE, 57);
register(ParticleType.DRIPPING_HONEY, 58);
register(ParticleType.FALLING_HONEY, 59);
register(ParticleType.LANDING_HONEY, 60);
register(ParticleType.FALLING_NECTAR, 61);
register(ParticleType.ASH, 62);
register(ParticleType.CRIMSON_SPORE, 63);
register(ParticleType.WARPED_SPORE, 64);
register(ParticleType.DRIPPING_OBBSIDIAN_TEAR, 65);
register(ParticleType.FALLING_OBSIDIAN_TEAR, 66);
register(ParticleType.LANDING_OBSIDIAN_TEAR, 67);
register(ParticleType.REVERSE_PORTAL, 68);
register(ParticleType.WHITE_ASH, 69);
register(NoteBlockValueType.HARP, 0); register(NoteBlockValueType.HARP, 0);
register(NoteBlockValueType.DOUBLE_BASS, 1); register(NoteBlockValueType.DOUBLE_BASS, 1);
@ -1141,6 +1154,7 @@ public class MagicValues {
register(SuggestionType.ASK_SERVER, "minecraft:ask_server"); register(SuggestionType.ASK_SERVER, "minecraft:ask_server");
register(SuggestionType.ALL_RECIPES, "minecraft:all_recipes"); register(SuggestionType.ALL_RECIPES, "minecraft:all_recipes");
register(SuggestionType.AVAILABLE_SOUNDS, "minecraft:available_sounds"); register(SuggestionType.AVAILABLE_SOUNDS, "minecraft:available_sounds");
register(SuggestionType.AVAILABLE_BIOMES, "minecraft:available_biomes");
register(SuggestionType.SUMMONABLE_ENTITIES, "minecraft:summonable_entities"); register(SuggestionType.SUMMONABLE_ENTITIES, "minecraft:summonable_entities");
register(StringProperties.SINGLE_WORD, 0); register(StringProperties.SINGLE_WORD, 0);

View file

@ -3,7 +3,7 @@ package com.github.steveice10.mc.protocol.data.game.command;
public enum SuggestionType { public enum SuggestionType {
ASK_SERVER, ASK_SERVER,
ALL_RECIPES, ALL_RECIPES,
AVAILABLE_BIOMES,
AVAILABLE_SOUNDS, AVAILABLE_SOUNDS,
AVAILABLE_BIOMES,
SUMMONABLE_ENTITIES; SUMMONABLE_ENTITIES;
} }

View file

@ -62,5 +62,13 @@ public enum ParticleType {
DRIPPING_HONEY, DRIPPING_HONEY,
FALLING_HONEY, FALLING_HONEY,
LANDING_HONEY, LANDING_HONEY,
FALLING_NECTAR FALLING_NECTAR,
ASH,
CRIMSON_SPORE,
WARPED_SPORE,
DRIPPING_OBBSIDIAN_TEAR,
FALLING_OBSIDIAN_TEAR,
LANDING_OBSIDIAN_TEAR,
REVERSE_PORTAL,
WHITE_ASH,
} }

View file

@ -20,17 +20,20 @@ import java.io.IOException;
public class ClientGenerateStructuresPacket implements Packet { public class ClientGenerateStructuresPacket implements Packet {
private @NonNull Position position; private @NonNull Position position;
private int levels; private int levels;
private boolean keepJigsaws;
@Override @Override
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.position = Position.read(in); this.position = Position.read(in);
this.levels = in.readVarInt(); this.levels = in.readVarInt();
this.keepJigsaws = in.readBoolean();
} }
@Override @Override
public void write(NetOutput out) throws IOException { public void write(NetOutput out) throws IOException {
Position.write(out, this.position); Position.write(out, this.position);
out.writeVarInt(this.levels); out.writeVarInt(this.levels);
out.writeBoolean(this.keepJigsaws);
} }
@Override @Override

View file

@ -27,8 +27,11 @@ public class ServerJoinGamePacket implements Packet {
private int entityId; private int entityId;
private boolean hardcore; private boolean hardcore;
private @NonNull GameMode gameMode; private @NonNull GameMode gameMode;
private int worldCount;
private String[] worldNames;
private @NonNull CompoundTag dimensionCodec; private @NonNull CompoundTag dimensionCodec;
private @NonNull String dimension; private @NonNull String dimension;
private String worldName;
private long hashedSeed; private long hashedSeed;
private int maxPlayers; private int maxPlayers;
private int viewDistance; private int viewDistance;
@ -44,8 +47,13 @@ public class ServerJoinGamePacket implements Packet {
int gameMode = in.readUnsignedByte(); int gameMode = in.readUnsignedByte();
this.hardcore = (gameMode & GAMEMODE_FLAG_HARDCORE) != 0; this.hardcore = (gameMode & GAMEMODE_FLAG_HARDCORE) != 0;
this.gameMode = MagicValues.key(GameMode.class, gameMode & GAMEMODE_MASK); this.gameMode = MagicValues.key(GameMode.class, gameMode & GAMEMODE_MASK);
this.worldCount = in.readVarInt();
for (int i = 0; i < this.worldCount; i++) {
in.readString();
}
this.dimensionCodec = NBT.read(in); this.dimensionCodec = NBT.read(in);
this.dimension = in.readString(); this.dimension = in.readString();
this.worldName = in.readString();
this.hashedSeed = in.readLong(); this.hashedSeed = in.readLong();
this.maxPlayers = in.readUnsignedByte(); this.maxPlayers = in.readUnsignedByte();
this.viewDistance = in.readVarInt(); this.viewDistance = in.readVarInt();
@ -65,8 +73,13 @@ public class ServerJoinGamePacket implements Packet {
} }
out.writeByte(gameMode); out.writeByte(gameMode);
out.writeVarInt(this.worldCount);
for (String worldName : this.worldNames) {
out.writeString(worldName);
}
NBT.write(out, this.dimensionCodec); NBT.write(out, this.dimensionCodec);
out.writeString(this.dimension); out.writeString(this.dimension);
out.writeString(this.worldName);
out.writeLong(this.hashedSeed); out.writeLong(this.hashedSeed);
out.writeByte(this.maxPlayers); out.writeByte(this.maxPlayers);
out.writeVarInt(this.viewDistance); out.writeVarInt(this.viewDistance);

View file

@ -20,6 +20,7 @@ import java.io.IOException;
@AllArgsConstructor @AllArgsConstructor
public class ServerRespawnPacket implements Packet { public class ServerRespawnPacket implements Packet {
private String dimension; private String dimension;
private String worldName;
private long hashedSeed; private long hashedSeed;
private @NonNull GameMode gamemode; private @NonNull GameMode gamemode;
private boolean debug; private boolean debug;
@ -29,6 +30,7 @@ public class ServerRespawnPacket implements Packet {
@Override @Override
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.dimension = in.readString(); this.dimension = in.readString();
this.worldName = in.readString();
this.hashedSeed = in.readLong(); this.hashedSeed = in.readLong();
this.gamemode = MagicValues.key(GameMode.class, in.readUnsignedByte()); this.gamemode = MagicValues.key(GameMode.class, in.readUnsignedByte());
this.debug = in.readBoolean(); this.debug = in.readBoolean();
@ -39,6 +41,7 @@ public class ServerRespawnPacket implements Packet {
@Override @Override
public void write(NetOutput out) throws IOException { public void write(NetOutput out) throws IOException {
out.writeString(this.dimension); out.writeString(this.dimension);
out.writeString(this.worldName);
out.writeLong(this.hashedSeed); out.writeLong(this.hashedSeed);
out.writeByte(MagicValues.value(Integer.class, this.gamemode)); out.writeByte(MagicValues.value(Integer.class, this.gamemode));
out.writeBoolean(this.debug); out.writeBoolean(this.debug);

View file

@ -47,7 +47,7 @@ public class MinecraftProtocolTest {
new TextMessage("Hello world!"), new TextMessage("Hello world!"),
null null
); );
private static final ServerJoinGamePacket JOIN_GAME_PACKET = new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, getDimensionTag(), "minecraft:overworld", 100, 0, 16, false, false, false, false); private static final ServerJoinGamePacket JOIN_GAME_PACKET = new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 1, new String[]{"minecraft:world"}, getDimensionTag(), "minecraft:overworld", "minecraft:world", 100, 0, 16, false, false, false, false);
private static Server server; private static Server server;