From 5681054888a7c163135abf06b08abbfbd77a2034 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Sat, 2 Mar 2024 20:29:38 +0100 Subject: [PATCH] Updated Via API usage --- build.gradle | 2 +- .../api/remapper/LegacyItemRewriter.java | 53 +++++++++++++++---- .../Protocol1_0_0_1tob1_8_0_1.java | 9 ---- .../rewriter/ItemRewriter.java | 10 +++- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../Protocol1_3_1_2to1_2_4_5.java | 8 --- .../rewriter/ItemRewriter.java | 10 +++- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- .../rewriter/ItemRewriter.java | 4 +- 16 files changed, 83 insertions(+), 49 deletions(-) diff --git a/build.gradle b/build.gradle index d5b3dc0..df1b3cd 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ repositories { } dependencies { - compileOnly "com.viaversion:viaversion-common:4.10.0-24w07a-SNAPSHOT" + compileOnly "com.viaversion:viaversion-common:4.10.0-24w09a-SNAPSHOT" compileOnly "org.yaml:snakeyaml:2.2" compileOnly "com.google.guava:guava:33.0.0-jre" compileOnly "io.netty:netty-handler:4.1.107.Final" diff --git a/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java b/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java index 4bdb9a6..3b538b2 100644 --- a/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/api/remapper/LegacyItemRewriter.java @@ -19,8 +19,8 @@ package net.raphimc.vialegacy.api.remapper; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.Protocol; +import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; -import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.rewriter.ItemRewriter; import com.viaversion.viaversion.api.rewriter.RewriterBase; @@ -37,11 +37,23 @@ public abstract class LegacyItemRewriter

extends RewriterBas private final ObjectList nonExistentItems = new ObjectArrayList<>(); protected final String tagName; protected final String protocolName; + private final Type itemType; + private final Type mappedItemType; + private final Type itemArrayType; + private final Type mappedItemArrayType; - public LegacyItemRewriter(final P protocol, final String protocolName) { + public LegacyItemRewriter(final P protocol, final String protocolName, final Type itemType, final Type itemArrayType) { + this(protocol, protocolName, itemType, itemArrayType, itemType, itemArrayType); + } + + public LegacyItemRewriter(final P protocol, final String protocolName, final Type itemType, final Type itemArrayType, final Type mappedItemType, final Type mappedItemArrayType) { super(protocol); this.tagName = protocolName.replace(".", "_") + "_ViaLegacy_" + System.currentTimeMillis(); this.protocolName = protocolName; + this.itemType = itemType; + this.itemArrayType = itemArrayType; + this.mappedItemType = mappedItemType; + this.mappedItemArrayType = mappedItemArrayType; } protected void addRemappedItem(final int oldItemId, final int newItemId, final String newItemName) { @@ -79,13 +91,12 @@ public abstract class LegacyItemRewriter

extends RewriterBas } - public void registerCreativeInventoryAction(final ServerboundPacketType packetType, final Type type) { + public void registerCreativeInventoryAction(final ServerboundPacketType packetType) { this.protocol.registerServerbound(packetType, new PacketHandlers() { @Override public void register() { map(Type.SHORT); // slot - map(type); // item - handler(itemToServerHandler(type)); + handler(wrapper -> handleServerboundItem(wrapper)); } }); } @@ -124,13 +135,35 @@ public abstract class LegacyItemRewriter

extends RewriterBas return item; } - - private PacketHandler itemToClientHandler(Type type) { - return wrapper -> handleItemToClient(wrapper.get(type, 0)); + @Override + public Type itemType() { + return this.itemType; } - private PacketHandler itemToServerHandler(Type type) { - return wrapper -> handleItemToServer(wrapper.get(type, 0)); + @Override + public Type itemArrayType() { + return this.itemArrayType; + } + + @Override + public Type mappedItemType() { + return this.mappedItemType; + } + + @Override + public Type mappedItemArrayType() { + return this.mappedItemArrayType; + } + + + private void handleClientboundItem(final PacketWrapper wrapper) throws Exception { + final Item item = this.handleItemToClient(wrapper.read(this.itemType)); + wrapper.write(this.mappedItemType, item); + } + + private void handleServerboundItem(final PacketWrapper wrapper) throws Exception { + final Item item = this.handleItemToServer(wrapper.read(this.mappedItemType)); + wrapper.write(this.itemType, item); } private void setRemappedNameRead(final Item item, final String name) { diff --git a/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/Protocol1_0_0_1tob1_8_0_1.java b/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/Protocol1_0_0_1tob1_8_0_1.java index 2d3cabf..55a920d 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/Protocol1_0_0_1tob1_8_0_1.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/Protocol1_0_0_1tob1_8_0_1.java @@ -28,7 +28,6 @@ import net.raphimc.vialegacy.api.splitter.PreNettySplitter; import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter.ItemRewriter; import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage.PlayerAirTimeStorage; import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.task.PlayerAirTimeUpdateTask; -import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types.Typesb1_8_0_1; import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ClientboundPackets1_0; import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ServerboundPackets1_0; import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4; @@ -91,14 +90,6 @@ public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol itemRewriter.handleItemToServer(wrapper.get(Typesb1_8_0_1.CREATIVE_ITEM, 0))); - } - }); this.cancelServerbound(ServerboundPackets1_0.CLICK_WINDOW_BUTTON); } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/rewriter/ItemRewriter.java index 826ab23..8b2961d 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/beta/protocol1_0_0_1tob1_8_0_1/rewriter/ItemRewriter.java @@ -19,11 +19,14 @@ package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter; import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1; +import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types.Typesb1_8_0_1; +import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ServerboundPackets1_0; +import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4; public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_0_0_1tob1_8_0_1 protocol) { - super(protocol, "b1.8.1"); + super(protocol, "b1.8.1", Typesb1_8_0_1.CREATIVE_ITEM, null, Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); this.addNonExistentItemRange(110, 122); this.addNonExistentItemRange(369, 382); @@ -31,4 +34,9 @@ public class ItemRewriter extends LegacyItemRewriter this.addNonExistentItemRange(2256, 2266); } + @Override + protected void registerPackets() { + this.registerCreativeInventoryAction(ServerboundPackets1_0.CREATIVE_INVENTORY_ACTION); + } + } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_1to1_0_0_1/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_1to1_0_0_1/rewriter/ItemRewriter.java index 2900397..b64c6fc 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_1to1_0_0_1/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_1to1_0_0_1/rewriter/ItemRewriter.java @@ -25,14 +25,14 @@ import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Ty public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_1to1_0_0_1 protocol) { - super(protocol, "1.0"); + super(protocol, "1.0", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); this.addNonExistentItems(383); } @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_1.CREATIVE_INVENTORY_ACTION, Types1_2_4.NBT_ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_1.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_1_3to1_1/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_1_3to1_1/rewriter/ItemRewriter.java index e5a3537..cd87d26 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_1_3to1_1/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_1_3to1_1/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Ty public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_2_1_3to1_1 protocol) { - super(protocol, "1.1"); + super(protocol, "1.1", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); this.addNonExistentItem(6, 3); this.addNonExistentItem(17, 3); @@ -38,7 +38,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_2_1.CREATIVE_INVENTORY_ACTION, Types1_2_4.NBT_ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_2_1.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_4_5to1_2_1_3/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_4_5to1_2_1_3/rewriter/ItemRewriter.java index a46568e..2f1b05f 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_4_5to1_2_1_3/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_2_4_5to1_2_1_3/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Ty public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_2_4_5to1_2_1_3 protocol) { - super(protocol, "1.2.3"); + super(protocol, "1.2.3", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY); this.addNonExistentItem(5, 1, 3); this.addNonExistentItem(24, 1, 2); @@ -33,7 +33,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_2_4.CREATIVE_INVENTORY_ACTION, Types1_2_4.NBT_ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_2_4.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/Protocol1_3_1_2to1_2_4_5.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/Protocol1_3_1_2to1_2_4_5.java index 944ed2d..d88b339 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/Protocol1_3_1_2to1_2_4_5.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/Protocol1_3_1_2to1_2_4_5.java @@ -711,14 +711,6 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol itemRewriter.handleItemToServer(wrapper.get(Types1_2_4.NBT_ITEM, 0))); - } - }); this.registerServerbound(ServerboundPackets1_3_1.PLAYER_ABILITIES, wrapper -> { final byte mask = wrapper.read(Type.BYTE); // flags wrapper.read(Type.BYTE); // fly speed diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/rewriter/ItemRewriter.java index a7fa365..12bca4b 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_3_1_2to1_2_4_5/rewriter/ItemRewriter.java @@ -19,15 +19,23 @@ package net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.rewrite import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter; import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.Protocol1_3_1_2to1_2_4_5; +import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4; +import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.ServerboundPackets1_3_1; +import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6; public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_3_1_2to1_2_4_5 protocol) { - super(protocol, "1.2.5"); + super(protocol, "1.2.5", Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY, Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItemRange(126, 136); this.addNonExistentItem(322, 1); this.addNonExistentItemRange(386, 388); } + @Override + protected void registerPackets() { + this.registerCreativeInventoryAction(ServerboundPackets1_3_1.CREATIVE_INVENTORY_ACTION); + } + } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_2to1_3_1_2/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_2to1_3_1_2/rewriter/ItemRewriter.java index 44c036c..eb2c83d 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_2to1_3_1_2/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_2to1_3_1_2/rewriter/ItemRewriter.java @@ -27,7 +27,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_4_2to1_3_1_2 protocol) { - super(protocol, "1.3.2"); + super(protocol, "1.3.2", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItemRange(137, 145); this.addNonExistentItemRange(389, 400); @@ -38,7 +38,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION); } @Override diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_4_5to1_4_2/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_4_5to1_4_2/rewriter/ItemRewriter.java index 68aa278..479a30d 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_4_5to1_4_2/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_4_5to1_4_2/rewriter/ItemRewriter.java @@ -25,14 +25,14 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_4_4_5to1_4_2 protocol) { - super(protocol, "1.4.2"); + super(protocol, "1.4.2", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItems(2267); } @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_6_7to1_4_4_5/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_6_7to1_4_4_5/rewriter/ItemRewriter.java index 364d473..79d3716 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_6_7to1_4_4_5/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_4_6_7to1_4_4_5/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_4_6_7to1_4_4_5 protocol) { - super(protocol, "1.4.5"); + super(protocol, "1.4.5", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItem(43, 6); this.addNonExistentItem(44, 6); @@ -34,7 +34,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_5_0_1to1_4_6_7/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_5_0_1to1_4_6_7/rewriter/ItemRewriter.java index 81a0aab..3c22ea8 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_5_0_1to1_4_6_7/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_5_0_1to1_4_6_7/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_5_0_1to1_4_6_7 protocol) { - super(protocol, "1.4.7"); + super(protocol, "1.4.7", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItem(43, 7); this.addNonExistentItem(44, 7); @@ -36,7 +36,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_6_1to1_5_2/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_6_1to1_5_2/rewriter/ItemRewriter.java index d02d524..ab3ae98 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_6_1to1_5_2/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_6_1to1_5_2/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_6_1to1_5_2 protocol) { - super(protocol, "1.5.2"); + super(protocol, "1.5.2", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addNonExistentItems(159); this.addNonExistentItemRange(170, 173); @@ -35,7 +35,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_6_4.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_6_4.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/rewriter/ItemRewriter.java index 8f8cb75..f7f9570 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_7_2_5to1_6_4/rewriter/ItemRewriter.java @@ -25,7 +25,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_7_2_5to1_6_4 protocol) { - super(protocol, "1.6.4"); + super(protocol, "1.6.4", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY); this.addRemappedItem(26, 355, "Bed Block"); this.addRemappedItem(34, 33, "Piston Head"); @@ -71,7 +71,7 @@ public class ItemRewriter extends LegacyItemRewriter { @Override protected void registerPackets() { - this.registerCreativeInventoryAction(ServerboundPackets1_7_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.ITEM); + this.registerCreativeInventoryAction(ServerboundPackets1_7_2.CREATIVE_INVENTORY_ACTION); } } diff --git a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ItemRewriter.java b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ItemRewriter.java index 36fb01a..a71f830 100644 --- a/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ItemRewriter.java +++ b/src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ItemRewriter.java @@ -19,6 +19,7 @@ package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.item.Item; +import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag; import net.raphimc.vialegacy.ViaLegacy; @@ -28,13 +29,14 @@ import net.raphimc.vialegacy.protocols.release.protocol1_7_6_10to1_7_2_5.Protoco import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10; import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.model.GameProfile; import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.providers.GameProfileFetcher; +import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6; import java.util.UUID; public class ItemRewriter extends LegacyItemRewriter { public ItemRewriter(final Protocol1_8to1_7_6_10 protocol) { - super(protocol, "1.7.10"); + super(protocol, "1.7.10", Types1_7_6.ITEM, Types1_7_6.ITEM_ARRAY, Type.ITEM1_8, Type.ITEM1_8_SHORT_ARRAY); this.addRemappedItem(8, 326, "Water Block"); this.addRemappedItem(9, 326, "Stationary Water Block");