3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 22:02:50 +02:00

Warn with unmapped id when missing

Dieser Commit ist enthalten in:
KennyTV 2020-09-04 10:31:16 +02:00 committet von Nassim
Ursprung a709382d25
Commit b7bf993795
2 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -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;
}
/**

Datei anzeigen

@ -465,7 +465,6 @@ public abstract class Protocol<C1 extends ClientboundPacketType, C2 extends Clie
@Nullable
public MappingData getMappingData() {
//TODO Fully hold the instance here and get rid of all static usages (at some point:tm:)
return null; // Let the protocols hold the mappings to still have easy, static singleton access there
}