mirror of
https://github.com/zaaarf/lillero-mapping-writer.git
synced 2024-11-14 05:29:22 +01:00
feat: SRGWriter
This commit is contained in:
parent
1d13d08565
commit
97f6819c9c
2 changed files with 44 additions and 1 deletions
43
src/main/java/ftbsc/lll/mapper/writer/impl/SRGWriter.java
Normal file
43
src/main/java/ftbsc/lll/mapper/writer/impl/SRGWriter.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package ftbsc.lll.mapper.writer.impl;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
|
import ftbsc.lll.mapper.IMapper;
|
||||||
|
import ftbsc.lll.mapper.tools.MappingUtils;
|
||||||
|
import ftbsc.lll.mapper.tools.data.FieldData;
|
||||||
|
import ftbsc.lll.mapper.tools.data.MethodData;
|
||||||
|
import ftbsc.lll.mapper.writer.IWriter;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(IWriter.class)
|
||||||
|
public class SRGWriter implements IWriter {
|
||||||
|
@Override
|
||||||
|
public String uniqueId() {
|
||||||
|
return "srg";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(IMapper mapper, PrintWriter writer) {
|
||||||
|
List<FieldData> fieldData = new ArrayList<>();
|
||||||
|
List<MethodData> methodData = new ArrayList<>();
|
||||||
|
|
||||||
|
//print classes and save rest for later
|
||||||
|
mapper.getRawMappings().forEach((name, data) -> {
|
||||||
|
writer.printf("CL: %s, %s\n", name, data.nameMapped);
|
||||||
|
fieldData.addAll(data.getFields().values());
|
||||||
|
methodData.addAll(data.getMethods().values());
|
||||||
|
});
|
||||||
|
|
||||||
|
//print fields
|
||||||
|
fieldData.forEach(data -> writer.printf("FD: %s/%s %s/%s\n",
|
||||||
|
data.parentClass.name, data.name, data.parentClass.nameMapped, data.nameMapped));
|
||||||
|
|
||||||
|
//print methods
|
||||||
|
methodData.forEach(data -> writer.printf("MD: %s/%s %s %s/%s %s\n",
|
||||||
|
data.parentClass.name, data.signature.name, data.signature.descriptor,
|
||||||
|
data.parentClass.nameMapped, data.nameMapped, MappingUtils.mapMethodDescriptor(
|
||||||
|
data.signature.descriptor, mapper, false)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,7 @@ public class TSRGWriter implements IWriter {
|
||||||
public void write(IMapper mapper, PrintWriter writer) {
|
public void write(IMapper mapper, PrintWriter writer) {
|
||||||
writer.println("tsrg2 left right");
|
writer.println("tsrg2 left right");
|
||||||
mapper.getRawMappings().forEach((name, data) -> {
|
mapper.getRawMappings().forEach((name, data) -> {
|
||||||
writer.printf("%s %s\n", data.name, data.nameMapped);
|
writer.printf("%s %s\n", name, data.nameMapped);
|
||||||
data.getFields().forEach((fieldName, fieldData) ->
|
data.getFields().forEach((fieldName, fieldData) ->
|
||||||
writer.printf("\t%s %s\n", fieldName, fieldData.nameMapped));
|
writer.printf("\t%s %s\n", fieldName, fieldData.nameMapped));
|
||||||
data.getMethods().forEach(((methodSignature, methodData) ->
|
data.getMethods().forEach(((methodSignature, methodData) ->
|
||||||
|
|
Loading…
Reference in a new issue