summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/mapper/tools
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-08-26 23:20:06 +0200
committer zaaarf <zaaarf@proton.me>2023-08-26 23:20:06 +0200
commit6ec42321a36bb44f71ca27a52c774a8dee21ef08 (patch)
tree88a10ae36e82be9b75e865026c4bdb8d9440f7d7 /src/main/java/ftbsc/lll/mapper/tools
parent27ff8340f3435459ee21babaceef22f59b7a84f6 (diff)
feat: heavily reworked api to provide data instead of names
Diffstat (limited to 'src/main/java/ftbsc/lll/mapper/tools')
-rw-r--r--src/main/java/ftbsc/lll/mapper/tools/MappingUtils.java10
-rw-r--r--src/main/java/ftbsc/lll/mapper/tools/data/MethodData.java2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/tools/MappingUtils.java b/src/main/java/ftbsc/lll/mapper/tools/MappingUtils.java
index c8d76af..fcc5525 100644
--- a/src/main/java/ftbsc/lll/mapper/tools/MappingUtils.java
+++ b/src/main/java/ftbsc/lll/mapper/tools/MappingUtils.java
@@ -15,7 +15,7 @@ public class MappingUtils {
* Maps a method descriptor, replacing its class references with their mapped counterparts.
* @param descriptor a {@link String} containing the descriptor
* @param mapper the {@link IMapper} to use for the process
- * @param reverse whether it should deobfuscate rather than obfuscate
+ * @param reverse if true it uses the inverted mapper rather than the normal one
* @return the mapped descriptor
*/
public static String mapMethodDescriptor(String descriptor, IMapper mapper, boolean reverse) {
@@ -34,8 +34,8 @@ public class MappingUtils {
* Given a {@link Type} and a valid {@link IMapper} it returns its mapped counterpart.
* @param type the type in question
* @param mapper the {@link IMapper} to use for the process
- * @param reverse whether it should deobfuscate rather than obfuscate
- * @return the obfuscated type
+ * @param reverse if true it uses the inverted mapper rather than the normal one
+ * @return the mapped type
*/
public static Type mapType(Type type, IMapper mapper, boolean reverse) {
//unwrap arrays
@@ -55,8 +55,8 @@ public class MappingUtils {
String internalNameMapped;
try {
internalNameMapped = reverse
- ? mapper.deobfuscateClass(internalName)
- : mapper.obfuscateClass(internalName);
+ ? mapper.getInverted().getClassData(internalName).nameMapped
+ : mapper.getClassData(internalName).nameMapped;
return Type.getType(DescriptorBuilder.nameToDescriptor(internalNameMapped, arrayLevel));
} catch(MappingNotFoundException e) {
return type;
diff --git a/src/main/java/ftbsc/lll/mapper/tools/data/MethodData.java b/src/main/java/ftbsc/lll/mapper/tools/data/MethodData.java
index 27c418c..699b0b0 100644
--- a/src/main/java/ftbsc/lll/mapper/tools/data/MethodData.java
+++ b/src/main/java/ftbsc/lll/mapper/tools/data/MethodData.java
@@ -18,7 +18,7 @@ public class MethodData {
/**
* The mapped name of the method.
*/
- final String nameMapped;
+ public final String nameMapped;
/**
* Constructs a new {@link MethodData}.