mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 15:44:22 +00:00
Make it easier to build the development environment. (#133)
* Fix the warning about removing duplicate source roots when open the project with Intellij IDEA. * Add Gradle wrapper. * CustomSkinLoader can be loaded in Forge development environment now. * CustomSkinLoader can be loaded in Fabric development environment now.
This commit is contained in:
1 parent
855131d1aa
commit
1b2a4dc260
28 files changed
+746
-532
No files matched your search
+1
-2
@@ -22,8 +22,7 @@ bin/
|
||||
# gradle
|
||||
.gradle/
|
||||
build/
|
||||
gradle/
|
||||
gradlew*
|
||||
logs/
|
||||
run/
|
||||
|
||||
# IDEA
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
// If you want to add dependent project sources for annotation processors in current project,
|
||||
// use `projectImplementation project(":xxx")` instead of `dependencies { implementation project(":xxx") }`
|
||||
|
||||
class ProjectContainer {
|
||||
static def implementationProjects = [:]
|
||||
}
|
||||
|
||||
void projectImplementation(Project otherProject) {
|
||||
dependencies {
|
||||
implementation otherProject, {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
|
||||
ProjectContainer.implementationProjects.putIfAbsent project, []
|
||||
ProjectContainer.implementationProjects.get project add otherProject
|
||||
}
|
||||
|
||||
ext {
|
||||
projectImplementation = this.&projectImplementation
|
||||
}
|
||||
|
||||
// We need to add sourceSets at compile time to avoid IntelliJ IDEA from removing duplicated source roots and to avoid Eclipse add source dirs twice.
|
||||
// The reason of that we don't just dependent other subprojects is to let Mixin AP work correctly.
|
||||
task setupSourceSets {
|
||||
doLast {
|
||||
sourceSets.main {
|
||||
java {
|
||||
ProjectContainer.implementationProjects.get(project).forEach({
|
||||
it.sourceSets.main.java.srcDirs.forEach({ targetDir ->
|
||||
srcDir targetDir
|
||||
})
|
||||
})
|
||||
}
|
||||
resources {
|
||||
ProjectContainer.implementationProjects.get(project).forEach({
|
||||
it.sourceSets.main.resources.srcDirs.forEach({ targetDir ->
|
||||
srcDir targetDir
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
deobfCompileDummyTask.dependsOn setupSourceSets
|
||||
@@ -0,0 +1,5 @@
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
# this subproject is only to provide dependency for other subprojects.
|
||||
is_real_project=false
|
||||
+8
-157
@@ -1,173 +1,24 @@
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
ext.configFile = file "build.properties"
|
||||
configFile.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
apply from: rootProject.file("BuildScripts/version.gradle")
|
||||
|
||||
version = getCSLVersion()
|
||||
group = "customskinloader"
|
||||
archivesBaseName = "CustomSkinLoader_Fabric"
|
||||
ext.shortVersion = getShortVersion()
|
||||
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = config.forge_mc_version + "-" + config.forge_version
|
||||
runDir = "run"
|
||||
mappings = config.mappings_version
|
||||
|
||||
replace '@MOD_VERSION@', rootProject.ext.config.version
|
||||
replace '@MOD_FULL_VERSION@', project.version
|
||||
replaceIn 'CustomSkinLoader.java'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : "CustomSkinLoader",
|
||||
"Specification-Vendor" : "xfl03",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : "CustomSkinLoader",
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "xfl03",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
exclude 'customskinloader/tweaker/**'
|
||||
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'Profile.json'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://repo.spongepowered.org/maven"
|
||||
name = "fabric"
|
||||
url = "https://maven.fabricmc.net/"
|
||||
}
|
||||
}
|
||||
|
||||
projectImplementation project(':Common')
|
||||
projectImplementation project(':Vanilla')
|
||||
|
||||
dependencies {
|
||||
implementation 'org.spongepowered:mixin:0.8'
|
||||
}
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
||||
reobfSrgFile = "build/mixin.srg"
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/source"
|
||||
//Vanilla
|
||||
srcDir "${rootDir}/Vanilla/source"
|
||||
//Fabric
|
||||
srcDir "source"
|
||||
}
|
||||
resources {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/resource"
|
||||
exclude "Profile.json"
|
||||
//Fabric
|
||||
srcDir "resource"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion : project.version,
|
||||
modShortFullVersion: shortVersion,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
||||
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
apply from: rootProject.file("BuildScripts/remap.gradle")
|
||||
reobf {
|
||||
jar {
|
||||
if (config.srg_notch_map != null) {
|
||||
mappings = file("build/reobf.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task genSrgMap {
|
||||
doLast {
|
||||
if (config.srg_notch_map != null) {
|
||||
// convert mappings
|
||||
tsrg2srg file(config.srg_notch_map), file("build/reobf.srg")
|
||||
tsrg2srg file("mixin.tsrg"), file("build/mixin.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
clean.finalizedBy genSrgMap
|
||||
build.dependsOn genSrgMap
|
||||
|
||||
task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||
onlyIf { System.getenv("KEY_PASS") != null }
|
||||
doLast { System.out.println("Jar will be signed.") }
|
||||
|
||||
inputFile = jar.archivePath
|
||||
outputFile = jar.archivePath
|
||||
|
||||
keyStore = "${rootDir}/Common/CustomSkinLoader.jks"
|
||||
alias = 'CustomSkinLoader'
|
||||
storePass = System.getenv("KEY_PASS")
|
||||
keyPass = System.getenv("KEY_PASS")
|
||||
}
|
||||
build.dependsOn signJar
|
||||
|
||||
task afterBuild {
|
||||
doLast {
|
||||
//copyBuildFile
|
||||
copy {
|
||||
from "build/libs"
|
||||
into "${rootDir}/build/libs"
|
||||
include "**/*.jar"
|
||||
exclude "**/*-srg.jar"
|
||||
exclude "**/*-dev.jar"
|
||||
exclude "**/*-sources.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/xfl03/MCCustomSkinLoader")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
gpr(MavenPublication) {
|
||||
groupId 'customskinloader'
|
||||
artifactId project.archivesBaseName
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.withType(PublishToMavenRepository) {
|
||||
onlyIf { System.getenv("GITHUB_TOKEN") != null }
|
||||
// This is the minimum version number that the mod should dependent in the development environment.
|
||||
implementation "net.fabricmc:fabric-loader:0.4.9+build.160"
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package customskinloader.fabric;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.entrypoint.EntrypointTransformer;
|
||||
import net.fabricmc.loader.game.MinecraftGameProvider;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.ClassRemapper;
|
||||
import org.objectweb.asm.commons.SimpleRemapper;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class DevEnvRemapper extends SimpleRemapper {
|
||||
private static Map<String, List<String>> remappedClasses = new HashMap<>();
|
||||
|
||||
static {
|
||||
// TODO: Remove hardcoded class names
|
||||
remappedClasses.put("net.minecraft.class_1060", Lists.newArrayList("customskinloader.fake.FakeSkinManager", "customskinloader.fake.itf.IFakeTextureManager_1", "customskinloader.fake.itf.IFakeTextureManager_2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void initRemapper() {
|
||||
try {
|
||||
if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
Field patchedClassesField = EntrypointTransformer.class.getDeclaredField("patchedClasses");
|
||||
patchedClassesField.setAccessible(true);
|
||||
Map<String, byte[]> patchedClasses = (Map<String, byte[]>) patchedClassesField.get(MinecraftGameProvider.TRANSFORMER);
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : remappedClasses.entrySet()) {
|
||||
for (String clazz : entry.getValue()) {
|
||||
byte[] classBytes = patchedClasses.get(clazz);
|
||||
if (classBytes == null) {
|
||||
classBytes = IOUtils.toByteArray(Objects.requireNonNull(cl.getResourceAsStream(clazz.replace(".", "/") + ".class")));
|
||||
}
|
||||
|
||||
patchedClasses.put(clazz, remapClass(entry.getKey(), classBytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
MixinConfigPlugin.logger.warning(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Remap all method names with specific method owner name.
|
||||
public static byte[] remapClass(String owner, byte[] bytes) {
|
||||
ClassNode cn = new ClassNode();
|
||||
new ClassReader(bytes).accept(new ClassRemapper(cn, new DevEnvRemapper(owner)), ClassReader.EXPAND_FRAMES);
|
||||
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
private boolean isGettingIntermediaryDesc = false;
|
||||
private final String owner;
|
||||
|
||||
public DevEnvRemapper(String owner) {
|
||||
super(new HashMap<>());
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mapMethodName(String owner, String name, String desc) {
|
||||
// Method desc should be unmapped in the development environment.
|
||||
this.isGettingIntermediaryDesc = true;
|
||||
desc = this.mapDesc(desc);
|
||||
this.isGettingIntermediaryDesc = false;
|
||||
|
||||
String s = FabricLoader.getInstance().getMappingResolver().mapMethodName("intermediary", this.owner, name, desc);
|
||||
return s == null ? name : s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(String key) {
|
||||
if (this.isGettingIntermediaryDesc) {
|
||||
return FabricLoader.getInstance().getMappingResolver().unmapClassName("intermediary", Type.getType("L" + key + ";").getClassName()).replace(".", "/");
|
||||
}
|
||||
return super.map(key);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,9 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
} else {
|
||||
logger.warning("Can't read \"version.json\"! Ignore this message if the version you start is earlier than 18w47b.");
|
||||
}
|
||||
|
||||
// This mod will remap extra classes when in the development environment.
|
||||
DevEnvRemapper.initRemapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-130
@@ -1,146 +1,20 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
ext.configFile = file "build.properties"
|
||||
configFile.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
apply from: rootProject.file("BuildScripts/version.gradle")
|
||||
|
||||
archivesBaseName = "CustomSkinLoader_Forge"
|
||||
version = getCSLVersion()
|
||||
group = "customskinloader"
|
||||
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
}
|
||||
projectImplementation project(':Common')
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"TweakClass" : "customskinloader.forge.ForgeTweaker",
|
||||
"TweakOrder" : -10,
|
||||
"Specification-Title" : "CustomSkinLoader",
|
||||
"Specification-Vendor" : "xfl03",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : "CustomSkinLoader",
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "xfl03",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
"TweakClass": "customskinloader.forge.ForgeTweaker",
|
||||
"TweakOrder": -10
|
||||
])
|
||||
}
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'net/minecraftforge/**'
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/source"
|
||||
//Forge
|
||||
srcDir "source"
|
||||
}
|
||||
resources {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/resource"
|
||||
exclude "Profile.json"
|
||||
//Forge
|
||||
srcDir "resource"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = config.forge_mc_version + "-" + config.forge_version
|
||||
runDir = "run"
|
||||
mappings = config.mappings_version
|
||||
clientJvmArgs += "-Dfml.coreMods.load=customskinloader.forge.ForgePlugin"
|
||||
|
||||
replace '@MOD_VERSION@', rootProject.ext.config.version
|
||||
replace '@MOD_FULL_VERSION@', project.version
|
||||
replaceIn 'CustomSkinLoader.java'
|
||||
replaceIn 'ForgeMod.java'
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesNotMatching("**/*.js"){
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion: project.version,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions: config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
||||
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])}
|
||||
}
|
||||
|
||||
task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||
onlyIf { System.getenv("KEY_PASS") != null }
|
||||
doLast { System.out.println("Jar will be signed.") }
|
||||
|
||||
inputFile = jar.archivePath
|
||||
outputFile = jar.archivePath
|
||||
|
||||
// To prevent modlauncher from checking signer information about Minecraft classes in CustomSkinLoader jar after forge-1.16.3-34.1.27.
|
||||
exclude "net/minecraft/client/**"
|
||||
|
||||
keyStore = "${rootDir}/Common/CustomSkinLoader.jks"
|
||||
alias = 'CustomSkinLoader'
|
||||
storePass = System.getenv("KEY_PASS")
|
||||
keyPass = System.getenv("KEY_PASS")
|
||||
}
|
||||
build.dependsOn signJar
|
||||
|
||||
task afterBuild {
|
||||
doLast {
|
||||
//copyBuildFile
|
||||
copy {
|
||||
from "build/libs"
|
||||
into "${rootDir}/build/libs"
|
||||
include "**/*.jar"
|
||||
exclude "**/*-sources.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/xfl03/MCCustomSkinLoader")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
gpr(MavenPublication) {
|
||||
groupId 'customskinloader'
|
||||
artifactId project.archivesBaseName
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.withType(PublishToMavenRepository) {
|
||||
onlyIf { System.getenv("GITHUB_TOKEN") != null }
|
||||
}
|
||||
@@ -15,5 +15,5 @@ authors=["xfl03", "JLChnToZ"]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[25,)"
|
||||
ordering="NONE"
|
||||
ordering="BEFORE" # Make sure all classes of CustomSkinLoader is ordered before than forge so that some classes can be replaced in development environment.
|
||||
side="CLIENT"
|
||||
@@ -1,9 +1,25 @@
|
||||
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI');
|
||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes');
|
||||
var FieldInsnNode = Java.type('org.objectweb.asm.tree.FieldInsnNode');
|
||||
var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode');
|
||||
var MethodInsnNode = Java.type('org.objectweb.asm.tree.MethodInsnNode');
|
||||
var VarInsnNode = Java.type('org.objectweb.asm.tree.VarInsnNode');
|
||||
|
||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes');
|
||||
// Compare method and field names, deobfName can be null if the srgName didn't exist in 1.13.2.
|
||||
function checkName(name, srgName, deobfName) {
|
||||
return name.equals(mapName(srgName)) || name.equals(deobfName);
|
||||
}
|
||||
|
||||
// De-obfuscate method and field names.
|
||||
function mapName(srgName) {
|
||||
try {
|
||||
if (srgName.startsWith("field_")) return ASMAPI.mapField(srgName);
|
||||
if (srgName.startsWith("func_")) return ASMAPI.mapMethod(srgName);
|
||||
} catch (ignored) {
|
||||
// Before forge-1.13.2-25.0.194
|
||||
}
|
||||
return srgName;
|
||||
}
|
||||
|
||||
function initializeCoreMod() {
|
||||
return {
|
||||
@@ -16,10 +32,10 @@ function initializeCoreMod() {
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (mn.name === 'func_175249_a' || mn.name === 'func_238523_a_') {
|
||||
if (checkName(mn.name, "func_175249_a", "render") || checkName(mn.name, "func_238523_a_", null)) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.name === "func_71387_A") {
|
||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && checkName(node.name, "func_71387_A", "isIntegratedServerRunning")) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
mn.instructions.set(node, new InsnNode(Opcodes.ICONST_1));
|
||||
}
|
||||
@@ -38,7 +54,7 @@ function initializeCoreMod() {
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (mn.name === 'func_174884_b') {
|
||||
if (checkName(mn.name, "func_174884_b", "updateGameProfile")) {
|
||||
mn.instructions.insert(new InsnNode(Opcodes.ARETURN));
|
||||
mn.instructions.insert(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
}
|
||||
@@ -102,12 +118,12 @@ function initializeCoreMod() {
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (mn.name === 'func_229159_a_') {
|
||||
if (checkName(mn.name, "func_229159_a_", null)) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.name === "func_229163_c_") {
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && checkName(node.name, "func_229163_c_", null)) {
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/texture/DownloadingTexture", "field_229155_i_", "Ljava/lang/Runnable;"));
|
||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/texture/DownloadingTexture", mapName("field_229155_i_"), "Ljava/lang/Runnable;"));
|
||||
iterator.set(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinBuffer", "processLegacySkin", "(Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/Runnable;)Lnet/minecraft/client/renderer/texture/NativeImage;", false));
|
||||
}
|
||||
}
|
||||
@@ -125,11 +141,11 @@ function initializeCoreMod() {
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (mn.name === 'func_229145_a_' || mn.name === 'func_229159_a_') { // PlayerRenderer.renderItem || CapeLayer.render
|
||||
if (checkName(mn.name, "func_229145_a_", null) || checkName(mn.name, "func_229159_a_", null)) { // PlayerRenderer.renderItem || CapeLayer.render
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.name === "func_228634_a_") { // RenderType.getEntitySolid
|
||||
node.name = "func_228644_e_" // RenderType.getEntityTranslucent
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && checkName(node.name, "func_228634_a_", null)) { // RenderType.getEntitySolid
|
||||
node.name = mapName("func_228644_e_"); // RenderType.getEntityTranslucent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package customskinloader.forge;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.launchwrapper.ITweaker;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
|
||||
/**
|
||||
* The tweaker for development environment.
|
||||
*/
|
||||
public class ForgeDevTweaker implements ITweaker {
|
||||
@Override
|
||||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
|
||||
// ForgeTweaker should be added after FMLTweaker being initialized.
|
||||
((List<String>) Launch.blackboard.get("TweakClasses")).add(ForgeTweaker.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLaunchTarget() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getLaunchArguments() {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package customskinloader.forge;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -32,7 +33,7 @@ public class ForgeMod {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void fingerprintError(FMLFingerprintViolationEvent event) {
|
||||
if (event.isDirectory()) return;//Development Environment
|
||||
if ((boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment") || event.isDirectory()) return;//Development Environment
|
||||
|
||||
CustomSkinLoader.logger.warning("!!!Fingerprint ERROR!!!");
|
||||
CustomSkinLoader.logger.warning("Failed to check fingerprint in file '" + event.getSource().getAbsolutePath() + "'.");
|
||||
|
||||
@@ -2,6 +2,7 @@ package customskinloader.forge.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
|
||||
import customskinloader.forge.TransformerManager;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
@@ -9,14 +10,11 @@ import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import customskinloader.forge.TransformerManager.IMethodTransformer;
|
||||
import customskinloader.forge.TransformerManager.TransformTarget;
|
||||
|
||||
public class PlayerTabTransformer {
|
||||
@TransformTarget(className = "net.minecraft.client.gui.GuiPlayerTabOverlay",
|
||||
@TransformerManager.TransformTarget(className = "net.minecraft.client.gui.GuiPlayerTabOverlay",
|
||||
methodNames = {"func_175249_a", "renderPlayerlist"},
|
||||
desc = "(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V")
|
||||
public static class ScoreObjectiveTransformer implements IMethodTransformer {
|
||||
public static class ScoreObjectiveTransformer implements TransformerManager.IMethodTransformer {
|
||||
//From: http://git.oschina.net/AsteriskTeam/TabIconHackForge/blob/master/src/main/java/kengxxiao/tabiconhack/coremod/TabIconHackForgeClassTransformer.java#L30-L43
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package customskinloader.forge.transformer;
|
||||
|
||||
import customskinloader.forge.TransformerManager;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
@@ -10,14 +11,11 @@ import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import customskinloader.forge.TransformerManager.IMethodTransformer;
|
||||
import customskinloader.forge.TransformerManager.TransformTarget;
|
||||
|
||||
public class SkinManagerTransformer {
|
||||
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
@TransformerManager.TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
methodNames={"<init>"},
|
||||
desc="(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")
|
||||
public static class InitTransformer implements IMethodTransformer{
|
||||
public static class InitTransformer implements TransformerManager.IMethodTransformer{
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
boolean hasField = false;
|
||||
@@ -46,10 +44,10 @@ public class SkinManagerTransformer {
|
||||
return mn;
|
||||
}
|
||||
}
|
||||
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
@TransformerManager.TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
methodNames={"func_152789_a","loadSkin"},
|
||||
desc="(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;")
|
||||
public static class LoadSkinTransformer implements IMethodTransformer{
|
||||
public static class LoadSkinTransformer implements TransformerManager.IMethodTransformer{
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
mn.instructions.clear();
|
||||
@@ -64,10 +62,10 @@ public class SkinManagerTransformer {
|
||||
return mn;
|
||||
}
|
||||
}
|
||||
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
@TransformerManager.TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
methodNames={"func_152790_a","loadProfileTextures"},
|
||||
desc="(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V")
|
||||
public static class LoadProfileTexturesTransformer implements IMethodTransformer{
|
||||
public static class LoadProfileTexturesTransformer implements TransformerManager.IMethodTransformer{
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
mn.instructions.clear();
|
||||
@@ -82,10 +80,10 @@ public class SkinManagerTransformer {
|
||||
return mn;
|
||||
}
|
||||
}
|
||||
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
@TransformerManager.TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||
methodNames={"func_152788_a","loadSkinFromCache"},
|
||||
desc="(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")
|
||||
public static class LoadSkinFromCacheTransformer implements IMethodTransformer{
|
||||
public static class LoadSkinFromCacheTransformer implements TransformerManager.IMethodTransformer{
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
mn.instructions.clear();
|
||||
|
||||
@@ -3,7 +3,6 @@ package customskinloader.forge.transformer;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import customskinloader.forge.TransformerManager;
|
||||
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
@@ -11,17 +10,14 @@ import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import customskinloader.forge.TransformerManager.IMethodTransformer;
|
||||
import customskinloader.forge.TransformerManager.TransformTarget;
|
||||
|
||||
/**
|
||||
* Transformer of Spectator Menu for 1.13-
|
||||
*/
|
||||
public class SpectatorMenuTransformer {
|
||||
@TransformTarget(className = "net.minecraft.client.gui.spectator.PlayerMenuObject",
|
||||
@TransformerManager.TransformTarget(className = "net.minecraft.client.gui.spectator.PlayerMenuObject",
|
||||
methodNames = {"<init>"},
|
||||
desc = "(Lcom/mojang/authlib/GameProfile;)V")
|
||||
public static class PlayerMenuObjectTransformer implements IMethodTransformer {
|
||||
public static class PlayerMenuObjectTransformer implements TransformerManager.IMethodTransformer {
|
||||
|
||||
@Override
|
||||
public MethodNode transform(ClassNode cn, MethodNode mn) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.objectweb.asm.tree.VarInsnNode;
|
||||
public class TileEntitySkullTransformer {
|
||||
@TransformerManager.TransformTarget(
|
||||
className = "net.minecraft.tileentity.TileEntitySkull",
|
||||
methodNames = {"updateGameProfile", "func_174884_b"},
|
||||
methodNames = {"func_174884_b", "updateGameprofile", "updateGameProfile"},
|
||||
desc = "(Lcom/mojang/authlib/GameProfile;)Lcom/mojang/authlib/GameProfile;"
|
||||
)
|
||||
public static class UpdateGameProfileTransformer implements TransformerManager.IMethodTransformer {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// This subproject is only to provide dependency for other subprojects.
|
||||
|
||||
dependencies {
|
||||
implementation project(':Common'), {
|
||||
transitive = false
|
||||
}
|
||||
implementation 'org.spongepowered:mixin:0.8.2:thin'
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
# this subproject is only to provide dependency for other subprojects.
|
||||
is_real_project=false
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
archivesBaseName = rootProject.ext.config.name + "_" + config.minecraft_version
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'TweakClass' : 'customskinloader.tweaker.ModSystemTweaker'
|
||||
attributes 'TweakName' : rootProject.ext.config.name
|
||||
attributes 'TweakAuthor' : 'xfl03,JLChnToZ'
|
||||
attributes 'TweakVersion': version
|
||||
attributes 'TweakOrder' : '-10'
|
||||
}
|
||||
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'Profile.json'
|
||||
}
|
||||
|
||||
projectImplementation project(':Common')
|
||||
projectImplementation project(':Vanilla')
|
||||
|
||||
import java.security.MessageDigest
|
||||
task afterBuildForVanilla {
|
||||
doLast {
|
||||
def file0 = file("build/libs/${archivesBaseName}-${version}.jar")
|
||||
|
||||
//copyProfileJson
|
||||
File f = project.file("build/resources/main/Profile.json")
|
||||
String of = String.format("build/libs/%s-CSL-%s.json", config.minecraft_version, shortVersion)
|
||||
File off = rootProject.file(of)
|
||||
off.parentFile.mkdirs()
|
||||
|
||||
def digest = MessageDigest.getInstance "SHA1"
|
||||
digest.update file0.getBytes()
|
||||
def sha1 = new BigInteger(1, digest.digest()).toString 16 padLeft 40, "0"
|
||||
off.withWriter "UTF-8", { w ->
|
||||
f.eachLine "UTF-8", { str ->
|
||||
w << "${-> str.contains("{SHA1}") ? str.replace("{SHA1}", sha1) : (!(str =~ $/"size":\s*-1/$) ? str : str.replace("-1", file0.size().toString()))}\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
afterBuild.finalizedBy afterBuildForVanilla
|
||||
@@ -2,7 +2,9 @@
|
||||
"arguments": {
|
||||
"game": [
|
||||
"--tweakClass",
|
||||
"customskinloader.tweaker.Tweaker"
|
||||
"customskinloader.tweaker.Tweaker",
|
||||
"--tweakClass",
|
||||
"org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
},
|
||||
"id": "${mcVersion}-CSL-${modShortFullVersion}",
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package customskinloader.tweaker;
|
||||
|
||||
import customskinloader.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import customskinloader.Logger;
|
||||
import net.minecraft.launchwrapper.ITweaker;
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
import org.spongepowered.asm.launch.MixinBootstrap;
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
import org.spongepowered.asm.mixin.Mixins;
|
||||
|
||||
@@ -25,7 +23,6 @@ public class ModSystemTweaker implements ITweaker {
|
||||
|
||||
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
|
||||
logger.info("ModSystemTweaker: injectIntoClassLoader");
|
||||
MixinBootstrap.init();
|
||||
Mixins.addConfiguration("mixins.customskinloader.json");
|
||||
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package customskinloader.tweaker;
|
||||
|
||||
import customskinloader.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import customskinloader.Logger;
|
||||
import net.minecraft.launchwrapper.ITweaker;
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
import org.spongepowered.asm.launch.MixinBootstrap;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
import org.spongepowered.asm.mixin.Mixins;
|
||||
|
||||
@@ -33,7 +30,6 @@ public class Tweaker implements ITweaker {
|
||||
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
|
||||
logger.info("Tweaker: injectIntoClassLoader");
|
||||
logger.info("Loaded as a library.");
|
||||
MixinBootstrap.init();
|
||||
Mixins.addConfiguration("mixins.customskinloader.json");
|
||||
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
|
||||
}
|
||||
|
||||
+183
-2
@@ -25,9 +25,190 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
wrapper {
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
gradleVersion = "4.10.3"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
if (!project.name.toLowerCase().contains("forge") && !project.name.toLowerCase().contains("fabric"))
|
||||
apply from: rootProject.file('common.gradle')
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
ext.configFile = file "build.properties"
|
||||
configFile.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
|
||||
apply from: rootProject.file("BuildScripts/version.gradle")
|
||||
|
||||
version = getCSLVersion()
|
||||
group = "customskinloader"
|
||||
ext.shortVersion = getShortVersion()
|
||||
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = config.forge_mc_version + "-" + config.forge_version
|
||||
runDir = "run"
|
||||
mappings = config.mappings_version
|
||||
|
||||
replace '@MOD_VERSION@', rootProject.ext.config.version
|
||||
replace '@MOD_FULL_VERSION@', project.version
|
||||
replaceIn 'CustomSkinLoader.java'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://repo.spongepowered.org/maven"
|
||||
}
|
||||
}
|
||||
|
||||
// We need to change source dirs for inherited problems.
|
||||
sourceSets.main {
|
||||
java {
|
||||
srcDir "source"
|
||||
}
|
||||
resources {
|
||||
srcDir "resource"
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : "CustomSkinLoader",
|
||||
"Specification-Vendor" : "xfl03",
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : "CustomSkinLoader",
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "xfl03",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// For real subprojects
|
||||
if (!config.is_real_project || Boolean.parseBoolean(config.is_real_project.toString())) {
|
||||
apply from: rootProject.file("BuildScripts/sources.gradle")
|
||||
|
||||
processResources {
|
||||
filesNotMatching("**/*.js") {
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion : project.version,
|
||||
modShortFullVersion: shortVersion,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
||||
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// Mixin stuffs
|
||||
if (!project.name.toLowerCase().contains("forge")) {
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
dependencies {
|
||||
implementation 'org.spongepowered:mixin:0.8.2'
|
||||
}
|
||||
|
||||
apply from: rootProject.file("BuildScripts/remap.gradle")
|
||||
task genSrgMap {
|
||||
doLast {
|
||||
if (config.srg_notch_map != null) {
|
||||
// convert mappings
|
||||
tsrg2srg file(config.srg_notch_map), file("build/reobf.srg")
|
||||
tsrg2srg file("mixin.tsrg"), file("build/mixin.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
deobfCompileDummyTask.dependsOn genSrgMap
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
||||
reobfSrgFile = "build/mixin.srg"
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
reobf {
|
||||
jar {
|
||||
if (config.srg_notch_map != null) {
|
||||
mappings = file("build/reobf.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||
onlyIf { System.getenv("KEY_PASS") != null }
|
||||
doLast { System.out.println("Jar will be signed.") }
|
||||
|
||||
inputFile = jar.archivePath
|
||||
outputFile = jar.archivePath
|
||||
|
||||
// To prevent modlauncher from checking signer information about Minecraft classes in CustomSkinLoader jar after forge-1.16.3-34.1.27.
|
||||
if (project.name.toLowerCase().contains("forge")) {
|
||||
exclude "net/minecraft/client/**"
|
||||
}
|
||||
|
||||
keyStore = "${rootDir}/Common/CustomSkinLoader.jks"
|
||||
alias = 'CustomSkinLoader'
|
||||
storePass = System.getenv("KEY_PASS")
|
||||
keyPass = System.getenv("KEY_PASS")
|
||||
}
|
||||
build.dependsOn signJar
|
||||
|
||||
task afterBuild {
|
||||
doLast {
|
||||
//copyBuildFile
|
||||
copy {
|
||||
from "build/libs"
|
||||
into "${rootDir}/build/libs"
|
||||
include "**/*.jar"
|
||||
exclude "**/*-srg.jar"
|
||||
exclude "**/*-dev.jar"
|
||||
exclude "**/*-sources.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/xfl03/MCCustomSkinLoader")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
gpr(MavenPublication) {
|
||||
groupId 'customskinloader'
|
||||
artifactId project.archivesBaseName
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.withType(PublishToMavenRepository) {
|
||||
onlyIf { System.getenv("GITHUB_TOKEN") != null }
|
||||
}
|
||||
}
|
||||
|
||||
if (project.name.toLowerCase().contains("vanilla") && !project.name.toLowerCase().endsWith("vanilla")) {
|
||||
apply from: rootProject.file('Vanilla/common.gradle')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: rootProject.file('BuildScripts/cos.gradle')
|
||||
|
||||
-195
@@ -1,195 +0,0 @@
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
ext.configFile = file "build.properties"
|
||||
configFile.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
apply from: rootProject.file("BuildScripts/version.gradle")
|
||||
|
||||
version = getCSLVersion()
|
||||
group = config.group
|
||||
archivesBaseName = rootProject.ext.config.name + "_" + config.minecraft_version
|
||||
ext.shortVersion = getShortVersion()
|
||||
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = config.forge_mc_version + "-" + config.forge_version
|
||||
runDir = "run"
|
||||
mappings = config.mappings_version
|
||||
|
||||
replace '@MOD_VERSION@', rootProject.ext.config.version
|
||||
replace '@MOD_FULL_VERSION@', project.version
|
||||
replaceIn 'CustomSkinLoader.java'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'TweakClass' : 'customskinloader.tweaker.ModSystemTweaker'
|
||||
attributes 'TweakName' : rootProject.ext.config.name
|
||||
attributes 'TweakAuthor' : 'xfl03,JLChnToZ'
|
||||
attributes 'TweakVersion' : version
|
||||
attributes 'TweakOrder' : '-10'
|
||||
attributes 'Specification-Title' : 'CustomSkinLoader'
|
||||
attributes 'Specification-Vendor' : 'xfl03'
|
||||
attributes 'Specification-Version' : '1'
|
||||
attributes 'Implementation-Title' : 'CustomSkinLoader'
|
||||
attributes 'Implementation-Version' : "${version}"
|
||||
attributes 'Implementation-Vendor' : 'xfl03'
|
||||
attributes 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
}
|
||||
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'Profile.json'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://repo.spongepowered.org/maven"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.spongepowered:mixin:0.8'
|
||||
}
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
||||
reobfSrgFile = "build/mixin.srg"
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/source"
|
||||
//Vanilla
|
||||
srcDir "${rootDir}/Vanilla/source"
|
||||
//Special
|
||||
srcDir "source"
|
||||
}
|
||||
resources {
|
||||
//Common
|
||||
srcDir "${rootDir}/Common/resource"
|
||||
//Vanilla
|
||||
srcDir "${rootDir}/Vanilla/resource"
|
||||
//Special
|
||||
srcDir "resource"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion : project.version,
|
||||
modShortFullVersion: shortVersion,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
||||
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
import java.security.MessageDigest
|
||||
|
||||
apply from: rootProject.file("BuildScripts/remap.gradle")
|
||||
reobf {
|
||||
jar {
|
||||
if (config.srg_notch_map != null) {
|
||||
mappings = file("build/reobf.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task genSrgMap {
|
||||
doLast {
|
||||
if (config.srg_notch_map != null) {
|
||||
// convert mappings
|
||||
tsrg2srg file(config.srg_notch_map), file("build/reobf.srg")
|
||||
tsrg2srg file("mixin.tsrg"), file("build/mixin.srg")
|
||||
}
|
||||
}
|
||||
}
|
||||
clean.finalizedBy genSrgMap
|
||||
build.dependsOn genSrgMap
|
||||
|
||||
task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||
onlyIf { System.getenv("KEY_PASS") != null }
|
||||
doLast { System.out.println("Jar will be signed.") }
|
||||
|
||||
inputFile = jar.archivePath
|
||||
outputFile = jar.archivePath
|
||||
|
||||
keyStore = "${rootDir}/Common/CustomSkinLoader.jks"
|
||||
alias = 'CustomSkinLoader'
|
||||
storePass = System.getenv("KEY_PASS")
|
||||
keyPass = System.getenv("KEY_PASS")
|
||||
}
|
||||
build.dependsOn signJar
|
||||
|
||||
task afterBuild {
|
||||
doLast {
|
||||
def file0 = file("build/libs/${archivesBaseName}-${version}.jar")
|
||||
|
||||
//copyBuildFile
|
||||
copy {
|
||||
from "build/libs"
|
||||
into "${rootDir}/build/libs"
|
||||
include "**/*.jar"
|
||||
exclude "**/*-srg.jar"
|
||||
exclude "**/*-dev.jar"
|
||||
exclude "**/*-sources.jar"
|
||||
}
|
||||
|
||||
//copyProfileJson
|
||||
File f = project.file("build/resources/main/Profile.json")
|
||||
String of = String.format("build/libs/%s-CSL-%s.json", config.minecraft_version, shortVersion)
|
||||
File off = rootProject.file(of)
|
||||
off.parentFile.mkdirs()
|
||||
|
||||
def digest = MessageDigest.getInstance "SHA1"
|
||||
digest.update file0.getBytes()
|
||||
def sha1 = new BigInteger(1, digest.digest()).toString 16 padLeft 40, "0"
|
||||
off.withWriter "UTF-8", { w ->
|
||||
f.eachLine "UTF-8", { str ->
|
||||
w << "${-> str.contains("{SHA1}") ? str.replace("{SHA1}", sha1) : (!(str =~ $/"size":\s*-1/$) ? str : str.replace("-1", file0.size().toString()))}\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/xfl03/MCCustomSkinLoader")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
gpr(MavenPublication) {
|
||||
groupId 'customskinloader'
|
||||
artifactId project.archivesBaseName
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.withType(PublishToMavenRepository) {
|
||||
onlyIf { System.getenv("GITHUB_TOKEN") != null }
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+5
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,3 +1,9 @@
|
||||
//Base Project
|
||||
include "Common"
|
||||
|
||||
//Vanilla Base Project
|
||||
include "Vanilla"
|
||||
|
||||
//Special Vanilla Edition
|
||||
include "Vanilla/1.8.9"
|
||||
include "Vanilla/1.12.2"
|
||||
|
||||
Reference in new issue
Block a user