3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-07 16:50:14 +01:00

Merge pull request #1569 from KennyTV/master

Ignore unneeded sound warnings
Dieser Commit ist enthalten in:
Myles 2019-12-11 11:10:01 +00:00 committet von GitHub
Commit 07d219c77b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -110,11 +110,15 @@ public class MappingData {
} }
private static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers) { 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++) { for (int i = 0; i < oldIdentifiers.size(); i++) {
JsonElement v = oldIdentifiers.get(i); JsonElement v = oldIdentifiers.get(i);
Integer index = findIndex(newIdentifiers, v.getAsString()); Integer index = findIndex(newIdentifiers, v.getAsString());
if (index == null) { 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 + " :( "); Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
} }
continue; continue;
@ -150,10 +154,14 @@ public class MappingData {
public static class SoundMappingShortArray implements SoundMappings { public static class SoundMappingShortArray implements SoundMappings {
private short[] oldToNew; 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()]; oldToNew = new short[mapping1_13_2.size()];
Arrays.fill(oldToNew, (short) -1); 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 @Override

Datei anzeigen

@ -22,6 +22,7 @@ public class MappingData {
Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 item mapping..."); 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")); 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..."); 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);
} }
} }