mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-23 21:40:02 -04:00
add better registry error logging
This commit is contained in:
parent
74fd9e78fc
commit
b7a08af919
1 changed files with 35 additions and 7 deletions
|
@ -94,16 +94,44 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
switch (mode) {
|
||||
case AUTHORITATIVE:
|
||||
break;
|
||||
case REMOTE:
|
||||
if (!registry.getIds().containsAll(remoteIndexedEntries.keySet())) {
|
||||
throw new RemapException("Received ID map contains IDs unknown to the receiver!");
|
||||
case REMOTE: {
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (Identifier remoteId : remoteIndexedEntries.keySet()) {
|
||||
if (!registry.getIds().contains(remoteId)) {
|
||||
strings.add(" - " + remoteId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EXACT:
|
||||
|
||||
if (!strings.isEmpty()) {
|
||||
StringBuilder builder = new StringBuilder("Received ID map contains IDs unknown to the receiver!");
|
||||
for (String s : strings) {
|
||||
builder.append('\n').append(s);
|
||||
}
|
||||
throw new RemapException(builder.toString());
|
||||
}
|
||||
} break;
|
||||
case EXACT: {
|
||||
if (!registry.getIds().equals(remoteIndexedEntries.keySet())) {
|
||||
throw new RemapException("Local and remote ID sets do not match!");
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (Identifier remoteId : remoteIndexedEntries.keySet()) {
|
||||
if (!registry.getIds().contains(remoteId)) {
|
||||
strings.add(" - " + remoteId + " (missing on local)");
|
||||
}
|
||||
}
|
||||
|
||||
for (Identifier localId : registry.getIds()) {
|
||||
if (!remoteIndexedEntries.keySet().contains(localId)) {
|
||||
strings.add(" - " + localId + " (missing on remote)");
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder("Local and remote ID sets do not match!");
|
||||
for (String s : strings) {
|
||||
builder.append('\n').append(s);
|
||||
}
|
||||
throw new RemapException(builder.toString());
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
|
||||
// Make a copy of the previous maps.
|
||||
|
|
Loading…
Add table
Reference in a new issue