3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 16:40:12 +01:00

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

Dieser Commit ist enthalten in:
Matsv 2017-07-30 12:17:20 +02:00
Ursprung 1f15c9e8f1
Commit 908931e174
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 97CEC2A2EA31350F
4 geänderte Dateien mit 5 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,6 @@ import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata; 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.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type; 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 -> { protocol.getEntityPackets().registerMetaHandler().handle(e -> {
Metadata data = e.getData(); 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())); data.setValue(handleItemToClient((Item) data.getValue()));
return data; return data;

Datei anzeigen

@ -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.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata; 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.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type; 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 -> { protocol.getEntityPackets().registerMetaHandler().handle(e -> {
Metadata data = e.getData(); 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())); data.setValue(handleItemToClient((Item) data.getValue()));
return data; return data;

Datei anzeigen

@ -17,7 +17,6 @@ import nl.matsv.viabackwards.utils.Block;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata; 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.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type; 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 -> { protocol.getEntityPackets().registerMetaHandler().handle(e -> {
Metadata data = e.getData(); 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())); data.setValue(handleItemToClient((Item) data.getValue()));
return data; return data;

Datei anzeigen

@ -16,7 +16,6 @@ import nl.matsv.viabackwards.utils.Block;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata; 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.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type; 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 -> { protocol.getEntityPackets().registerMetaHandler().handle(e -> {
Metadata data = e.getData(); 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())); data.setValue(handleItemToClient((Item) data.getValue()));
return data; return data;