Jump to content

Recommended Posts

Posted (edited)

I'm using the discord jda as a dependency for my mod, and I recently had a problem here, but I'm still stuck on combining this new shadow jar with the original jar.

For reference, this is the gradle shadow plugin I'm using

 

When I run gradlew build with this in my build.gradle:

buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
    }
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.github.johnrengelman.plugin-shadow'
apply plugin: 'java'

version = "1.0"
group= "com.thelagg.laggview"
archivesBaseName = "laggview"
sourceCompatibility = 1.8
targetCompatibility = 1.8

project.tasks.build.dependsOn project.tasks.shadowJar

minecraft {
    version = "1.8.9-11.15.1.2318-1.8.9"
    runDir = "run"
    mappings = "stable_20"
}

shadowJar {
   baseName = 'laggview-shadow'
   classifier = null
   version = 1.0
   configurations = [project.configurations.compile]
}

repositories {
	jcenter()
}

dependencies {
	//both my dependencies are in the ./libs folder
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version
    from configurations.compile.collect { zipTree it }
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

 

The shadow-jar seems to look good when I open it with luyten (java deobfuscator):

_uyGn4J6S_OSnY3vBpLK7Q.png

 

The regular jar hasn't changed at all (it still compiles the dependencies, but doesn't shadow them). I've tried putting the shadow jar into my mods folder to try and run that, but it gave me an error that it could not find a method Minecraft.getMinecraft() - the shadowed Jar doesn't obfuscate any of the fields or methods inside it (picture below)

 

laggview-shadow-1.0.jar

tCLZSYbuT-qYDiduYNBvug.png

 

laggview-1.0.jar

j2PCpufRS4_8uWpdDkczHQ.png

 

So, I'm looking to do either one of 2 things:

  1. Obfuscate the shadow jar like I would with the normal jar
  2. shadow the normal jar's dependencies

I just have no idea how to do either of those things... 

If anybody could shed some light on the topic, I would appreciate it. Thanks!

Edited by Lagg

Hi

:D

Posted

Your post is unreadable on the dark theme, you should use the Tx button to remove the formatting from it.

 

You need to tell ForgeGradle to reobfuscate the shadow JAR, you can see how I do this here.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
38 minutes ago, Choonster said:

Your post is unreadable on the dark theme, you should use the Tx button to remove the formatting from it.

 

You need to tell ForgeGradle to reobfuscate the shadow JAR, you can see how I do this here.

Thanks so much, it worked! :)

Hi

:D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.