Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Warn with unmapped id when missing
Dieser Commit ist enthalten in:
Ursprung
a709382d25
Commit
b7bf993795
@ -47,19 +47,20 @@ public class MappingData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNewBlockStateId(int id) {
|
public int getNewBlockStateId(int id) {
|
||||||
return checkValidity(blockStateMappings.getNewId(id), "blockstate");
|
return checkValidity(id, blockStateMappings.getNewId(id), "blockstate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNewBlockId(int id) {
|
public int getNewBlockId(int id) {
|
||||||
return checkValidity(blockMappings.getNewId(id), "block");
|
return checkValidity(id, blockMappings.getNewId(id), "block");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNewItemId(int id) {
|
public int getNewItemId(int id) {
|
||||||
return checkValidity(itemMappings.get(id), "item");
|
return checkValidity(id, itemMappings.get(id), "item");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOldItemId(int id) {
|
public int getOldItemId(int id) {
|
||||||
int oldId = itemMappings.inverse().get(id);
|
int oldId = itemMappings.inverse().get(id);
|
||||||
|
// Remap new items to stone
|
||||||
return oldId != -1 ? oldId : 1;
|
return oldId != -1 ? oldId : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,12 +109,12 @@ public class MappingData {
|
|||||||
return MappingDataLoader.loadData("mappingdiff-" + oldVersion + "to" + newVersion + ".json");
|
return MappingDataLoader.loadData("mappingdiff-" + oldVersion + "to" + newVersion + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int checkValidity(int id, String type) {
|
protected int checkValidity(int id, int mappedId, String type) {
|
||||||
if (id == -1) {
|
if (mappedId == -1) {
|
||||||
Via.getPlatform().getLogger().warning(String.format("Missing %s %s for %s %s %d", newVersion, type, oldVersion, type, id));
|
Via.getPlatform().getLogger().warning(String.format("Missing %s %s for %s %s %d", newVersion, type, oldVersion, type, id));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return id;
|
return mappedId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,7 +465,6 @@ public abstract class Protocol<C1 extends ClientboundPacketType, C2 extends Clie
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public MappingData getMappingData() {
|
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
|
return null; // Let the protocols hold the mappings to still have easy, static singleton access there
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren