From 7e2775114b86c624e9219488a09fcd77e4bbb5b0 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Fri, 4 Jun 2021 12:16:08 +0200 Subject: [PATCH] Update VV usage --- .../viabackwards/api/BackwardsProtocol.java | 9 +-- .../api/rewriters/EnchantmentRewriter.java | 4 +- .../api/rewriters/EntityRewriterBase.java | 2 +- .../api/rewriters/ItemRewriter.java | 18 +++--- .../api/rewriters/ItemRewriterBase.java | 21 ++----- .../rewriters/LegacyBlockItemRewriter.java | 12 ++-- .../Protocol1_10To1_11.java | 11 ++-- .../packets/BlockItemPackets1_11.java | 20 +++---- .../packets/EntityPackets1_11.java | 2 +- .../Protocol1_11_1To1_12.java | 13 +++-- .../packets/BlockItemPackets1_12.java | 23 ++++---- .../packets/EntityPackets1_12.java | 2 +- .../Protocol1_11To1_11_1.java | 9 ++- .../packets/ItemPackets1_11_1.java | 21 +++---- .../Protocol1_12_2To1_13.java | 13 +++-- .../data/ParticleMapping.java | 4 +- .../packets/BlockItemPackets1_13.java | 57 +++++++++---------- .../packets/EntityPackets1_13.java | 2 +- .../packets/PlayerPacket1_13.java | 8 +-- .../Protocol1_13_2To1_14.java | 9 +-- .../packets/BlockItemPackets1_14.java | 26 ++++----- .../packets/EntityPackets1_14.java | 2 +- .../Protocol1_13To1_13_1.java | 13 ++++- .../packets/EntityPackets1_13_1.java | 2 +- .../packets/InventoryPackets1_13_1.java | 40 ++++++------- .../Protocol1_14_2To1_14_3.java | 3 +- .../Protocol1_14_4To1_15.java | 9 +-- .../packets/BlockItemPackets1_15.java | 20 +++---- .../Protocol1_15_2To1_16.java | 10 ++-- .../packets/BlockItemPackets1_16.java | 28 +++++---- .../packets/EntityPackets1_16.java | 2 +- .../Protocol1_16_1To1_16_2.java | 9 +-- .../packets/BlockItemPackets1_16_2.java | 22 ++++--- .../Protocol1_16_4To1_17.java | 10 ++-- .../packets/BlockItemPackets1_17.java | 20 +++---- .../Protocol1_9_4To1_10.java | 13 +++-- .../packets/BlockItemPackets1_10.java | 13 ++--- .../packets/EntityPackets1_10.java | 2 +- 38 files changed, 239 insertions(+), 265 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/BackwardsProtocol.java b/common/src/main/java/com/viaversion/viabackwards/api/BackwardsProtocol.java index 17cd23e3..a957c9a0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/BackwardsProtocol.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/BackwardsProtocol.java @@ -18,7 +18,6 @@ package com.viaversion.viabackwards.api; import com.viaversion.viabackwards.api.data.BackwardsMappings; -import com.viaversion.viabackwards.api.rewriters.ItemRewriterBase; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.protocol.AbstractProtocol; @@ -51,16 +50,12 @@ public abstract class BackwardsProtocol extends En filter().handler((event, meta) -> { MetaType type = meta.metaType(); if (itemType != null && type == itemType) { - protocol.getBlockItemPackets().handleItemToClient(meta.value()); + protocol.getItemRewriter().handleItemToClient(meta.value()); } else if (blockType != null && type == blockType) { int data = meta.value(); meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); 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 7541a978..8d30be3d 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 @@ -38,10 +38,10 @@ public abstract class ItemRewriter extends ItemRewr } @Override - public @Nullable Item handleItemToClient(Item item) { + public @Nullable Item handleItemToClient(@Nullable Item item) { if (item == null) return null; - CompoundTag display = item.getTag() != null ? item.getTag().get("display") : null; + CompoundTag display = item.tag() != null ? item.tag().get("display") : null; if (translatableRewriter != null && display != null) { // Handle name and lore components StringTag name = display.get("Name"); @@ -73,23 +73,23 @@ public abstract class ItemRewriter extends ItemRewr } } - MappedItem data = protocol.getMappingData().getMappedItem(item.getIdentifier()); + MappedItem data = protocol.getMappingData().getMappedItem(item.identifier()); if (data == null) { // Just rewrite the id return super.handleItemToClient(item); } - if (item.getTag() == null) { + if (item.tag() == null) { item.setTag(new CompoundTag()); } // Save original id, set remapped id - item.getTag().put(nbtTagName + "|id", new IntTag(item.getIdentifier())); + item.tag().put(nbtTagName + "|id", new IntTag(item.identifier())); item.setIdentifier(data.getId()); // Set custom name - only done if there is no original one if (display == null) { - item.getTag().put("display", display = new CompoundTag()); + item.tag().put("display", display = new CompoundTag()); } if (!display.contains("Name")) { display.put("Name", new StringTag(data.getJsonName())); @@ -99,12 +99,12 @@ public abstract class ItemRewriter extends ItemRewr } @Override - public @Nullable Item handleItemToServer(Item item) { + public @Nullable Item handleItemToServer(@Nullable Item item) { if (item == null) return null; super.handleItemToServer(item); - if (item.getTag() != null) { - IntTag originalId = item.getTag().remove(nbtTagName + "|id"); + if (item.tag() != null) { + IntTag originalId = item.tag().remove(nbtTagName + "|id"); if (originalId != null) { item.setIdentifier(originalId.asInt()); } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriterBase.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriterBase.java index 4009511b..545bc443 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriterBase.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/ItemRewriterBase.java @@ -19,14 +19,14 @@ package com.viaversion.viabackwards.api.rewriters; import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.rewriter.RewriterBase; 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.rewriter.ItemRewriter; import org.checkerframework.checker.nullness.qual.Nullable; -public abstract class ItemRewriterBase extends RewriterBase { +public abstract class ItemRewriterBase extends ItemRewriter { protected final String nbtTagName; protected final boolean jsonNameFormat; @@ -37,19 +37,10 @@ public abstract class ItemRewriterBase extends Rewr nbtTagName = "VB|" + protocol.getClass().getSimpleName(); } - public @Nullable Item handleItemToClient(Item item) { + public @Nullable Item handleItemToServer(@Nullable Item item) { if (item == null) return null; - if (protocol.getMappingData() != null && protocol.getMappingData().getItemMappings() != null) { - item.setIdentifier(protocol.getMappingData().getNewItemId(item.getIdentifier())); - } - return item; - } + super.handleItemToServer(item); - public @Nullable Item handleItemToServer(Item item) { - if (item == null) return null; - if (protocol.getMappingData() != null && protocol.getMappingData().getItemMappings() != null) { - item.setIdentifier(protocol.getMappingData().getOldItemId(item.getIdentifier())); - } restoreDisplayTag(item); return item; } @@ -81,9 +72,9 @@ public abstract class ItemRewriterBase extends Rewr } protected void restoreDisplayTag(Item item) { - if (item.getTag() == null) return; + if (item.tag() == null) return; - CompoundTag display = item.getTag().get("display"); + CompoundTag display = item.tag().get("display"); if (display != null) { // Remove custom name / restore original name if (display.remove(nbtTagName + "|customName") != null) { 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 4e55585d..58917ed5 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 @@ -92,16 +92,16 @@ public abstract class LegacyBlockItemRewriter exten } @Override - public @Nullable Item handleItemToClient(Item item) { + public @Nullable Item handleItemToClient(@Nullable Item item) { if (item == null) return null; - MappedLegacyBlockItem data = replacementData.get(item.getIdentifier()); + MappedLegacyBlockItem data = replacementData.get(item.identifier()); if (data == null) { // Just rewrite the id return super.handleItemToClient(item); } - short originalData = item.getData(); + short originalData = item.data(); item.setIdentifier(data.getId()); // Keep original data if mapped data is set to -1 if (data.getData() != -1) { @@ -110,13 +110,13 @@ public abstract class LegacyBlockItemRewriter exten // Set display name if (data.getName() != null) { - if (item.getTag() == null) { + if (item.tag() == null) { item.setTag(new CompoundTag()); } - CompoundTag display = item.getTag().get("display"); + CompoundTag display = item.tag().get("display"); if (display == null) { - item.getTag().put("display", display = new CompoundTag()); + item.tag().put("display", display = new CompoundTag()); } StringTag nameTag = display.get("Name"); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/Protocol1_10To1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/Protocol1_10To1_11.java index 258c7f43..5cb3be7d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/Protocol1_10To1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/Protocol1_10To1_11.java @@ -44,9 +44,9 @@ public class Protocol1_10To1_11 extends BackwardsProtocol Trading protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() { @@ -163,7 +161,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter= startNonExistingFormula && slotId < endNonExistingFormula) - return new Item(166, (byte) 1, (short) 0, getNamedTag("§4SLOT DISABLED")); + return new DataItem(166, (byte) 1, (short) 0, getNamedTag("§4SLOT DISABLED")); if (slotId == 1) return null; return current; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java index b32bccdd..60b5cdb9 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java @@ -99,7 +99,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter int objType = objectData & 4095; int data = objectData >> 12 & 15; - Block block = protocol.getBlockItemPackets().handleBlock(objType, data); + Block block = protocol.getItemRewriter().handleBlock(objType, data); if (block == null) return; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java index 3f422c03..ac755827 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/Protocol1_11_1To1_12.java @@ -40,7 +40,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; public class Protocol1_11_1To1_12 extends BackwardsProtocol { private final EntityPackets1_12 entityPackets = new EntityPackets1_12(this); - private BlockItemPackets1_12 blockItemPackets; + private final BlockItemPackets1_12 blockItemPackets = new BlockItemPackets1_12(this); public Protocol1_11_1To1_12() { super(ClientboundPackets1_12.class, ClientboundPackets1_9_3.class, ServerboundPackets1_12.class, ServerboundPackets1_9_3.class); @@ -48,8 +48,8 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol Trading protocol.registerClientbound(ClientboundPackets1_12.PLUGIN_MESSAGE, new PacketRemapper() { @@ -165,7 +162,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter> 12 & 15; - Block block = protocol.getBlockItemPackets().handleBlock(objType, data); + Block block = protocol.getItemRewriter().handleBlock(objType, data); if (block == null) { return; } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/Protocol1_11To1_11_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/Protocol1_11To1_11_1.java index 69b845e5..be99201e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/Protocol1_11To1_11_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11to1_11_1/Protocol1_11To1_11_1.java @@ -23,6 +23,7 @@ import com.viaversion.viabackwards.protocol.protocol1_11to1_11_1.packets.EntityP import com.viaversion.viabackwards.protocol.protocol1_11to1_11_1.packets.ItemPackets1_11_1; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.entities.Entity1_11Types; +import com.viaversion.viaversion.api.rewriter.ItemRewriter; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; @@ -31,6 +32,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.Client public class Protocol1_11To1_11_1 extends BackwardsProtocol { private final EntityPackets1_11_1 entityPackets = new EntityPackets1_11_1(this); + private final ItemRewriter itemRewriter = new ItemPackets1_11_1(this); public Protocol1_11To1_11_1() { super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class); @@ -39,7 +41,7 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol { @@ -42,11 +41,9 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter Trading protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() { @@ -80,8 +77,8 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter { @@ -98,11 +95,11 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter36) minecraft:item -> iconcrack rewrite(33), // (28->33) minecraft:item_slime -> slime 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 648f4c9d..a79856af 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 @@ -54,7 +54,6 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.SpawnEggRew import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.rewriter.ItemRewriter; import java.util.ArrayList; import java.util.HashMap; @@ -259,15 +258,13 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit } }); - ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer); - protocol.registerClientbound(ClientboundPackets1_13.WINDOW_ITEMS, new PacketRemapper() { @Override public void registerMap() { map(Type.UNSIGNED_BYTE); map(Type.FLAT_ITEM_ARRAY, Type.ITEM_ARRAY); - handler(itemRewriter.itemArrayHandler(Type.ITEM_ARRAY)); + handler(itemArrayHandler(Type.ITEM_ARRAY)); } }); @@ -278,7 +275,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit map(Type.SHORT); map(Type.FLAT_ITEM, Type.ITEM); - handler(itemRewriter.itemToClientHandler(Type.ITEM)); + handler(itemToClientHandler(Type.ITEM)); } }); @@ -458,7 +455,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit map(Type.VAR_INT); map(Type.FLAT_ITEM, Type.ITEM); - handler(itemRewriter.itemToClientHandler(Type.ITEM)); + handler(itemToClientHandler(Type.ITEM)); } }); @@ -486,7 +483,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit map(Type.SHORT); map(Type.ITEM, Type.FLAT_ITEM); - handler(itemRewriter.itemToServerHandler(Type.FLAT_ITEM)); + handler(itemToServerHandler(Type.FLAT_ITEM)); } }); @@ -500,7 +497,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit map(Type.VAR_INT); map(Type.ITEM, Type.FLAT_ITEM); - handler(itemRewriter.itemToServerHandler(Type.FLAT_ITEM)); + handler(itemToServerHandler(Type.FLAT_ITEM)); } }); } @@ -518,12 +515,12 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit if (item == null) return null; // Custom mappings/super call moved down - int originalId = item.getIdentifier(); + int originalId = item.identifier(); Integer rawId = null; boolean gotRawIdFromTag = false; - CompoundTag tag = item.getTag(); + CompoundTag tag = item.tag(); // Use tag to get original ID and data Tag originalIdTag; @@ -537,7 +534,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit super.handleItemToClient(item); // Handle one-way special case - if (item.getIdentifier() == -1) { + if (item.identifier() == -1) { if (originalId == 362) { // base/colorless shulker box rawId = 0xe50000; // purple shulker box } else { @@ -550,10 +547,10 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit } else { // Use the found custom mapping // Take the newly added tag if (tag == null) { - tag = item.getTag(); + tag = item.tag(); } - rawId = itemIdToRaw(item.getIdentifier(), item, tag); + rawId = itemIdToRaw(item.identifier(), item, tag); } } @@ -562,14 +559,14 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit // NBT changes if (tag != null) { - if (isDamageable(item.getIdentifier())) { + if (isDamageable(item.identifier())) { Tag damageTag = tag.remove("Damage"); if (!gotRawIdFromTag && damageTag instanceof IntTag) { item.setData((short) (int) damageTag.getValue()); } } - if (item.getIdentifier() == 358) { // map + if (item.identifier() == 358) { // map Tag mapTag = tag.remove("map"); if (!gotRawIdFromTag && mapTag instanceof IntTag) { item.setData((short) (int) mapTag.getValue()); @@ -757,21 +754,21 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit @Override public Item handleItemToServer(Item item) { if (item == null) return null; - CompoundTag tag = item.getTag(); + CompoundTag tag = item.tag(); // Save original id - int originalId = (item.getIdentifier() << 16 | item.getData() & 0xFFFF); + int originalId = (item.identifier() << 16 | item.data() & 0xFFFF); - int rawId = (item.getIdentifier() << 4 | item.getData() & 0xF); + int rawId = (item.identifier() << 4 | item.data() & 0xF); // NBT Additions - if (isDamageable(item.getIdentifier())) { + if (isDamageable(item.identifier())) { if (tag == null) item.setTag(tag = new CompoundTag()); - tag.put("Damage", new IntTag(item.getData())); + tag.put("Damage", new IntTag(item.data())); } - if (item.getIdentifier() == 358) { // map + if (item.identifier() == 358) { // map if (tag == null) item.setTag(tag = new CompoundTag()); - tag.put("map", new IntTag(item.getData())); + tag.put("map", new IntTag(item.data())); } // NBT Changes @@ -798,7 +795,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit rewriteCanPlaceToServer(tag, "CanDestroy"); // Handle SpawnEggs - if (item.getIdentifier() == 383) { + if (item.identifier() == 383) { CompoundTag entityTag = tag.get("EntityTag"); StringTag identifier; if (entityTag != null && (identifier = entityTag.get("id")) != null) { @@ -822,32 +819,32 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit } // Handle custom mappings - int identifier = item.getIdentifier(); + int identifier = item.identifier(); item.setIdentifier(rawId); super.handleItemToServer(item); // Mapped with original data, we can return here - if (item.getIdentifier() != rawId && item.getIdentifier() != -1) return item; + if (item.identifier() != rawId && item.identifier() != -1) return item; // Set to legacy id again item.setIdentifier(identifier); int newId = -1; if (!protocol.getMappingData().getItemMappings().inverse().containsKey(rawId)) { - if (!isDamageable(item.getIdentifier()) && item.getIdentifier() != 358) { // Map + if (!isDamageable(item.identifier()) && item.identifier() != 358) { // Map if (tag == null) item.setTag(tag = new CompoundTag()); tag.put(extraNbtTag, new IntTag(originalId)); // Data will be lost, saving original id } - if (item.getIdentifier() == 229) { // purple shulker box + if (item.identifier() == 229) { // purple shulker box newId = 362; // directly set the new id -> base/colorless shulker box - } else if (item.getIdentifier() == 31 && item.getData() == 0) { // Shrub was removed + } else if (item.identifier() == 31 && item.data() == 0) { // Shrub was removed rawId = 32 << 4; // Dead Bush } else if (protocol.getMappingData().getItemMappings().inverse().containsKey(rawId & ~0xF)) { rawId &= ~0xF; // Remove data } else { if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { - ViaBackwards.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier()); + ViaBackwards.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.identifier()); } rawId = 16; // Stone } @@ -961,7 +958,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit } private void invertShieldAndBannerId(Item item, CompoundTag tag) { - if (item.getIdentifier() != 442 && item.getIdentifier() != 425) return; + if (item.identifier() != 442 && item.identifier() != 425) return; Tag blockEntityTag = tag.get("BlockEntityTag"); if (!(blockEntityTag instanceof CompoundTag)) return; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java index 2fbfe4dd..d8a40574 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/EntityPackets1_13.java @@ -314,7 +314,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter { for (int i = 0; i < size; i++) { //Input Item Item input = wrapper.read(Type.FLAT_ITEM); - wrapper.write(Type.ITEM, protocol.getBlockItemPackets().handleItemToClient(input)); + wrapper.write(Type.ITEM, protocol.getItemRewriter().handleItemToClient(input)); //Output Item Item output = wrapper.read(Type.FLAT_ITEM); - wrapper.write(Type.ITEM, protocol.getBlockItemPackets().handleItemToClient(output)); + wrapper.write(Type.ITEM, protocol.getItemRewriter().handleItemToClient(output)); boolean secondItem = wrapper.passthrough(Type.BOOLEAN); //Has second item if (secondItem) { //Second Item Item second = wrapper.read(Type.FLAT_ITEM); - wrapper.write(Type.ITEM, protocol.getBlockItemPackets().handleItemToClient(second)); + wrapper.write(Type.ITEM, protocol.getItemRewriter().handleItemToClient(second)); } wrapper.passthrough(Type.BOOLEAN); //Trade disabled @@ -447,7 +447,7 @@ public class PlayerPacket1_13 extends RewriterBase { case "MC|BEdit": wrapper.setId(0x0B); Item book = wrapper.read(Type.ITEM); - wrapper.write(Type.FLAT_ITEM, protocol.getBlockItemPackets().handleItemToServer(book)); + wrapper.write(Type.FLAT_ITEM, protocol.getItemRewriter().handleItemToServer(book)); boolean signing = channel.equals("MC|BSign"); wrapper.write(Type.BOOLEAN, signing); break; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java index e2bee54c..51fa01ba 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java @@ -196,10 +196,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol Plugin Message protocol.registerClientbound(ClientboundPackets1_14.TRADE_LIST, ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() { @@ -269,7 +267,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit map(Type.VAR_INT); // 1 - Slot ID map(Type.FLAT_VAR_INT_ITEM); // 2 - Item - handler(itemRewriter.itemToClientHandler(Type.FLAT_VAR_INT_ITEM)); + handler(itemToClientHandler(Type.FLAT_VAR_INT_ITEM)); handler(new PacketHandler() { @Override @@ -284,7 +282,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit wrapper.passthrough(Type.VAR_INT); wrapper.read(Type.VAR_INT); Item item = wrapper.read(Type.FLAT_VAR_INT_ITEM); - int armorType = item == null || item.getIdentifier() == 0 ? 0 : item.getIdentifier() - 726; + int armorType = item == null || item.identifier() == 0 ? 0 : item.identifier() - 726; if (armorType < 0 || armorType > 3) { ViaBackwards.getPlatform().getLogger().warning("Received invalid horse armor: " + item); wrapper.cancel(); @@ -299,7 +297,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit } }); - RecipeRewriter recipeHandler = new RecipeRewriter1_13_2(protocol, this::handleItemToClient); + RecipeRewriter recipeHandler = new RecipeRewriter1_13_2(protocol); protocol.registerClientbound(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() { @Override public void registerMap() { @@ -347,8 +345,8 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit }); - itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); + registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); + registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); protocol.registerClientbound(ClientboundPackets1_14.BLOCK_BREAK_ANIMATION, new PacketRemapper() { @Override @@ -515,7 +513,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit } }); - itemRewriter.registerSpawnParticle(ClientboundPackets1_14.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.FLOAT); + registerSpawnParticle(ClientboundPackets1_14.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.FLOAT); protocol.registerClientbound(ClientboundPackets1_14.MAP_DATA, new PacketRemapper() { @Override @@ -549,7 +547,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit super.handleItemToClient(item); // Lore now uses JSON - CompoundTag tag = item.getTag(); + CompoundTag tag = item.tag(); CompoundTag display; if (tag != null && (display = tag.get("display")) != null) { ListTag lore = display.get("Lore"); @@ -577,7 +575,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit if (item == null) return null; // Lore now uses JSON - CompoundTag tag = item.getTag(); + CompoundTag tag = item.tag(); CompoundTag display; if (tag != null && (display = tag.get("display")) != null) { // Transform to json if no backup tag is found (else process that in the super method) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java index 816dbb60..5ec201bd 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java @@ -365,7 +365,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter { if (meta.metaType() == MetaType1_13.Slot) { - InventoryPackets1_13_1.toClient((Item) meta.getValue()); + protocol.getItemRewriter().handleItemToClient((Item) meta.getValue()); } else if (meta.metaType() == MetaType1_13.BlockID) { // Convert to new block id int data = (int) meta.getValue(); 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 19746c11..12ba4041 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 @@ -19,7 +19,6 @@ package com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets; import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1; 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.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; @@ -28,14 +27,17 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; import com.viaversion.viaversion.rewriter.ItemRewriter; -public class InventoryPackets1_13_1 { +public class InventoryPackets1_13_1 extends ItemRewriter { - public static void register(Protocol protocol) { - ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets1_13_1::toClient, InventoryPackets1_13_1::toServer); + public InventoryPackets1_13_1(Protocol1_13To1_13_1 protocol) { + super(protocol); + } - itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN); - itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_ITEM_ARRAY); - itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_ITEM); + @Override + public void registerPackets() { + registerSetCooldown(ClientboundPackets1_13.COOLDOWN); + registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_ITEM_ARRAY); + registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_ITEM); protocol.registerClientbound(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() { @Override @@ -51,16 +53,16 @@ public class InventoryPackets1_13_1 { for (int i = 0; i < size; i++) { //Input Item Item input = wrapper.passthrough(Type.FLAT_ITEM); - toClient(input); + handleItemToClient(input); //Output Item Item output = wrapper.passthrough(Type.FLAT_ITEM); - toClient(output); + handleItemToClient(output); boolean secondItem = wrapper.passthrough(Type.BOOLEAN); //Has second item if (secondItem) { //Second Item Item second = wrapper.passthrough(Type.FLAT_ITEM); - toClient(second); + handleItemToClient(second); } wrapper.passthrough(Type.BOOLEAN); //Trade disabled @@ -73,20 +75,10 @@ public class InventoryPackets1_13_1 { } }); - itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_ITEM); - itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM); - itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM); + registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_ITEM); + registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM); + registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM); - itemRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, Type.FLAT_ITEM, Type.FLOAT); - } - - public static void toClient(Item item) { - if (item == null) return; - item.setIdentifier(Protocol1_13To1_13_1.MAPPINGS.getNewItemId(item.getIdentifier())); - } - - public static void toServer(Item item) { - if (item == null) return; - item.setIdentifier(Protocol1_13To1_13_1.MAPPINGS.getOldItemId(item.getIdentifier())); + registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, Type.FLAT_ITEM, Type.FLOAT); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java index 043f8047..6339dc54 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java @@ -66,8 +66,7 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol { - }); + RecipeRewriter recipeHandler = new RecipeRewriter1_14(this); registerClientbound(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() { @Override public void registerMap() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java index 7772032e..24d1d2a0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java @@ -108,10 +108,6 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol { @@ -42,10 +41,9 @@ public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewrit @Override protected void registerPackets() { - ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer); BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14); - new RecipeRewriter1_14(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES); + new RecipeRewriter1_14(protocol).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES); protocol.registerServerbound(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() { @Override @@ -54,14 +52,14 @@ public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewrit } }); - itemRewriter.registerSetCooldown(ClientboundPackets1_15.COOLDOWN); - itemRewriter.registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY); - itemRewriter.registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerTradeList(ClientboundPackets1_15.TRADE_LIST, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); + registerSetCooldown(ClientboundPackets1_15.COOLDOWN); + registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY); + registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM); + registerTradeList(ClientboundPackets1_15.TRADE_LIST, Type.FLAT_VAR_INT_ITEM); + registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM); + registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); + registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); + registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); 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/Protocol1_15_2To1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java index 8513747f..cc21b0d1 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java @@ -46,7 +46,6 @@ import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.util.GsonUtil; -import org.checkerframework.checker.nullness.qual.Nullable; import java.util.UUID; @@ -207,10 +206,6 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol { filter().handler((event, meta) -> { MetaType type = meta.metaType(); if (type == MetaType1_14.Slot) { - meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue())); + meta.setValue(protocol.getItemRewriter().handleItemToClient((Item) meta.getValue())); } else if (type == MetaType1_14.BlockID) { meta.setValue(protocol.getMappingData().getNewBlockStateId((int) meta.getValue())); } else if (type == MetaType1_14.PARTICLE) { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java index 9851d6e2..4d4db68f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java @@ -140,10 +140,6 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol { @@ -48,17 +47,16 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr @Override protected void registerPackets() { - ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer); BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14); - new RecipeRewriter1_16(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES); + new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES); - itemRewriter.registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN); - itemRewriter.registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY); - itemRewriter.registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); + registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN); + registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY); + registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM); + registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM); + registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM); + registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); protocol.registerClientbound(ClientboundPackets1_16_2.UNLOCK_RECIPES, new PacketRemapper() { @Override @@ -151,10 +149,10 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001); - itemRewriter.registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE); + registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE); - itemRewriter.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); - itemRewriter.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); + registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); + registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM); protocol.registerServerbound(ServerboundPackets1_16.EDIT_BOOK, new PacketRemapper() { @Override public void registerMap() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java index 10b838f2..9479a651 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java @@ -231,11 +231,6 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol { @@ -41,13 +40,11 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter int objType = objectData & 4095; int data = objectData >> 12 & 15; - Block block = protocol.getBlockItemPackets().handleBlock(objType, data); + Block block = protocol.getItemRewriter().handleBlock(objType, data); if (block == null) return;