fabric-registry-sync: show name of affected registry

This commit is contained in:
asie 2019-04-29 08:04:38 +02:00
parent 6ae80abc2e
commit 1622eb70d6
3 changed files with 9 additions and 9 deletions
fabric-registry-sync/src/main/java/net/fabricmc/fabric

View file

@ -119,7 +119,7 @@ public final class RegistrySyncManager {
for (String key : registryTag.getKeys()) {
idMap.put(new Identifier(key), registryTag.getInt(key));
}
((RemappableRegistry) registry).remap(idMap, mode);
((RemappableRegistry) registry).remap(registryId.toString(), idMap, mode);
}
}
}
@ -128,7 +128,7 @@ public final class RegistrySyncManager {
for (Identifier registryId : Registry.REGISTRIES.getIds()) {
MutableRegistry registry = Registry.REGISTRIES.get(registryId);
if (registry instanceof RemappableRegistry) {
((RemappableRegistry) registry).unmap();
((RemappableRegistry) registry).unmap(registryId.toString());
}
}
}

View file

@ -42,7 +42,7 @@ public interface RemappableRegistry {
EXACT
}
void remap(Object2IntMap<Identifier> remoteIndexedEntries, RemapMode mode) throws RemapException;
void remap(String name, Object2IntMap<Identifier> remoteIndexedEntries, RemapMode mode) throws RemapException;
void unmap() throws RemapException;
void unmap(String name) throws RemapException;
}

View file

@ -86,7 +86,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
}
@Override
public void remap(Object2IntMap<Identifier> remoteIndexedEntries, RemapMode mode) throws RemapException {
public void remap(String name, Object2IntMap<Identifier> remoteIndexedEntries, RemapMode mode) throws RemapException {
//noinspection unchecked, ConstantConditions
SimpleRegistry<Object> registry = (SimpleRegistry<Object>) (Object) this;
@ -103,7 +103,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
}
if (!strings.isEmpty()) {
StringBuilder builder = new StringBuilder("Received ID map contains IDs unknown to the receiver!");
StringBuilder builder = new StringBuilder("Received ID map for " + name + " contains IDs unknown to the receiver!");
for (String s : strings) {
builder.append('\n').append(s);
}
@ -125,7 +125,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
}
}
StringBuilder builder = new StringBuilder("Local and remote ID sets do not match!");
StringBuilder builder = new StringBuilder("Local and remote ID sets for " + name + " do not match!");
for (String s : strings) {
builder.append('\n').append(s);
}
@ -227,12 +227,12 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
}
@Override
public void unmap() throws RemapException {
public void unmap(String name) throws RemapException {
if (fabric_prevIndexedEntries != null) {
entries.clear();
entries.putAll(fabric_prevEntries);
remap(fabric_prevIndexedEntries, RemapMode.AUTHORITATIVE);
remap(name, fabric_prevIndexedEntries, RemapMode.AUTHORITATIVE);
fabric_prevIndexedEntries = null;
fabric_prevEntries = null;