Fix 1.11 entity id rewriting not applying to dropped items

This commit is contained in:
Myles 2017-06-24 15:40:09 +01:00
parent 10688a7067
commit f599583856

View File

@ -5,6 +5,7 @@ import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_11Types.EntityType; import us.myles.ViaVersion.api.entities.Entity1_11Types.EntityType;
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.minecraft.metadata.types.MetaType1_9;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
@ -99,6 +100,10 @@ public class MetadataRewriter {
public static void handleMetadata(int entityId, EntityType type, List<Metadata> metadatas, UserConnection connection) { public static void handleMetadata(int entityId, EntityType type, List<Metadata> metadatas, UserConnection connection) {
for (Metadata metadata : new ArrayList<>(metadatas)) { for (Metadata metadata : new ArrayList<>(metadatas)) {
try { try {
if(metadata.getValue() instanceof Item) {
// Apply rewrite
EntityIdRewriter.toClientItem((Item) metadata.getValue());
}
if (type.is(EntityType.ELDER_GUARDIAN) || type.is(EntityType.GUARDIAN)) { // Guardians if (type.is(EntityType.ELDER_GUARDIAN) || type.is(EntityType.GUARDIAN)) { // Guardians
int oldid = metadata.getId(); int oldid = metadata.getId();
if (oldid == 12) { if (oldid == 12) {