mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-05 18:20:17 +01:00
Warn with unmapped id when missing
This commit is contained in:
parent
a709382d25
commit
b7bf993795
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user