From 908931e17479e632ae3fd35a5d875b43164630e6 Mon Sep 17 00:00:00 2001 From: Matsv Date: Sun, 30 Jul 2017 12:17:20 +0200 Subject: [PATCH] Make metadata item rewrite check the Type instead of the MetaType fixes #17 --- .../protocol1_10to1_11/packets/BlockItemPackets1_11.java | 3 +-- .../protocol1_11to1_11_1/packets/ItemPackets1_11_1.java | 3 +-- .../protocol1_12to1_11_1/packets/BlockItemPackets1_12.java | 3 +-- .../protocol1_9_4to1_10/packets/BlockItemPackets1_10.java | 5 ++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets1_11.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets1_11.java index ec166b7d..80509d0a 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets1_11.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets1_11.java @@ -24,7 +24,6 @@ import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; -import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; @@ -381,7 +380,7 @@ public class BlockItemPackets1_11 extends BlockItemRewriter protocol.getEntityPackets().registerMetaHandler().handle(e -> { Metadata data = e.getData(); - if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item + if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item data.setValue(handleItemToClient((Item) data.getValue())); return data; diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java index 9bef1f9b..fc432638 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_11to1_11_1/packets/ItemPackets1_11_1.java @@ -15,7 +15,6 @@ import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; -import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; @@ -154,7 +153,7 @@ public class ItemPackets1_11_1 extends BlockItemRewriter { protocol.getEntityPackets().registerMetaHandler().handle(e -> { Metadata data = e.getData(); - if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item + if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item data.setValue(handleItemToClient((Item) data.getValue())); return data; diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_11_1/packets/BlockItemPackets1_12.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_11_1/packets/BlockItemPackets1_12.java index d22af6a7..bd60e6fd 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_11_1/packets/BlockItemPackets1_12.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_11_1/packets/BlockItemPackets1_12.java @@ -17,7 +17,6 @@ import nl.matsv.viabackwards.utils.Block; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; -import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_12; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; @@ -246,7 +245,7 @@ public class BlockItemPackets1_12 extends BlockItemRewriter { Metadata data = e.getData(); - if (data.getMetaType().equals(MetaType1_12.Slot)) // Is Item + if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item data.setValue(handleItemToClient((Item) data.getValue())); return data; diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/packets/BlockItemPackets1_10.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/packets/BlockItemPackets1_10.java index 5632f056..c610ca6c 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/packets/BlockItemPackets1_10.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/packets/BlockItemPackets1_10.java @@ -16,7 +16,6 @@ import nl.matsv.viabackwards.utils.Block; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; -import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; @@ -219,11 +218,11 @@ public class BlockItemPackets1_10 extends BlockItemRewriter } ); - + // Rewrite metadata items protocol.getEntityPackets().registerMetaHandler().handle(e -> { Metadata data = e.getData(); - if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item + if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item data.setValue(handleItemToClient((Item) data.getValue())); return data;