From 9abfdfb8f9cd8939c2a72f0715e41933fdde8bab Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 26 Jan 2024 16:23:17 +0100 Subject: [PATCH] Include config packets in Protocol generic types --- .../Protocol1_20_2To1_20_3.java | 55 ++++++++++--------- .../BlockItemPacketRewriter1_20_3.java | 14 +++-- .../rewriter/EntityPacketRewriter1_20_3.java | 8 +-- .../Protocol1_20_3To1_20_5.java | 44 ++++++++------- .../BlockItemPacketRewriter1_20_5.java | 8 ++- .../rewriter/EntityPacketRewriter1_20_5.java | 7 ++- .../template/protocol/Protocol1_98To1_99.java | 35 ++++-------- .../rewriter/BlockItemPacketRewriter1_99.java | 8 +-- .../rewriter/EntityPacketRewriter1_99.java | 3 +- 9 files changed, 90 insertions(+), 92 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java index 9aeac118..338ae284 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java @@ -28,10 +28,9 @@ import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.storage.Spawn import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3; -import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; -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.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; @@ -40,12 +39,16 @@ import com.viaversion.viaversion.libs.fastutil.Pair; import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.CommandRewriter1_19_4; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2; +import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPacket1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2; +import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPacket1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; @@ -54,31 +57,31 @@ import com.viaversion.viaversion.util.ComponentUtil; import java.util.BitSet; import java.util.UUID; -public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol { +public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.3", "1.20.2", Protocol1_20_3To1_20_2.class); private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this); private final BlockItemPacketRewriter1_20_3 itemRewriter = new BlockItemPacketRewriter1_20_3(this); - private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); public Protocol1_20_2To1_20_3() { - super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_2.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_2.class); + super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_2.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_2.class); } @Override protected void registerPackets() { super.registerPackets(); - final TagRewriter tagRewriter = new TagRewriter<>(this); + final TagRewriter tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); - final SoundRewriter soundRewriter = new SoundRewriter<>(this); + final SoundRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.ENTITY_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS); - new CommandRewriter1_19_4(this) { + new CommandRewriter1_19_4(this) { @Override public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { if (argumentType.equals("minecraft:style")) { @@ -240,7 +243,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol getTranslatableRewriter() { + public TranslatableRewriter getTranslatableRewriter() { return translatableRewriter; } + + @Override + protected PacketTypesProvider createPacketTypesProvider() { + return new SimplePacketTypesProvider<>( + packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class), + packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_2.class, ClientboundConfigurationPackets1_20_2.class), + packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class), + packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class) + ); + } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java index 98d1f5d1..11af5309 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java @@ -26,12 +26,14 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPacket1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2; +import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPacket1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3; import com.viaversion.viaversion.rewriter.BlockRewriter; -public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter { +public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter { public BlockItemPacketRewriter1_20_3(final Protocol1_20_2To1_20_3 protocol) { super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY); @@ -39,7 +41,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); + final BlockRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION); blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE); @@ -88,7 +90,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter(protocol) { + new RecipeRewriter1_20_3(protocol) { @Override public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception { // Move width and height up @@ -120,9 +122,9 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter { +public final class EntityPacketRewriter1_20_3 extends EntityRewriter { public EntityPacketRewriter1_20_3(final Protocol1_20_2To1_20_3 protocol) { super(protocol, Types1_20_2.META_TYPES.optionalComponentType, Types1_20_2.META_TYPES.booleanType); @@ -47,7 +47,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter { +public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings(); private static final ByteArrayType COOKIE_DATA_TYPE = new ByteArrayType(5120); private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this); private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this); - private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); public Protocol1_20_3To1_20_5() { - super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_3.class); + super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_3.class); } @Override protected void registerPackets() { super.registerPackets(); - final TagRewriter tagRewriter = new TagRewriter<>(this); + final TagRewriter tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); - registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> { + registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> { // Send off registry data first final PacketWrapper registryDataPacket = wrapper.create(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA); registryDataPacket.write(Type.COMPOUND_TAG, wrapper.user().get(RegistryDataStorage.class).registryData().copy()); @@ -81,7 +86,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol wrapper.user().get(RegistryDataStorage.class).registryData().clear()); - final SoundRewriter soundRewriter = new SoundRewriter<>(this); + final SoundRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_5.STOP_SOUND); @@ -114,15 +119,12 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol handleCookieRequest(wrapper, ServerboundLoginPackets.COOKIE_RESPONSE)); - registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.COOKIE_REQUEST.getId(), -1, wrapper -> handleCookieRequest(wrapper, ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE)); - registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.STORE_COOKIE.getId(), -1, this::handleStoreCookie); - registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.TRANSFER.getId(), -1, this::handleTransfer); + registerClientbound(ClientboundConfigurationPackets1_20_5.COOKIE_REQUEST, null, wrapper -> handleCookieRequest(wrapper, ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE)); + registerClientbound(ClientboundConfigurationPackets1_20_5.STORE_COOKIE, null, this::handleStoreCookie); + registerClientbound(ClientboundConfigurationPackets1_20_5.TRANSFER, null, this::handleTransfer); registerClientbound(ClientboundPackets1_20_5.COOKIE_REQUEST, null, wrapper -> handleCookieRequest(wrapper, ServerboundPackets1_20_5.COOKIE_RESPONSE)); registerClientbound(ClientboundPackets1_20_5.STORE_COOKIE, null, this::handleStoreCookie); registerClientbound(ClientboundPackets1_20_5.TRANSFER, null, this::handleTransfer); - - registerClientboundPacketIdChanges(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.class, ClientboundConfigurationPackets1_20_3.class); - registerServerboundPacketIdChanges(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.class, ServerboundConfigurationPackets1_20_5.class); } private void handleStoreCookie(final PacketWrapper wrapper) throws Exception { @@ -185,17 +187,17 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol getTranslatableRewriter() { + public TranslatableRewriter getTranslatableRewriter() { return translatableRewriter; } @Override - protected ClientboundPacketType clientboundFinishConfigurationPacket() { - return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION; - } - - @Override - protected ServerboundPacketType serverboundFinishConfigurationPacket() { - return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION; + protected PacketTypesProvider createPacketTypesProvider() { + return new SimplePacketTypesProvider<>( + packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_5.class, ClientboundConfigurationPackets1_20_5.class), + packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class), + packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_5.class, ServerboundConfigurationPackets1_20_5.class), + packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class) + ); } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java index 12d4a4c8..5bc0e5e9 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java @@ -23,13 +23,15 @@ import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5; import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.util.Key; -public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { +public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { public BlockItemPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) { super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY); @@ -37,7 +39,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); + final BlockRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_ACTION); blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.MULTI_BLOCK_CHANGE); @@ -128,7 +130,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter recipeRewriter = new RecipeRewriter1_20_3<>(protocol); + final RecipeRewriter1_20_3 recipeRewriter = new RecipeRewriter1_20_3<>(protocol); protocol.registerClientbound(ClientboundPackets1_20_5.DECLARE_RECIPES, wrapper -> { final int size = wrapper.passthrough(Type.VAR_INT); for (int i = 0; i < size; i++) { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java index 9a4ae771..549e6aaf 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java @@ -25,7 +25,6 @@ import com.viaversion.viaversion.api.data.entity.DimensionData; import com.viaversion.viaversion.api.minecraft.RegistryEntry; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; -import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; @@ -35,12 +34,13 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5; +import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5; import com.viaversion.viaversion.util.Key; import java.util.HashMap; import java.util.Map; -public final class EntityPacketRewriter1_20_5 extends EntityRewriter { +public final class EntityPacketRewriter1_20_5 extends EntityRewriter { public EntityPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) { super(protocol, Types1_20_3.META_TYPES.optionalComponentType, Types1_20_3.META_TYPES.booleanType); @@ -52,7 +52,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { @@ -215,6 +215,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { +public final class Protocol1_98To1_99 extends BackwardsProtocol { // ViaBackwards uses its own mappings and also needs a translatablerewriter for translation mappings public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.99", "1.98", Protocol1_20_5To1_20_3.class); private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this); private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this); - private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); public Protocol1_98To1_99() { - super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_5.class); + super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class); } @Override protected void registerPackets() { super.registerPackets(); - final TagRewriter tagRewriter = new TagRewriter<>(this); + final TagRewriter tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); - tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS); + tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS); - final SoundRewriter soundRewriter = new SoundRewriter<>(this); + final SoundRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_5.STOP_SOUND); @@ -111,17 +108,9 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol getTranslatableRewriter() { + public TranslatableRewriter getTranslatableRewriter() { return translatableRewriter; } - @Override - protected ClientboundPacketType clientboundFinishConfigurationPacket() { - return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION; - } - - @Override - protected ServerboundPacketType serverboundFinishConfigurationPacket() { - return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION; - } + // createPacketTypesProvider } \ No newline at end of file diff --git a/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/BlockItemPacketRewriter1_99.java b/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/BlockItemPacketRewriter1_99.java index 011d46bd..112d5659 100644 --- a/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/BlockItemPacketRewriter1_99.java +++ b/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/BlockItemPacketRewriter1_99.java @@ -23,14 +23,16 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3; +import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5; +import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPacket1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5; import com.viaversion.viaversion.rewriter.BlockRewriter; // To replace if needed: // ChunkType1_20_2 // RecipeRewriter1_20_3 -public final class BlockItemPacketRewriter1_99 extends ItemRewriter { +public final class BlockItemPacketRewriter1_99 extends ItemRewriter { public BlockItemPacketRewriter1_99(final Protocol1_98To1_99 protocol) { super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY); @@ -38,7 +40,7 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); + final BlockRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_ACTION); blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.MULTI_BLOCK_CHANGE); @@ -59,8 +61,6 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter(protocol).register1_20_5(ClientboundPackets1_20_5.DECLARE_RECIPES); } } \ No newline at end of file diff --git a/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/EntityPacketRewriter1_99.java b/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/EntityPacketRewriter1_99.java index d375b030..521da2d9 100644 --- a/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/EntityPacketRewriter1_99.java +++ b/template/src/main/java/com/viaversion/viabackwards/template/protocol/rewriter/EntityPacketRewriter1_99.java @@ -26,12 +26,13 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.version.Types1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5; +import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5; // Replace if needed // Types1_OLD // Types1_20_5 -public final class EntityPacketRewriter1_99 extends EntityRewriter { +public final class EntityPacketRewriter1_99 extends EntityRewriter { public EntityPacketRewriter1_99(final Protocol1_98To1_99 protocol) { super(protocol, Types1_20_5.META_TYPES.optionalComponentType, Types1_20_5.META_TYPES.booleanType);