From b7bf9937950728eac0da55d00fe74e318d5c37e7 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Fri, 4 Sep 2020 10:31:16 +0200 Subject: [PATCH] Warn with unmapped id when missing --- .../us/myles/ViaVersion/api/data/MappingData.java | 13 +++++++------ .../us/myles/ViaVersion/api/protocol/Protocol.java | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/data/MappingData.java b/common/src/main/java/us/myles/ViaVersion/api/data/MappingData.java index 5b4538874..eef1e6c3e 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/data/MappingData.java +++ b/common/src/main/java/us/myles/ViaVersion/api/data/MappingData.java @@ -47,19 +47,20 @@ public class MappingData { } public int getNewBlockStateId(int id) { - return checkValidity(blockStateMappings.getNewId(id), "blockstate"); + return checkValidity(id, blockStateMappings.getNewId(id), "blockstate"); } public int getNewBlockId(int id) { - return checkValidity(blockMappings.getNewId(id), "block"); + return checkValidity(id, blockMappings.getNewId(id), "block"); } public int getNewItemId(int id) { - return checkValidity(itemMappings.get(id), "item"); + return checkValidity(id, itemMappings.get(id), "item"); } public int getOldItemId(int id) { int oldId = itemMappings.inverse().get(id); + // Remap new items to stone return oldId != -1 ? oldId : 1; } @@ -108,12 +109,12 @@ public class MappingData { return MappingDataLoader.loadData("mappingdiff-" + oldVersion + "to" + newVersion + ".json"); } - protected int checkValidity(int id, String type) { - if (id == -1) { + protected int checkValidity(int id, int mappedId, String type) { + if (mappedId == -1) { Via.getPlatform().getLogger().warning(String.format("Missing %s %s for %s %s %d", newVersion, type, oldVersion, type, id)); return 0; } - return id; + return mappedId; } /** diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java index f6d8d60e3..e833e3cf6 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/Protocol.java @@ -465,7 +465,6 @@ public abstract class Protocol