mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-27 19:02:56 +00:00
[Fabric] Write all descriptors which were remapped, regardless of whether or not they are actually different
This commit is contained in:
1 parent
125d5e9847
commit
bb5a3c6900
4 files changed
+18
-11
No files matched your search
@@ -220,9 +220,6 @@ public final class ReferenceMapper implements IReferenceMapper, Serializable {
|
||||
return null;
|
||||
}
|
||||
String conformedReference = reference.replaceAll("\\s", "");
|
||||
if (conformedReference.equals(newReference)) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Map<String, String>> mappings = this.mappings;
|
||||
if (context != null) {
|
||||
mappings = this.data.get(context);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.spongepowered.asm.util;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Utility methods for obfuscation tasks
|
||||
*/
|
||||
@@ -79,12 +81,18 @@ public abstract class ObfuscationUtil {
|
||||
private static String remapDescriptor(String desc, IClassRemapper remapper, boolean unmap) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder token = null;
|
||||
boolean remapped = false;
|
||||
|
||||
for (int pos = 0; pos < desc.length(); pos++) {
|
||||
char c = desc.charAt(pos);
|
||||
if (token != null) {
|
||||
if (c == ';') {
|
||||
sb.append('L').append(ObfuscationUtil.remap(token.toString(), remapper, unmap)).append(';');
|
||||
String tokenStr = token.toString();
|
||||
Optional<String> remappedStr = ObfuscationUtil.remap(tokenStr, remapper, unmap);
|
||||
if (remappedStr.isPresent()) {
|
||||
remapped = true;
|
||||
}
|
||||
sb.append('L').append(remappedStr.orElse(tokenStr)).append(';');
|
||||
token = null;
|
||||
} else {
|
||||
token.append(c);
|
||||
@@ -102,12 +110,12 @@ public abstract class ObfuscationUtil {
|
||||
throw new IllegalArgumentException("Invalid descriptor '" + desc + "', missing ';'");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
return remapped ? sb.toString() : null;
|
||||
}
|
||||
|
||||
private static Object remap(String typeName, IClassRemapper remapper, boolean unmap) {
|
||||
private static Optional<String> remap(String typeName, IClassRemapper remapper, boolean unmap) {
|
||||
String result = unmap ? remapper.unmap(typeName) : remapper.map(typeName);
|
||||
return result != null ? result : typeName;
|
||||
return Optional.ofNullable(result);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user