Jump to content

Lagg

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by Lagg

  1. 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! :)

  2. 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!

  3. Ok so I've done a bit more stuff with the gradle shadow plugin @loordgek posted, but now I have an issue with minecraft obfuscation.

     

    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!

  4. I'm currently making a mod that uses discord jda, but I'm running into some issues when running the mod.

     

    When I run it through eclipse, it works just fine - no problems at all.

    When I run gradlew build, export it with all the dependency jars in the libs folder (picture below), and then run minecraft, it gives me this:

    [19:03:17] [Client thread/ERROR]: Caught exception from laggview
    java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    	at net.dv8tion.jda.core.utils.JDALogger.<clinit>(JDALogger.java:52) ~[JDALogger.class:?]
    	at net.dv8tion.jda.core.entities.impl.JDAImpl.<clinit>(JDAImpl.java:58) ~[JDAImpl.class:?]
    	at net.dv8tion.jda.core.JDABuilder.buildAsync(JDABuilder.java:643) ~[JDABuilder.class:?]
    	at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:701) ~[JDABuilder.class:?]
    	at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:730) ~[JDABuilder.class:?]
    	at com.thelagg.laggview.DiscordListener.<init>(DiscordListener.java:41) ~[DiscordListener.class:?]
    	at com.thelagg.laggview.LaggView.init(LaggView.java:75) ~[LaggView.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?]
    	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) ~[?:?]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?]
    	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) ~[forge-1.8.9-11.15.1.2318-1.8.9.jar:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
    	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:737) [Loader.class:?]
    	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:310) [FMLClientHandler.class:?]
    	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:495) [ave.class:?]
    	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329) [ave.class:?]
    	at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101) ~[launchwrapper-1.12.jar:?]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_25]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_25]
    	... 43 more

     

    My Dependencies:

    QyNnAAgpQL_gibIPLNrtNw.png

     

    I've also tried adding the JDA to my build.gradle by adding:

    repositories {
    	jcenter()
    }
    dependencies {
    	compile 'net.dv8tion:JDA:3.5.0_327'  
    }

    But that gave me the same error, so I commented that out for now. 

     

    I think it should work properly because when I look inside the jar with WinRAR, it shows me that org.slf4j.LoggerFactory exists:

    Lzgi1rs4RMWnO8piMUJ9aw.png

     

    I'm thinking I must be doing something wrong with exporting the mod because it runs fine from eclipse - it just doesn't run when I put it in my .minecraft/mods folder. 

    I'd appreciate any help, thanks in advance! :)

     

    P.S. I'm using Forge 1.8.9 latest version - I'm not sure if that's a problem. The reason I'm using that over 1.11 is because the server my mod's designed for runs only 1.8.9.

  5. I'm making a client-side hud mod that I want to tell me the last person that hit me, but I'm not sure how to go about it. The LivingHurtEvent has this info, but it's only server side :(, so I'm trying to find an alternative that's client side.

     

    I read a thread about something similar to this, where it was suggested the original poster either check every tick if the player's health decreases or look around for a packet that sends that info. 

     

    Checking if my player's health is decreasing won't tell me what hit me, but I was wondering if anybody knew if any packets used this info - I've looked around but I'm still a little confused how to read what these packets do.

     

    Alternatively, if that packet doesn't exist, how should i go about checking my surroundings for what hurt me?

     

    Any advice is appreciated, thanks :)

  6. I'm trying to register a client-side command, and here's the code I'm using so far:

     

    public class Test extends CommandBase {
    
    @Override
    public String getName() {
    	return "test";
    }
    
    @Override
    public String getCommandUsage(ICommandSender icommandsender) {
    return "command usage test";
    }
    
    @Override
    public void execute(ICommandSender sender, String[] args) throws CommandException {
    	Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("command works! yay!"));
    }
    }

     

    And then in the main mod class:

     @EventHandler
        public void init(FMLInitializationEvent event)
        {
            FMLCommonHandler.instance().bus().register(this);
            MinecraftForge.EVENT_BUS.register(this);
            try {
            	ClientCommandHandler.instance.registerCommand(new Test());
            } catch (Exception e) {
            	System.out.println("error");
            }
        }

     

    The problem is that when I try to use the command, it tells me:

    d424d2c44e57461b9921f2eee6f661d4.png

     

    Also, I know that I should update to 1.10, but the server I play on his heavily focused around pvp and they tend to like 1.8 better, so yeah.

     

    Thanks in advance! :)

  7. Hi, I'm sort of new to making mods with forge, and also sort of new to really big Java projects. I'm having trouble with getting the display name of the scoreboard on the right side of the screen.

    A lot of servers use the scoreboard for different stuff and I'm trying to be able to read it. I've already found that I can get the names of all the "Players" by using:

    Minecraft.getMinecraft().theWorld.getScoreboard().getObjectiveNames()

     

    So for example, here I can get the names of Player995 Player996 and Player994.

    5158e1322eef481093f126f083c5f08c.png

     

    The problem is, I can't seem to get the display name at the top. If anybody could point me in the right direction, I'd appreciate it, thanks!

×
×
  • Create New...

Important Information

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