Make metadata item rewrite check the Type instead of the MetaType fixes #17

This commit is contained in:
Matsv 2017-07-30 12:17:20 +02:00
parent 1f15c9e8f1
commit 908931e174
No known key found for this signature in database
GPG Key ID: 97CEC2A2EA31350F
4 changed files with 5 additions and 9 deletions

View File

@ -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<Protocol1_10To1_11>
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;

View File

@ -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<Protocol1_11To1_11_1> {
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;

View File

@ -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<Protocol1_11_1To1_12
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
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;

View File

@ -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<Protocol1_9_4To1_10>
}
);
// 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;