From de21548a8ef274b9a152b0f922539535f5b87499 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:29:17 +0100 Subject: [PATCH] Clean up more item type usage in ItemRewriter (#675) --- .../api/rewriters/ItemRewriter.java | 8 ++---- .../api/rewriters/ItemRewriterBase.java | 4 --- .../rewriters/LegacyBlockItemRewriter.java | 3 ++- .../packets/BlockItemPackets1_11.java | 27 +++++++++---------- .../packets/BlockItemPackets1_12.java | 8 +++--- .../packets/ItemPackets1_11_1.java | 10 +++---- .../packets/BlockItemPackets1_13.java | 4 +-- .../packets/InventoryPackets1_13_2.java | 2 +- .../packets/BlockItemPackets1_14.java | 14 +++++----- .../packets/InventoryPackets1_13_1.java | 14 +++++----- .../packets/BlockItemPackets1_15.java | 14 +++++----- .../packets/BlockItemPackets1_16.java | 14 +++++----- .../packets/BlockItemPackets1_16_2.java | 14 +++++----- .../packets/BlockItemPackets1_17.java | 8 +++--- .../packets/BlockItemPackets1_18.java | 6 ++--- .../packets/BlockItemPackets1_19.java | 6 ++--- .../packets/BlockItemPackets1_19_3.java | 6 ++--- .../packets/BlockItemPackets1_19_4.java | 6 ++--- .../packets/BlockItemPackets1_20.java | 4 +-- .../packets/BlockItemPackets1_10.java | 11 ++++---- 20 files changed, 86 insertions(+), 97 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriter.java index 1eba243e..9754a193 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriter.java @@ -36,10 +36,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; public class ItemRewriter> extends ItemRewriterBase { - public ItemRewriter(T protocol) { - super(protocol, true); - } - public ItemRewriter(T protocol, Type itemType, Type itemArrayType) { super(protocol, itemType, itemArrayType, true); } @@ -131,7 +127,7 @@ public class ItemRewriter type) { + public void registerAdvancements(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -156,7 +152,7 @@ public class ItemRewriter itemType, Type itemArrayType, boolean jsonNameFormat) { super(protocol, itemType, itemArrayType); this.jsonNameFormat = jsonNameFormat; diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java index 69f7d922..74b58813 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java @@ -30,6 +30,7 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; +import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; import com.viaversion.viaversion.libs.gson.JsonElement; @@ -106,7 +107,7 @@ public abstract class LegacyBlockItemRewriter horse = getChestedHorse(wrapper.user()); - if (!horse.isPresent()) - return; - ChestedHorseStorage storage = horse.get(); - int currentSlot = wrapper.get(Type.SHORT, 0); - wrapper.set(Type.SHORT, 0, ((Integer) (currentSlot = getNewSlotId(storage, currentSlot))).shortValue()); - wrapper.set(Type.ITEM1_8, 0, getNewItem(storage, currentSlot, wrapper.get(Type.ITEM1_8, 0))); - } + handler(wrapper -> { + if (isLlama(wrapper.user())) { + Optional horse = getChestedHorse(wrapper.user()); + if (!horse.isPresent()) + return; + ChestedHorseStorage storage = horse.get(); + int currentSlot = wrapper.get(Type.SHORT, 0); + wrapper.set(Type.SHORT, 0, ((Integer) (currentSlot = getNewSlotId(storage, currentSlot))).shortValue()); + wrapper.set(Type.ITEM1_8, 0, getNewItem(storage, currentSlot, wrapper.get(Type.ITEM1_8, 0))); } }); } @@ -113,9 +110,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter Trading + // Plugin message -> Trading protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketHandlers() { @Override public void register() { @@ -172,7 +169,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java index 9625ac9d..995d29e8 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java @@ -80,9 +80,9 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter Trading protocol.registerClientbound(ClientboundPackets1_12.PLUGIN_MESSAGE, new PacketHandlers() { @@ -148,7 +148,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java index bdc3ebc2..67f892cd 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java @@ -39,9 +39,9 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter Trading protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketHandlers() { @@ -72,8 +72,8 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java index 8b8efd31..8416719d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java @@ -69,7 +69,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit private final String extraNbtTag; public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) { - super(protocol); + super(protocol, null, null); extraNbtTag = "VB|" + protocol.getClass().getSimpleName() + "|2"; } @@ -237,7 +237,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit @Override public void register() { map(Type.UNSIGNED_BYTE); - map(Type.ITEM1_13_ARRAY, Type.ITEM1_8_SHORT_ARRAY); + map(Type.ITEM1_13_SHORT_ARRAY, Type.ITEM1_8_SHORT_ARRAY); handler(itemArrayToClientHandler(Type.ITEM1_8_SHORT_ARRAY)); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_1to1_13_2/packets/InventoryPackets1_13_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_1to1_13_2/packets/InventoryPackets1_13_2.java index 9a9e5a45..c7e719f5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_1to1_13_2/packets/InventoryPackets1_13_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_1to1_13_2/packets/InventoryPackets1_13_2.java @@ -39,7 +39,7 @@ public class InventoryPackets1_13_2 { @Override public void register() { map(Type.UNSIGNED_BYTE); // 0 - Window ID - map(Type.ITEM1_13_2_SHORT_ARRAY, Type.ITEM1_13_ARRAY); // 1 - Window Values + map(Type.ITEM1_13_2_SHORT_ARRAY, Type.ITEM1_13_SHORT_ARRAY); // 1 - Window Values } }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index 1d80969e..91093559 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -64,7 +64,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit private EnchantmentRewriter enchantmentRewriter; public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY); } @Override @@ -170,9 +170,9 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit BlockRewriter blockRewriter = BlockRewriter.legacy(protocol); registerSetCooldown(ClientboundPackets1_14.COOLDOWN); - registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.ITEM1_13_2_SHORT_ARRAY); - registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.ITEM1_13_2); - registerAdvancements(ClientboundPackets1_14.ADVANCEMENTS, Type.ITEM1_13_2); + registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS); + registerSetSlot(ClientboundPackets1_14.SET_SLOT); + registerAdvancements(ClientboundPackets1_14.ADVANCEMENTS); // Trade List -> Plugin Message protocol.registerClientbound(ClientboundPackets1_14.TRADE_LIST, ClientboundPackets1_13.PLUGIN_MESSAGE, wrapper -> { @@ -293,8 +293,8 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit }); - registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.ITEM1_13_2); - registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.ITEM1_13_2); + registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW); + registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION); protocol.registerClientbound(ClientboundPackets1_14.BLOCK_BREAK_ANIMATION, new PacketHandlers() { @Override @@ -436,7 +436,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit } }); - registerSpawnParticle(ClientboundPackets1_14.SPAWN_PARTICLE, Type.ITEM1_13_2, Type.FLOAT); + registerSpawnParticle(ClientboundPackets1_14.SPAWN_PARTICLE, Type.FLOAT); protocol.registerClientbound(ClientboundPackets1_14.MAP_DATA, new PacketHandlers() { @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/InventoryPackets1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/InventoryPackets1_13_1.java index 6a213c89..caccdac5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/InventoryPackets1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/InventoryPackets1_13_1.java @@ -27,14 +27,14 @@ import com.viaversion.viaversion.rewriter.ItemRewriter; public class InventoryPackets1_13_1 extends ItemRewriter { public InventoryPackets1_13_1(Protocol1_13To1_13_1 protocol) { - super(protocol, Type.ITEM1_13, Type.ITEM1_13_ARRAY); + super(protocol, Type.ITEM1_13, Type.ITEM1_13_SHORT_ARRAY); } @Override public void registerPackets() { registerSetCooldown(ClientboundPackets1_13.COOLDOWN); - registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.ITEM1_13_ARRAY); - registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.ITEM1_13); + registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS); + registerSetSlot(ClientboundPackets1_13.SET_SLOT); protocol.registerClientbound(ClientboundPackets1_13.PLUGIN_MESSAGE, wrapper -> { String channel = wrapper.passthrough(Type.STRING); @@ -64,10 +64,10 @@ public class InventoryPackets1_13_1 extends ItemRewriter { public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY); } @Override @@ -47,13 +47,13 @@ public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewrit protocol.registerServerbound(ServerboundPackets1_14.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.passthrough(Type.ITEM1_13_2))); registerSetCooldown(ClientboundPackets1_15.COOLDOWN); - registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.ITEM1_13_2_SHORT_ARRAY); - registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.ITEM1_13_2); + registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS); + registerSetSlot(ClientboundPackets1_15.SET_SLOT); registerTradeList(ClientboundPackets1_15.TRADE_LIST); - registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT, Type.ITEM1_13_2); - registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.ITEM1_13_2); - registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.ITEM1_13_2); - registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.ITEM1_13_2); + registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT); + registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS); + registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW); + registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION); blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_15.ACKNOWLEDGE_PLAYER_DIGGING); blockRewriter.registerBlockAction(ClientboundPackets1_15.BLOCK_ACTION); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java index a521101c..908bb119 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/BlockItemPackets1_16.java @@ -60,7 +60,7 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit private EnchantmentRewriter enchantmentRewriter; public BlockItemPackets1_16(Protocol1_15_2To1_16 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY); } @Override @@ -94,10 +94,10 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit }); registerSetCooldown(ClientboundPackets1_16.COOLDOWN); - registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS, Type.ITEM1_13_2_SHORT_ARRAY); - registerSetSlot(ClientboundPackets1_16.SET_SLOT, Type.ITEM1_13_2); + registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS); + registerSetSlot(ClientboundPackets1_16.SET_SLOT); registerTradeList(ClientboundPackets1_16.TRADE_LIST); - registerAdvancements(ClientboundPackets1_16.ADVANCEMENTS, Type.ITEM1_13_2); + registerAdvancements(ClientboundPackets1_16.ADVANCEMENTS); blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING); blockRewriter.registerBlockAction(ClientboundPackets1_16.BLOCK_ACTION); @@ -205,7 +205,7 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001); - registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, Type.ITEM1_13_2, Type.DOUBLE); + registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, Type.DOUBLE); protocol.registerClientbound(ClientboundPackets1_16.WINDOW_PROPERTY, new PacketHandlers() { @Override @@ -245,8 +245,8 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit handleBlockEntity(tag); }); - registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.ITEM1_13_2); - registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.ITEM1_13_2); + registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW); + registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION); protocol.registerServerbound(ServerboundPackets1_14.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.passthrough(Type.ITEM1_13_2))); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java index b3e7258e..68094eda 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java @@ -41,7 +41,7 @@ import com.viaversion.viaversion.rewriter.RecipeRewriter; public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter { public BlockItemPackets1_16_2(Protocol1_16_1To1_16_2 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY); } @Override @@ -51,11 +51,11 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr new RecipeRewriter<>(protocol).register(ClientboundPackets1_16_2.DECLARE_RECIPES); registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN); - registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.ITEM1_13_2_SHORT_ARRAY); - registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.ITEM1_13_2); + registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS); + registerSetSlot(ClientboundPackets1_16_2.SET_SLOT); registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT); registerTradeList(ClientboundPackets1_16_2.TRADE_LIST); - registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.ITEM1_13_2); + registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS); protocol.registerClientbound(ClientboundPackets1_16_2.UNLOCK_RECIPES, wrapper -> { wrapper.passthrough(Type.VAR_INT); @@ -132,10 +132,10 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001); - registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.ITEM1_13_2, Type.DOUBLE); + registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.DOUBLE); - registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.ITEM1_13_2); - registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.ITEM1_13_2); + registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW); + registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION); protocol.registerServerbound(ServerboundPackets1_16.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.passthrough(Type.ITEM1_13_2))); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java index 5124e9e9..4b30fd37 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java @@ -56,7 +56,7 @@ import java.util.List; public final class BlockItemPackets1_17 extends ItemRewriter { public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_SHORT_ARRAY); } @Override @@ -66,17 +66,17 @@ public final class BlockItemPackets1_17 extends ItemRewriter(protocol).register(ClientboundPackets1_17.DECLARE_RECIPES); registerSetCooldown(ClientboundPackets1_17.COOLDOWN); - registerWindowItems(ClientboundPackets1_17.WINDOW_ITEMS, Type.ITEM1_13_2_SHORT_ARRAY); + registerWindowItems(ClientboundPackets1_17.WINDOW_ITEMS); registerEntityEquipmentArray(ClientboundPackets1_17.ENTITY_EQUIPMENT); registerTradeList(ClientboundPackets1_17.TRADE_LIST); - registerAdvancements(ClientboundPackets1_17.ADVANCEMENTS, Type.ITEM1_13_2); + registerAdvancements(ClientboundPackets1_17.ADVANCEMENTS); blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_17.ACKNOWLEDGE_PLAYER_DIGGING); blockRewriter.registerBlockAction(ClientboundPackets1_17.BLOCK_ACTION); blockRewriter.registerEffect(ClientboundPackets1_17.EFFECT, 1010, 2001); - registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.ITEM1_13_2); + registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION); protocol.registerServerbound(ServerboundPackets1_16_2.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.passthrough(Type.ITEM1_13_2))); // TODO Since the carried and modified items are typically set incorrectly, the server sends unnecessary diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/packets/BlockItemPackets1_18.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/packets/BlockItemPackets1_18.java index d2020d03..b6de12f0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/packets/BlockItemPackets1_18.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/packets/BlockItemPackets1_18.java @@ -50,7 +50,7 @@ import java.util.List; public final class BlockItemPackets1_18 extends ItemRewriter { public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_ARRAY); } @Override @@ -62,7 +62,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter { public BlockItemPackets1_19(final Protocol1_18_2To1_19 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_ARRAY); } @Override @@ -52,7 +52,7 @@ public final class BlockItemPackets1_19 extends ItemRewriter { public BlockItemPackets1_19_3(final Protocol1_19_1To1_19_3 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_ARRAY); } @Override @@ -49,10 +49,10 @@ public final class BlockItemPackets1_19_3 extends ItemRewriter { public BlockItemPackets1_19_4(final Protocol1_19_3To1_19_4 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_ARRAY); } @Override @@ -67,11 +67,11 @@ public final class BlockItemPackets1_19_4 extends ItemRewriter NEW_TRIM_PATTERNS = new HashSet<>(Arrays.asList("host", "raiser", "shaper", "silence", "wayfinder")); public BlockItemPackets1_20(final Protocol1_19_4To1_20 protocol) { - super(protocol); + super(protocol, Type.ITEM1_13_2, Type.ITEM1_13_2_ARRAY); } @Override @@ -91,7 +91,7 @@ public final class BlockItemPackets1_20 extends ItemRewriter { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);