diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java
index 3d34a480..5cc10f7c 100644
--- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java
+++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java
@@ -54,6 +54,7 @@ import com.viaversion.viabackwards.protocol.v1_19_1to1_19.Protocol1_19_1To1_19;
import com.viaversion.viabackwards.protocol.v1_20_3to1_20_2.Protocol1_20_3To1_20_2;
import com.viaversion.viabackwards.protocol.v1_20_5to1_20_3.Protocol1_20_5To1_20_3;
import com.viaversion.viabackwards.protocol.v1_20_2to1_20.Protocol1_20_2To1_20;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.Protocol1_21To1_20_5;
import com.viaversion.viabackwards.protocol.v1_9_3to1_9_1.Protocol1_9_3To1_9_1;
import com.viaversion.viabackwards.protocol.v1_10to1_9_3.Protocol1_10To1_9_3;
import com.viaversion.viabackwards.protocol.v1_9_1to1_9.Protocol1_9_1To1_9;
@@ -139,7 +140,7 @@ public interface ViaBackwardsPlatform {
protocolManager.registerProtocol(new Protocol1_20_3To1_20_2(), ProtocolVersion.v1_20_2, ProtocolVersion.v1_20_3);
protocolManager.registerProtocol(new Protocol1_20_5To1_20_3(), ProtocolVersion.v1_20_3, ProtocolVersion.v1_20_5);
- protocolManager.registerProtocol(new Protocol1_20_5To1_21(), ProtocolVersion.v1_20_5, ProtocolVersion.v1_21);
+ protocolManager.registerProtocol(new Protocol1_21To1_20_5(), ProtocolVersion.v1_20_5, ProtocolVersion.v1_21);
}
/**
diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/StructuredEnchantmentRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/StructuredEnchantmentRewriter.java
index 02b181f0..b8fc1291 100644
--- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/StructuredEnchantmentRewriter.java
+++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/StructuredEnchantmentRewriter.java
@@ -32,6 +32,7 @@ import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.ListTag;
import com.viaversion.nbt.tag.NumberTag;
import com.viaversion.nbt.tag.Tag;
+import com.viaversion.viaversion.rewriter.IdRewriteFunction;
import com.viaversion.viaversion.util.ComponentUtil;
import java.util.ArrayList;
import java.util.Arrays;
@@ -48,7 +49,7 @@ public class StructuredEnchantmentRewriter {
public void handleToClient(final Item item) {
final StructuredDataContainer data = item.dataContainer();
- final BackwardsMappings mappingData = itemRewriter.protocol().getMappingData();
+ final BackwardsMappingData mappingData = itemRewriter.protocol().getMappingData();
final IdRewriteFunction idRewriteFunction = id -> {
final Mappings mappings = mappingData.getEnchantmentMappings();
return mappings.getNewId(id);
diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/Protocol1_20_5To1_21.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/Protocol1_21To1_20_5.java
similarity index 71%
rename from common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/Protocol1_20_5To1_21.java
rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/Protocol1_21To1_20_5.java
index eaede343..4bc13851 100644
--- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/Protocol1_20_5To1_21.java
+++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/Protocol1_21To1_20_5.java
@@ -15,27 +15,26 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.viaversion.viabackwards.protocol.protocol1_20_5to1_21;
+package com.viaversion.viabackwards.protocol.v1_21to1_20_5;
import com.viaversion.viabackwards.api.BackwardsProtocol;
-import com.viaversion.viabackwards.api.data.BackwardsMappings;
+import com.viaversion.viabackwards.api.data.BackwardsMappingData;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.rewriter.BlockItemPacketRewriter1_21;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.rewriter.EntityPacketRewriter1_21;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.storage.EnchantmentsPaintingsStorage;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.rewriter.BlockItemPacketRewriter1_21;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.rewriter.EntityPacketRewriter1_21;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.storage.EnchantmentsPaintingsStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
-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.protocols.protocol1_20_5to1_20_3.packet.ServerboundConfigurationPackets1_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.protocols.protocol1_21to1_20_5.Protocol1_21To1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
+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;
import com.viaversion.viaversion.rewriter.AttributeRewriter;
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
@@ -43,15 +42,15 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
-public final class Protocol1_20_5To1_21 extends BackwardsProtocol {
+public final class Protocol1_21To1_20_5 extends BackwardsProtocol {
- public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.21", "1.20.5", Protocol1_21To1_20_5.class);
+ public static final BackwardsMappingData MAPPINGS = new BackwardsMappingData("1.21", "1.20.5", Protocol1_21To1_20_5.class);
private final EntityPacketRewriter1_21 entityRewriter = new EntityPacketRewriter1_21(this);
private final BlockItemPacketRewriter1_21 itemRewriter = new BlockItemPacketRewriter1_21(this);
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter tagRewriter = new TagRewriter<>(this);
- public Protocol1_20_5To1_21() {
+ public Protocol1_21To1_20_5() {
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
}
@@ -59,25 +58,25 @@ public final class Protocol1_20_5To1_21 extends BackwardsProtocol soundRewriter = new SoundRewriter<>(this);
- soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
- soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND);
+ soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND);
+ soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND_ENTITY);
soundRewriter.registerStopSound(ClientboundPackets1_20_5.STOP_SOUND);
- new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.STATISTICS);
- new AttributeRewriter<>(this).register1_20_5(ClientboundPackets1_20_5.ENTITY_PROPERTIES);
+ new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.AWARD_STATS);
+ new AttributeRewriter<>(this).register1_20_5(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES);
- translatableRewriter.registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW);
- translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.ACTIONBAR);
- translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_TEXT);
- translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_SUBTITLE);
- translatableRewriter.registerBossBar(ClientboundPackets1_20_5.BOSSBAR);
+ translatableRewriter.registerOpenScreen(ClientboundPackets1_20_5.OPEN_SCREEN);
+ translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SET_ACTION_BAR_TEXT);
+ translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SET_TITLE_TEXT);
+ translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SET_SUBTITLE_TEXT);
+ translatableRewriter.registerBossEvent(ClientboundPackets1_20_5.BOSS_EVENT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISCONNECT);
translatableRewriter.registerTabList(ClientboundPackets1_20_5.TAB_LIST);
- translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_5.COMBAT_KILL);
+ translatableRewriter.registerPlayerCombatKill1_20(ClientboundPackets1_20_5.PLAYER_COMBAT_KILL);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISGUISED_CHAT);
translatableRewriter.registerPing();
@@ -93,7 +92,7 @@ public final class Protocol1_20_5To1_21 extends BackwardsProtocol.
*/
-package com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.rewriter;
+package com.viaversion.viabackwards.protocol.v1_21to1_20_5.rewriter;
+import com.viaversion.nbt.tag.CompoundTag;
+import com.viaversion.nbt.tag.ListTag;
+import com.viaversion.nbt.tag.StringTag;
+import com.viaversion.nbt.tag.Tag;
import com.viaversion.viabackwards.api.rewriters.BackwardsStructuredItemRewriter;
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
import com.viaversion.viabackwards.api.rewriters.StructuredEnchantmentRewriter;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.Protocol1_20_5To1_21;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.storage.EnchantmentsPaintingsStorage;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.Protocol1_21To1_20_5;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.storage.EnchantmentsPaintingsStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.data.StructuredData;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataContainer;
@@ -29,57 +33,52 @@ import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.item.data.Enchantments;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
-import com.viaversion.viaversion.api.type.types.version.Types1_20;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.api.type.types.version.Types1_21;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
-import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
-import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.Enchantments1_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.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.protocols.v1_20_2to1_20_3.rewriter.RecipeRewriter1_20_3;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.data.Enchantments1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_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;
import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.IdRewriteFunction;
import java.util.ArrayList;
import java.util.Arrays;
import org.checkerframework.checker.nullness.qual.Nullable;
-public final class BlockItemPacketRewriter1_21 extends BackwardsStructuredItemRewriter {
+public final class BlockItemPacketRewriter1_21 extends BackwardsStructuredItemRewriter {
private final StructuredEnchantmentRewriter enchantmentRewriter = new StructuredEnchantmentRewriter(this);
- public BlockItemPacketRewriter1_21(final Protocol1_20_5To1_21 protocol) {
+ public BlockItemPacketRewriter1_21(final Protocol1_21To1_20_5 protocol) {
super(protocol, Types1_21.ITEM, Types1_21.ITEM_ARRAY, Types1_20_5.ITEM, Types1_20_5.ITEM_ARRAY);
}
@Override
public void registerPackets() {
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);
- blockRewriter.registerEffect(ClientboundPackets1_20_5.EFFECT, 1010, 2001);
- blockRewriter.registerChunkData1_19(ClientboundPackets1_20_5.CHUNK_DATA, ChunkType1_20_2::new);
+ blockRewriter.registerBlockEvent(ClientboundPackets1_20_5.BLOCK_EVENT);
+ blockRewriter.registerBlockUpdate(ClientboundPackets1_20_5.BLOCK_UPDATE);
+ blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_20_5.SECTION_BLOCKS_UPDATE);
+ blockRewriter.registerLevelEvent(ClientboundPackets1_20_5.LEVEL_EVENT, 1010, 2001);
+ blockRewriter.registerLevelChunk1_19(ClientboundPackets1_20_5.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA);
- registerSetCooldown(ClientboundPackets1_20_5.COOLDOWN);
- registerWindowItems1_17_1(ClientboundPackets1_20_5.WINDOW_ITEMS);
- registerSetSlot1_17_1(ClientboundPackets1_20_5.SET_SLOT);
- registerAdvancements1_20_3(ClientboundPackets1_20_5.ADVANCEMENTS);
- registerEntityEquipmentArray(ClientboundPackets1_20_5.ENTITY_EQUIPMENT);
- registerClickWindow1_17_1(ServerboundPackets1_20_5.CLICK_WINDOW);
- registerTradeList1_20_5(ClientboundPackets1_20_5.TRADE_LIST, Types1_21.ITEM_COST, Types1_20_5.ITEM_COST, Types1_21.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST);
- registerCreativeInvAction(ServerboundPackets1_20_5.CREATIVE_INVENTORY_ACTION);
- registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_5.WINDOW_PROPERTY);
- registerSpawnParticle1_20_5(ClientboundPackets1_20_5.SPAWN_PARTICLE, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
- registerExplosion(ClientboundPackets1_20_5.EXPLOSION, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
+ registerCooldown(ClientboundPackets1_20_5.COOLDOWN);
+ registerSetContent1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_CONTENT);
+ registerSetSlot1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_SLOT);
+ registerAdvancements1_20_3(ClientboundPackets1_20_5.UPDATE_ADVANCEMENTS);
+ registerSetEquipment(ClientboundPackets1_20_5.SET_EQUIPMENT);
+ registerContainerClick1_17_1(ServerboundPackets1_20_5.CONTAINER_CLICK);
+ registerMerchantOffers1_20_5(ClientboundPackets1_20_5.MERCHANT_OFFERS, Types1_21.ITEM_COST, Types1_20_5.ITEM_COST, Types1_21.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST);
+ registerSetCreativeModeSlot(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT);
+ registerContainerSetData(ClientboundPackets1_20_5.CONTAINER_SET_DATA);
+ registerLevelParticles1_20_5(ClientboundPackets1_20_5.LEVEL_PARTICLES, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
+ registerExplosion(ClientboundPackets1_20_5.EXPLODE, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
- new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.DECLARE_RECIPES);
+ new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.UPDATE_RECIPES);
}
@Override
diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/EntityPacketRewriter1_21.java
similarity index 68%
rename from common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java
rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/EntityPacketRewriter1_21.java
index 07144c8e..dd3add0a 100644
--- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/rewriter/EntityPacketRewriter1_21.java
+++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/EntityPacketRewriter1_21.java
@@ -15,35 +15,35 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.rewriter;
+package com.viaversion.viabackwards.protocol.v1_21to1_20_5.rewriter;
+import com.viaversion.nbt.tag.CompoundTag;
+import com.viaversion.nbt.tag.Tag;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.Protocol1_20_5To1_21;
-import com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.storage.EnchantmentsPaintingsStorage;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.Protocol1_21To1_20_5;
+import com.viaversion.viabackwards.protocol.v1_21to1_20_5.storage.EnchantmentsPaintingsStorage;
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.remapper.PacketHandlers;
-import com.viaversion.viaversion.api.type.Type;
+import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.api.type.types.version.Types1_21;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
-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.protocols.protocol1_21to1_20_5.data.Paintings1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
+import com.viaversion.viaversion.protocols.v1_20_5to1_21.data.Paintings1_20_5;
import com.viaversion.viaversion.util.Key;
import com.viaversion.viaversion.util.KeyMappings;
import java.util.HashMap;
import java.util.Map;
-public final class EntityPacketRewriter1_21 extends EntityRewriter {
+public final class EntityPacketRewriter1_21 extends EntityRewriter {
private final Map oldPaintings = new HashMap<>();
- public EntityPacketRewriter1_21(final Protocol1_20_5To1_21 protocol) {
- super(protocol, Types1_20_5.META_TYPES.optionalComponentType, Types1_20_5.META_TYPES.booleanType);
+ public EntityPacketRewriter1_21(final Protocol1_21To1_20_5 protocol) {
+ super(protocol, Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType, Types1_20_5.ENTITY_DATA_TYPES.booleanType);
for (int i = 0; i < Paintings1_20_5.PAINTINGS.length; i++) {
final Paintings1_20_5.PaintingVariant painting = Paintings1_20_5.PAINTINGS[i];
@@ -53,13 +53,13 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter {
- final String key = Key.stripMinecraftNamespace(wrapper.passthrough(Type.STRING));
- final RegistryEntry[] entries = wrapper.passthrough(Type.REGISTRY_ENTRY_ARRAY);
+ final String key = Key.stripMinecraftNamespace(wrapper.passthrough(Types.STRING));
+ final RegistryEntry[] entries = wrapper.passthrough(Types.REGISTRY_ENTRY_ARRAY);
final boolean paintingVariant = key.equals("painting_variant");
if (paintingVariant || key.equals("enchantment")) {
// Track custom registries and cancel the packet
@@ -88,27 +88,27 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter {
- final int dimensionId = wrapper.passthrough(Type.VAR_INT);
- final String world = wrapper.passthrough(Type.STRING);
+ final int dimensionId = wrapper.passthrough(Types.VAR_INT);
+ final String world = wrapper.passthrough(Types.STRING);
trackWorldDataByKey1_20_5(wrapper.user(), dimensionId, world); // Tracks world height and name for chunk data and entity (un)tracking
});
}
@@ -142,25 +142,25 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter {
+ filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.paintingVariantType).handler((event, meta) -> {
final EnchantmentsPaintingsStorage storage = event.user().get(EnchantmentsPaintingsStorage.class);
final int id = meta.value();
meta.setValue(storage.mappedPainting(id));
});
- filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
+ filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/storage/EnchantmentsPaintingsStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/storage/EnchantmentsPaintingsStorage.java
similarity index 93%
rename from common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/storage/EnchantmentsPaintingsStorage.java
rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/storage/EnchantmentsPaintingsStorage.java
index 94a01ed3..c2882dcd 100644
--- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_5to1_21/storage/EnchantmentsPaintingsStorage.java
+++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/storage/EnchantmentsPaintingsStorage.java
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.viaversion.viabackwards.protocol.protocol1_20_5to1_21.storage;
+package com.viaversion.viabackwards.protocol.v1_21to1_20_5.storage;
+import com.viaversion.nbt.tag.Tag;
import com.viaversion.viaversion.api.connection.StorableObject;
-import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.util.KeyMappings;
import org.checkerframework.checker.nullness.qual.Nullable;
diff --git a/gradle.properties b/gradle.properties
index ca68b79c..f0f05a5f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-projectVersion=5.0.0-24w19a-SNAPSHOT
+projectVersion=5.0.0-24w19b-SNAPSHOT
# Smile emoji
mcVersions=1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e6779a8d..7a78cd9a 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
-viaver = "5.0.0-24w19a-SNAPSHOT"
+viaver = "5.0.0-24w19b-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"
diff --git a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java
index ed59a84f..e040897a 100644
--- a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java
+++ b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java
@@ -32,7 +32,9 @@ import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
+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;
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
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 ba784c6b..b05bc500 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
@@ -28,6 +28,7 @@ import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
+import com.viaversion.viaversion.util.Key;
// Replace if needed
// Types1_OLD
@@ -78,15 +79,15 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter {
- int id = meta.metaType().typeId();
+ /*filter().handler((event, data) -> {
+ int id = data.dataType().typeId();
if (id >= ac) {
return;
} else if (id >= ab) {
id--;
}
- meta.setMetaType(Types1_20_5.META_TYPES.byId(id));
+ data.setDataType(Types1_20_5.ENTITY_DATA_TYPES.byId(id));
});*/
registerMetaTypeHandler1_20_3(