aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-12 21:38:29 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-12 21:38:29 +0200
commitebbe3df91ffc7194cd533b409db8b125aa09b686 (patch)
treefcd1f9a39e68ab31f163ca960cfd32eb68ce914f
parent044900d6c238ba797423e0ad6b52aab0bdbcf3e5 (diff)
downloadHyPixelForgeModAPI-ebbe3df91ffc7194cd533b409db8b125aa09b686.tar.gz
HyPixelForgeModAPI-ebbe3df91ffc7194cd533b409db8b125aa09b686.tar.bz2
HyPixelForgeModAPI-ebbe3df91ffc7194cd533b409db8b125aa09b686.zip
Fix depending on not reobfJar
-rwxr-xr-xbuild.gradle16
-rw-r--r--tweaker/build.gradle4
-rw-r--r--tweaker/src/main/java/net/hypixel/modapi/tweaker/HypixelModAPITweaker.java10
3 files changed, 26 insertions, 4 deletions
diff --git a/build.gradle b/build.gradle
index 36577c8..63a7dca 100755
--- a/build.gradle
+++ b/build.gradle
@@ -12,8 +12,9 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'
allprojects {
- version = "1.0.0.1" // First 3 numbers should correspond to the version of the API, last number is for the mod itself for any changes/fixes
- group = "net.hypixel.modapi" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
+ apply plugin: 'maven-publish'
+ version = "1.0.0.2" // First 3 numbers should correspond to the version of the API, last number is for the mod itself for any changes/fixes
+ group = "net.hypixel" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "HypixelModAPI"
repositories {
@@ -22,6 +23,17 @@ allprojects {
}
mavenLocal()
}
+
+ publishing {
+ publications {
+ maven(MavenPublication) {
+ groupId = project.group
+ artifactId = project == rootProject ? 'mod-api-forge' : ('mod-api-forge-' + project.name)
+ version = project.version
+ from components.java
+ }
+ }
+ }
}
sourceCompatibility = 1.8
diff --git a/tweaker/build.gradle b/tweaker/build.gradle
index 8962b17..e8eada8 100644
--- a/tweaker/build.gradle
+++ b/tweaker/build.gradle
@@ -17,6 +17,10 @@ task generateVersionInfo(type: WriteProperties) {
}
tasks.jar {
+ dependsOn(project(":").reobfJar)
from(project(":").jar)
from(generateVersionInfo)
+ manifest {
+ attributes("TweakClass": "net.hypixel.modapi.tweaker.HypixelModAPITweaker")
+ }
}
diff --git a/tweaker/src/main/java/net/hypixel/modapi/tweaker/HypixelModAPITweaker.java b/tweaker/src/main/java/net/hypixel/modapi/tweaker/HypixelModAPITweaker.java
index 6195833..4464cd7 100644
--- a/tweaker/src/main/java/net/hypixel/modapi/tweaker/HypixelModAPITweaker.java
+++ b/tweaker/src/main/java/net/hypixel/modapi/tweaker/HypixelModAPITweaker.java
@@ -12,6 +12,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
@@ -145,8 +146,12 @@ public class HypixelModAPITweaker implements ITweaker {
*/
private void injectAPI() {
LOGGER.info("Injecting mod API of version {}", VERSION_NAME);
- CoreModManager.getReparseableCoremods()
- .add(unpackAPI().getPath());
+ try {
+ Launch.classLoader.addURL(unpackAPI().toURI().toURL());
+ LOGGER.info("Added mod API to classpath");
+ } catch (MalformedURLException e) {
+ LOGGER.error("Could not add mod API to classpath", e);
+ }
}
/**
@@ -200,6 +205,7 @@ public class HypixelModAPITweaker implements ITweaker {
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
offerVersionToBlackboard();
+ allowModLoading();
}
@Override