diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java index 74c995bb9..19d6d82c7 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java @@ -86,7 +86,7 @@ public class ProtocolVersion implements Comparable { public static final ProtocolVersion v1_20_3 = register(765, "1.20.3-1.20.4", new SubVersionRange("1.20", 3, 4)); public static final ProtocolVersion v1_20_5 = register(766, "1.20.5-1.20.6", new SubVersionRange("1.20", 5, 6)); public static final ProtocolVersion v1_21 = register(767, "1.21-1.21.1", new SubVersionRange("1.21", 0, 1)); - public static final ProtocolVersion v1_21_2 = register(768, 209, "1.21.2"); + public static final ProtocolVersion v1_21_2 = register(768, 210, "1.21.2"); public static final ProtocolVersion unknown = new ProtocolVersion(VersionType.SPECIAL, -1, -1, "UNKNOWN", null); public static ProtocolVersion register(int version, String name) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/ClientboundLoginPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/ClientboundLoginPackets.java index 3666b5db1..87c597e97 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/ClientboundLoginPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/ClientboundLoginPackets.java @@ -23,11 +23,14 @@ import com.viaversion.viaversion.protocols.base.packet.BaseClientboundPacket; public enum ClientboundLoginPackets implements BaseClientboundPacket { LOGIN_DISCONNECT, // 0x00 HELLO, // 0x01 - GAME_PROFILE, // 0x02 + LOGIN_FINISHED, // 0x02 LOGIN_COMPRESSION, // 0x03 CUSTOM_QUERY, // 0x04 COOKIE_REQUEST; // 0x05 + @Deprecated(forRemoval = true) + public static final ClientboundLoginPackets GAME_PROFILE = LOGIN_FINISHED; + @Override public final int getId() { return ordinal(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/v1_7/ClientboundBaseProtocol1_7.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/v1_7/ClientboundBaseProtocol1_7.java index dffe0bfbd..ea9a48e1b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/v1_7/ClientboundBaseProtocol1_7.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/v1_7/ClientboundBaseProtocol1_7.java @@ -128,7 +128,7 @@ public class ClientboundBaseProtocol1_7 extends AbstractProtocol { + registerClientbound(ClientboundLoginPackets.LOGIN_FINISHED, wrapper -> { final ProtocolInfo info = wrapper.user().getProtocolInfo(); if (info.serverProtocolVersion().olderThan(ProtocolVersion.v1_16)) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/Protocol1_15_2To1_16.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/Protocol1_15_2To1_16.java index ec2841c34..e520ed575 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/Protocol1_15_2To1_16.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/Protocol1_15_2To1_16.java @@ -81,7 +81,7 @@ public class Protocol1_15_2To1_16 extends AbstractProtocol(this).register(ClientboundPackets1_15.AWARD_STATS); // Login Success - registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE, wrapper -> { + registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_FINISHED, wrapper -> { // Transform string to a uuid UUID uuid = UUID.fromString(wrapper.read(Types.STRING)); wrapper.write(Types.UUID, uuid); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java index a5319df28..796c815c2 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java @@ -232,7 +232,7 @@ public final class Protocol1_18_2To1_19 extends AbstractProtocol(this).registerDeclareCommands1_19(ClientboundPackets1_20_3.COMMANDS); - registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE, wrapper -> { + registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_FINISHED, wrapper -> { wrapper.passthrough(Types.UUID); // UUID wrapper.passthrough(Types.STRING); // Name diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/Protocol1_20To1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/Protocol1_20To1_20_2.java index f1d9ee7f5..db94d6b12 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/Protocol1_20To1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/Protocol1_20To1_20_2.java @@ -144,7 +144,7 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol { + registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_FINISHED, wrapper -> { wrapper.user().get(ConfigurationState.class).setBridgePhase(BridgePhase.PROFILE_SENT); wrapper.user().getProtocolInfo().setServerState(State.PLAY); }); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java index eb0558d69..e87e4c0a0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; +import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider; import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider; import com.viaversion.viaversion.api.rewriter.ComponentRewriter; @@ -31,6 +32,7 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.version.Types1_21_2; import com.viaversion.viaversion.data.entity.EntityTrackerBase; +import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5; @@ -94,6 +96,20 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol { + wrapper.passthrough(Types.UUID); // UUID + wrapper.passthrough(Types.STRING); // Name + + final int properties = wrapper.passthrough(Types.VAR_INT); + for (int i = 0; i < properties; i++) { + wrapper.passthrough(Types.STRING); // Name + wrapper.passthrough(Types.STRING); // Value + wrapper.passthrough(Types.OPTIONAL_STRING); // Signature + } + + wrapper.read(Types.BOOLEAN); // Strict error handling + }); } private void clientInformation(final PacketWrapper wrapper) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java index 333efcfb2..0a004ffd5 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java @@ -228,7 +228,7 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter< @Override public void handleRecipeType(final PacketWrapper wrapper, final String type) { - if (type.equals("crafting_special_suspiciousstew")) { + if (type.equals("crafting_special_suspiciousstew") || type.equals("crafting_special_shulkerboxcoloring")) { wrapper.read(Types.VAR_INT); // Crafting book category } else { super.handleRecipeType(wrapper, type); diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java index da73b5dba..8704036fe 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java @@ -54,6 +54,9 @@ public class RecipeRewriter { recipeHandlers.put("smithing_transform", this::handleSmithingTransform); recipeHandlers.put("smithing_trim", this::handleSmithingTrim); recipeHandlers.put("crafting_decorated_pot", this::handleSimpleRecipe); + + // Added in 1.21.2 + recipeHandlers.put("crafting_transmute", this::handleTransmute); } public void handleRecipeType(PacketWrapper wrapper, String type) { @@ -160,6 +163,22 @@ public class RecipeRewriter { handleIngredient(wrapper); // Additions } + private void handleTransmute(final PacketWrapper wrapper) { + wrapper.passthrough(Types.STRING); // Group + wrapper.passthrough(Types.VAR_INT); // Crafting book category + handleIngredient(wrapper); // Input + handleIngredient(wrapper); // Material + final int resultItemId = wrapper.read(Types.VAR_INT); + wrapper.write(Types.VAR_INT, rewrite(resultItemId)); + } + + protected int rewrite(final int itemId) { + if (protocol.getMappingData() != null && protocol.getItemRewriter() != null) { + return protocol.getMappingData().getNewItemId(itemId); + } + return itemId; + } + protected @Nullable Item rewrite(UserConnection connection, @Nullable Item item) { if (protocol.getItemRewriter() != null) { return protocol.getItemRewriter().handleItemToClient(connection, item); diff --git a/common/src/main/resources/assets/viaversion/data/identifier-table.nbt b/common/src/main/resources/assets/viaversion/data/identifier-table.nbt index bf0830e46..22f3d0b85 100644 Binary files a/common/src/main/resources/assets/viaversion/data/identifier-table.nbt and b/common/src/main/resources/assets/viaversion/data/identifier-table.nbt differ diff --git a/common/src/main/resources/assets/viaversion/data/identifiers-1.21.2.nbt b/common/src/main/resources/assets/viaversion/data/identifiers-1.21.2.nbt index 1e4579e46..a10afe551 100644 Binary files a/common/src/main/resources/assets/viaversion/data/identifiers-1.21.2.nbt and b/common/src/main/resources/assets/viaversion/data/identifiers-1.21.2.nbt differ diff --git a/common/src/main/resources/assets/viaversion/data/mappings-1.21to1.21.2.nbt b/common/src/main/resources/assets/viaversion/data/mappings-1.21to1.21.2.nbt index 4001d880a..946ccfab9 100644 Binary files a/common/src/main/resources/assets/viaversion/data/mappings-1.21to1.21.2.nbt and b/common/src/main/resources/assets/viaversion/data/mappings-1.21to1.21.2.nbt differ