Jump to content

The_Jackal

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by The_Jackal

  1. Using gradlew build. This is similar to how the mod was built for 1.12.2 but it just used a shade configuration and included those dependencies directly. If I don't use shadow, then Minecraft.getInstance() works at runtime, but calls the the jxinput fail. As soon as I add the shadowJar task, Minecraft.getInstance() fails, almost like I'm getting a different version of Minecraft on the classpath.

  2. I was missing Minecraft as a dependency in the mods.toml file. I took the #optional too literally

     

    Adding minecraft as a dependency in the mods.toml file didn't help. 

     

    It's something to do with adding the shadowJar task, because when I remove it, I can call Minecraft.getInstance(), but I can't get to the classes I need to shadow.

  3. The mod I'm updating to 1.13.2 compiles but throws NoSuchMethodError on the first call to Minecraft.getInstance().

     

    java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft;

     

    I'm running the mod using release 1.13.2-forge-25.0.50.

     

    I'm assuming this is a build issue. My build.gradle is:

    buildscript {
        repositories {
            maven { url = 'https://files.minecraftforge.net/maven' }
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
            classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
        }
    }
    
    apply plugin: 'net.minecraftforge.gradle'
    apply plugin: 'com.github.johnrengelman.shadow'
    
    version = "1.13-2-25.0.50"
    group = "com.shiny.joypadmod"
    archivesBaseName = "JoypadMod"
    
    sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
    
    
    allprojects {
            repositories {
                jcenter()
                maven { url "https://jitpack.io" }
            }
       }
    
    minecraft {
        mappings channel: 'snapshot', version: '20180921-1.13'
    
        runs {
            client {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    joypadmod {
                        source sourceSets.main
                    }
                }
            }
    
            server {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    joypadmod {
                        source sourceSets.main
                    }
                }
            }
        }
    }
    
    dependencies {
        minecraft 'net.minecraftforge:forge:1.13.2-25.0.50'
        implementation 'org.lwjgl.lwjgl:lwjgl:2.+'
        implementation  'com.github.strikerx3:jxinput:0.8'
    }
    
    jar {
        manifest {
            attributes([
                    "Specification-Title": "JoypadMod",
                    "Specification-Vendor": "JoypadMod",
                    "Specification-Version": "1.13-2-25.0.50", // We are version 1 of ourselves
                    "Implementation-Title": project.name,
                    "Implementation-Version": "${version}",
                    "Implementation-Vendor" :"JoypadMod",
                    "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
            ])
        }
    }
    
    shadowJar {
        classifier = ""
        dependencies {
            include dependency("org.lwjgl.lwjgl:lwjgl:2.+")
            include dependency("com.github.strikerx3:jxinput:0.8")
        }
    }
    
    tasks.build.dependsOn shadowJar

    I tried adding reobf to the shadow jar, but the build then fails with a mapping error: "No value has been specified for property 'mappings'." The reobf tasks are as follows:

    reobf {
    	shadowJar {}
    }
    tasks.build.dependsOn reobfShadowJar

     

  4. If you want to, you can create a script and then a bunch of desktop shortcuts that can allow you to switch between mod directories easily.

     

    If you copy the copy below into a file called switchmc.bat and replace YOUR_USER_NAME with your computer's account name, then you can make desktop shortcuts to this file and add the mane of the mods directory to the target property.

     

    E.g. if you save switchmc.bat into C:\ then create a shortcut called swichmc 1.8.9, right click, and then change the target to say C:\switchmc.bat 1.8.9

     

    Now you can put all your 1.8.9  mods in a directory called mods_1.8.9 (in your .minecraft directory). 

     

    It makes it faster to switch between versions of Minecraft. You still need to install forge for each version of minecraft and make a profile for each version.

     

    Let me know if you need any help.

     

    @echo off
    echo Minecraft Mod Directory Switcher 
    
    set MCPATH=C:\Users\YOUR_USER_NAME\AppData\Roaming\.minecraft
    set FILENAME=mods
    set modsDir=%MCPATH%\%FILENAME%
    
    goto :start
    
    REM Error handling labels 
    :noMCVersionArg
    echo ERROR - Missing Minecraft version - e.g. 1.12
    goto :usage
    
    :noTargetModsFound
    echo ERROR - Target mods dir not found: %targetModDir%
    goto :usage
    
    :noModsDirFound
    echo ERROR - Mods dir not found: %modsDir%
    echo       - Create symlink with: mklink /D mods SOME_MOD_DIR
    goto :usage
    
    :usage
    echo USAGE: switchmc VERSION [extention]
    echo        switchmc 1.12.2 -funmods
    goto :end
    
    
    :start
    set ext=""
    if "%1"=="" goto noMCVersionArg
    if "%2"=="" goto setModExtenstion
    
    :setModExtenstion
    set ext=%2
    
    :checkIfModDirIsSymLink
    
    set targetModDir=%MCPATH%\%FILENAME%_%1%ext%
    if not exist %targetModDir% goto :noTargetModsFound
    
    if not exist %modsDir% (
    goto :createSymLink
    )
    
    :checkSymLink
    set SP1=0
    for /f "tokens=4,5 delims= " %%A IN ('dir /L /N %modsDir%*') do (
        if %%B EQU %FILENAME% (
        if "%%A" EQU "<SYMLINKD>" set SP1=1
        )
    )
    
    if %sp1% EQU 0 goto :symFalse
    if %sp1% EQU 1 goto :createSymLink
    
    :symFalse
    echo ERROR - Not switching mods directiry as mods is not a symlink
    echo       - Rename mods dir and create symlink with: mklink /D mods SOME_MOD_DIR
    goto :end
    
    :createSymLink
    echo Switching to mod dir %targetModDir%
    if exist %modsDir% rmdir %modsDir% 
    mklink /D %modsDir% %targetModDir%
    
    goto :end
    
    :end

     

    • Like 1
×
×
  • Create New...

Important Information

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