summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/ftbsc/lll/mapper/impl/TinyV2Mapper.java2
-rw-r--r--src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java10
-rw-r--r--src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java24
3 files changed, 34 insertions, 2 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/impl/TinyV2Mapper.java b/src/main/java/ftbsc/lll/mapper/impl/TinyV2Mapper.java
index d27756d..b7b58a1 100644
--- a/src/main/java/ftbsc/lll/mapper/impl/TinyV2Mapper.java
+++ b/src/main/java/ftbsc/lll/mapper/impl/TinyV2Mapper.java
@@ -53,7 +53,7 @@ public class TinyV2Mapper extends AbstractMapper {
case 'f': //fields
if(tokens.length == 4)
break;
- this.mappings.get(currentClass).addField(tokens[2], tokens[3]);
+ this.mappings.get(currentClass).addField(tokens[2], tokens[3], tokens[1]);
continue;
}
break;
diff --git a/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java b/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java
index cdcec4d..4bd0af0 100644
--- a/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java
+++ b/src/main/java/ftbsc/lll/mapper/tools/data/ClassData.java
@@ -69,6 +69,16 @@ public class ClassData {
}
/**
+ * Adds a field to the target class.
+ * @param plain the name of the field
+ * @param mapped the mapped name of the field
+ * @param descriptor the plain type descriptor of the field
+ */
+ public void addField(String plain, String mapped, String descriptor) {
+ this.fields.put(plain, new FieldData(this, plain, mapped, descriptor));
+ }
+
+ /**
* Generates the reverse mappings for this class.
* Should always be called only after the given mapper has finished
* processing all classes.
diff --git a/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java b/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java
index bcc3985..e239d66 100644
--- a/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java
+++ b/src/main/java/ftbsc/lll/mapper/tools/data/FieldData.java
@@ -21,7 +21,14 @@ public class FieldData {
public final String nameMapped;
/**
- * Constructs a new {@link FieldData}.
+ * The field's type descriptor.
+ * Some formats may not specify it; if this was created in one such format,
+ * this is going to be null.
+ */
+ public final String descriptor;
+
+ /**
+ * Constructs a new {@link FieldData} with unspecified descriptor.
* @param parentClass the {@link ClassData} representation of the parent class
* @param name the field name
* @param nameMapped the mapped field name
@@ -30,5 +37,20 @@ public class FieldData {
this.parentClass = parentClass;
this.name = name;
this.nameMapped = nameMapped;
+ this.descriptor = null;
+ }
+
+ /**
+ * Constructs a new {@link FieldData} with descriptor.
+ * @param parentClass the {@link ClassData} representation of the parent class
+ * @param name the field name
+ * @param nameMapped the mapped field name
+ * @param descriptor the field's type descriptor
+ */
+ public FieldData(ClassData parentClass, String name, String nameMapped, String descriptor) {
+ this.parentClass = parentClass;
+ this.name = name;
+ this.nameMapped = nameMapped;
+ this.descriptor = descriptor;
}
}