Restructure and simplify some stuff #1
|
@ -1,7 +1,7 @@
|
|||
package io.github.moehreag.mojmap_patcher;
|
||||
|
||||
import io.github.moehreag.mojmap_patcher.load.MojmapLoader;
|
||||
import io.github.moehreag.mojmap_patcher.parser.MojmapParser;
|
||||
import io.github.moehreag.mojmap_patcher.provider.MojmapProvider;
|
||||
import io.github.moehreag.mojmap_patcher.format.proguard.ProguardParser;
|
||||
|
||||
public class MojMapPatcher {
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class MojMapPatcher {
|
|||
} else {
|
||||
version = args[0];
|
||||
}
|
||||
MojmapLoader.get(version).map(MojmapParser::read).ifPresent(s -> {
|
||||
MojmapProvider.get(version).map(ProguardParser::read).ifPresent(s -> {
|
||||
//s.getClassFields().keySet().forEach(System.out::println);
|
||||
s.getClassFields().get("net.minecraft.client.Minecraft").forEach((s1, s2) -> System.out.println(s1 + " -> " + s2));
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.moehreag.mojmap_patcher.api;
|
||||
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Data;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.MappingData;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Field;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Method;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
|
@ -11,10 +11,10 @@ import java.util.Optional;
|
|||
|
||||
public class Mapper extends Remapper {
|
||||
|
||||
private Data data;
|
||||
private MappingData data;
|
||||
|
||||
public static Mapper load() {
|
||||
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
}
|
||||
|
||||
public String mapClass(String name) {
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.github.moehreag.mojmap_patcher.api.data;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public interface Data {
|
||||
public interface MappingData {
|
||||
|
||||
Map<String, String> getClasses();
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package io.github.moehreag.mojmap_patcher.data;
|
||||
package io.github.moehreag.mojmap_patcher.format.proguard;
|
||||
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Field;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.MappingData;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Method;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -8,7 +9,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class MojmapData implements io.github.moehreag.mojmap_patcher.api.data.Data {
|
||||
public class ProguardData implements MappingData {
|
||||
|
||||
private final Map<String, String> classes = new HashMap<>();
|
||||
private final Map<String, Map<Method, Method>> classMethods = new HashMap<>();
|
|
@ -1,18 +1,18 @@
|
|||
package io.github.moehreag.mojmap_patcher.parser;
|
||||
package io.github.moehreag.mojmap_patcher.format.proguard;
|
||||
|
||||
import io.github.moehreag.mojmap_patcher.Constants;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Field;
|
||||
import io.github.moehreag.mojmap_patcher.api.data.Method;
|
||||
import io.github.moehreag.mojmap_patcher.data.MojmapData;
|
||||
import io.github.moehreag.mojmap_patcher.format.proguard.ProguardData;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MojmapParser {
|
||||
public class ProguardParser {
|
||||
|
||||
public static MojmapData read(String mappings) {
|
||||
public static ProguardData read(String mappings) {
|
||||
String[] lines = mappings.split("\n");
|
||||
|
||||
MojmapData data = new MojmapData();
|
||||
ProguardData data = new ProguardData();
|
||||
String currentClass = null;
|
||||
for (String line : lines) {
|
||||
if (line.startsWith("#")) { // Filter out comments
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.moehreag.mojmap_patcher.load;
|
||||
package io.github.moehreag.mojmap_patcher.provider;
|
||||
|
||||
import com.google.gson.*;
|
||||
import io.github.moehreag.mojmap_patcher.Constants;
|
||||
|
@ -6,7 +6,7 @@ import io.github.moehreag.mojmap_patcher.HttpHelper;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MojmapLoader {
|
||||
public class MojmapProvider {
|
||||
|
||||
public static Optional<String> get(String gameVersion) {
|
||||
return HttpHelper.getJson(Constants.VERSION_MANIFEST).map(manifest -> {
|
Loading…
Reference in a new issue