From b7b8bdc8418feb4f4be8a1fc05965b051c9779be Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 11 Dec 2019 12:07:22 +0100 Subject: [PATCH] Ignore unneeded sound warnings --- .../protocol1_14to1_13_2/data/MappingData.java | 14 +++++++++++--- .../protocol1_15to1_14_4/data/MappingData.java | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/data/MappingData.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/data/MappingData.java index 63811fc01..256074bee 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/data/MappingData.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/data/MappingData.java @@ -110,11 +110,15 @@ public class MappingData { } private static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers) { + mapIdentifiers(output, oldIdentifiers, newIdentifiers, true); + } + + private static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers, boolean warnOnMissing) { for (int i = 0; i < oldIdentifiers.size(); i++) { JsonElement v = oldIdentifiers.get(i); Integer index = findIndex(newIdentifiers, v.getAsString()); if (index == null) { - if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { + if (warnOnMissing && !Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) { Via.getPlatform().getLogger().warning("No key for " + v + " :( "); } continue; @@ -150,10 +154,14 @@ public class MappingData { public static class SoundMappingShortArray implements SoundMappings { private short[] oldToNew; - public SoundMappingShortArray(JsonArray mapping1_13_2, JsonArray mapping1_14) { + public SoundMappingShortArray(JsonArray mapping1_13_2, JsonArray mapping1_14, boolean warnOnMissing) { oldToNew = new short[mapping1_13_2.size()]; Arrays.fill(oldToNew, (short) -1); - mapIdentifiers(oldToNew, mapping1_13_2, mapping1_14); + mapIdentifiers(oldToNew, mapping1_13_2, mapping1_14, warnOnMissing); + } + + public SoundMappingShortArray(JsonArray mapping1_13_2, JsonArray mapping1_14) { + this(mapping1_13_2, mapping1_14, true); } @Override diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/data/MappingData.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/data/MappingData.java index 11d539a84..af9ec6dcd 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/data/MappingData.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/data/MappingData.java @@ -22,6 +22,7 @@ public class MappingData { Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 item mapping..."); us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData.mapIdentifiers(oldToNewItems, mapping1_14_4.getAsJsonObject("items"), mapping1_15.getAsJsonObject("items")); Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 sound mapping..."); - soundMappings = new us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData.SoundMappingShortArray(mapping1_14_4.getAsJsonArray("sounds"), mapping1_15.getAsJsonArray("sounds")); + // A few removed sounds we can simply ignore + soundMappings = new us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData.SoundMappingShortArray(mapping1_14_4.getAsJsonArray("sounds"), mapping1_15.getAsJsonArray("sounds"), false); } }