migrate to correct package (for now)

This commit is contained in:
moehreag 2024-05-13 11:47:46 +02:00
parent aa187beaba
commit 70117f8873
9 changed files with 42 additions and 50 deletions

View file

@ -1,6 +1,7 @@
plugins {
id("java")
id("io.freefair.lombok").version("8.6+")
`maven-publish`
}
group = "org.ecorous.esnesnon"
@ -19,3 +20,12 @@ dependencies {
// Annotation Processor
annotationProcessor("org.ow2.asm:asm-tree:9.7")
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}

View file

@ -1,10 +1,8 @@
package io.github.moehreag.mojmap_patcher;
package org.ecorous.esnesnon.mojmap_patcher;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.regex.Pattern;
public final class Constants {
public static final String VERSION_MANIFEST = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json";
public static final Gson GSON = new GsonBuilder().create();

View file

@ -1,4 +1,4 @@
package io.github.moehreag.mojmap_patcher;
package org.ecorous.esnesnon.mojmap_patcher;
import com.google.gson.JsonObject;
import lombok.experimental.UtilityClass;
@ -8,13 +8,11 @@ import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import static io.github.moehreag.mojmap_patcher.Constants.GSON;
import static org.ecorous.esnesnon.mojmap_patcher.Constants.GSON;
@UtilityClass
public class HttpHelper {

View file

@ -1,9 +1,9 @@
package io.github.moehreag.mojmap_patcher;
package org.ecorous.esnesnon.mojmap_patcher;
import io.github.moehreag.mojmap_patcher.api.Mapper;
import io.github.moehreag.mojmap_patcher.api.data.MappingData;
import io.github.moehreag.mojmap_patcher.provider.MojmapProvider;
import io.github.moehreag.mojmap_patcher.parser.ProguardParser;
import org.ecorous.esnesnon.mojmap_patcher.api.Mapper;
import org.ecorous.esnesnon.mojmap_patcher.api.data.MappingData;
import org.ecorous.esnesnon.mojmap_patcher.provider.MojmapProvider;
import org.ecorous.esnesnon.mojmap_patcher.parser.ProguardParser;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.commons.ClassRemapper;

View file

@ -1,16 +1,12 @@
package io.github.moehreag.mojmap_patcher.api;
package org.ecorous.esnesnon.mojmap_patcher.api;
import io.github.moehreag.mojmap_patcher.api.data.MappingData;
import io.github.moehreag.mojmap_patcher.api.data.Member;
import org.ecorous.esnesnon.mojmap_patcher.api.data.MappingData;
import org.ecorous.esnesnon.mojmap_patcher.api.data.Member;
import org.objectweb.asm.commons.Remapper;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
public class Mapper extends Remapper {
private MappingData data;
private final MappingData data;
public Mapper(MappingData data) {
this.data = data;

View file

@ -1,4 +1,4 @@
package io.github.moehreag.mojmap_patcher.api.data;
package org.ecorous.esnesnon.mojmap_patcher.api.data;
import org.objectweb.asm.Type;
@ -46,21 +46,18 @@ public record MappingData(Map<String, String> classes, Map<Member, String> metho
}
private Type remapType(Type type) {
switch (type.getSort()) {
case Type.OBJECT:
return Type.getObjectType(classes.getOrDefault(type.getInternalName(), type.getInternalName()));
case Type.ARRAY:
return Type.getObjectType(
"[".repeat(type.getDimensions()) + remapType(type.getElementType()).getDescriptor()
);
case Type.METHOD:
return Type.getMethodType(
remapType(type.getReturnType()),
Arrays.stream(type.getArgumentTypes()).map(this::remapType).toArray(Type[]::new)
);
default:
return type;
}
return switch (type.getSort()) {
case Type.OBJECT ->
Type.getObjectType(classes.getOrDefault(type.getInternalName(), type.getInternalName()));
case Type.ARRAY -> Type.getObjectType(
"[".repeat(type.getDimensions()) + remapType(type.getElementType()).getDescriptor()
);
case Type.METHOD -> Type.getMethodType(
remapType(type.getReturnType()),
Arrays.stream(type.getArgumentTypes()).map(this::remapType).toArray(Type[]::new)
);
default -> type;
};
}
}

View file

@ -1,4 +1,4 @@
package io.github.moehreag.mojmap_patcher.api.data;
package org.ecorous.esnesnon.mojmap_patcher.api.data;
public record Member(String owner, String name, String descriptor) {
}

View file

@ -1,14 +1,7 @@
package io.github.moehreag.mojmap_patcher.parser;
package org.ecorous.esnesnon.mojmap_patcher.parser;
import io.github.moehreag.mojmap_patcher.Constants;
import io.github.moehreag.mojmap_patcher.api.data.Member;
import io.github.moehreag.mojmap_patcher.api.data.MappingData;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.ecorous.esnesnon.mojmap_patcher.api.data.Member;
import org.ecorous.esnesnon.mojmap_patcher.api.data.MappingData;
public class ProguardParser {

View file

@ -1,8 +1,8 @@
package io.github.moehreag.mojmap_patcher.provider;
package org.ecorous.esnesnon.mojmap_patcher.provider;
import com.google.gson.*;
import io.github.moehreag.mojmap_patcher.Constants;
import io.github.moehreag.mojmap_patcher.HttpHelper;
import org.ecorous.esnesnon.mojmap_patcher.Constants;
import org.ecorous.esnesnon.mojmap_patcher.HttpHelper;
import java.util.Optional;