Jump to content

Recommended Posts

Posted (edited)

Hello. I am trying to use a gradle librarie in my mod. But when I use "gradlew build" it doesn't compile my librarie and in-game it shows me an error (classnotfoundexception).

How can I do that? Thanks

Edited by Tatuck
Posted

I have tried but for some reason Minecraft doesn't detect the compiled mod. I don't think it is giving me an error because I have checked the logs but I found nothing.

Posted

My build.gradle: 

buildscript {
    repositories {
        maven { url = 'https://files.minecraftforge.net/maven' }
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
    }
}

plugins {
    id 'com.github.johnrengelman.shadow' version '6.1.0'
}

apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0'
group = 'com.tatuck.coordinateslocator' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'tatuckcoordslocator'

java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {

    mappings channel: 'official', version: '1.16.5'

    runs {
        client {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run/server')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
            setForceExit(false)
        }


        data {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }
    }
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }



dependencies {
    minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'
    compile 'org.mongodb:mongodb-driver-sync:4.2.3'
    shadow 'org.mongodb:mongodb-driver-sync:4.2.3'
    shadow 'org.mongodb:bson:4.2.3'


    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
    manifest {
        attributes([
                "Specification-Title": "examplemod",
                "Specification-Vendor": "examplemodsareus",
                "Specification-Version": "1", // We are version 1 of ourselves
                "Implementation-Title": project.name,
                "Implementation-Version": "${version}",
                "Implementation-Vendor" :"examplemodsareus",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact jar
        }
    }
    repositories {
        maven {
            url "file:///${project.projectDir}/mcmodsrepo"
        }
    }
}

shadowJar {
    configurations = [project.configurations.shadow]
}
reobf {
    shadowJar {}
}

 

Update: 

I have tried again and now it is showing me this error:

Description: mouseClicked event handler

java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getInstance()Lnet/minecraft/client/Minecraft;
	at com.tatuck.coordinateslocator.TatuckCoordinatesLocator.onSound(TatuckCoordinatesLocator.java:43) ~[?:1.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_0_TatuckCoordinatesLocator_onSound_PlaySoundEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus$$Lambda$2544/1439945495.invoke(Unknown Source) ~[?:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.client.ForgeHooksClient.playSound(ForgeHooksClient.java:282) ~[?:?] {re:classloading}
	at net.minecraft.client.audio.SoundEngine.func_148611_c(SoundEngine.java:271) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.audio.SoundHandler.func_147682_a(SoundHandler.java:136) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.func_230988_a_(Widget.java:198) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.func_231044_a_(Widget.java:135) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.func_231044_a_(SourceFile:27) ~[?:?] {re:classloading}
	at net.minecraft.client.gui.screen.MainMenuScreen.func_231044_a_(MainMenuScreen.java:288) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_198033_b(MouseHelper.java:87) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper$$Lambda$3917/1046211253.run(Unknown Source) ~[?:?] {}
	at net.minecraft.client.gui.screen.Screen.func_231153_a_(Screen.java:427) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_198023_a(MouseHelper.java:85) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.func_228030_c_(MouseHelper.java:175) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper$$Lambda$3916/2087758561.run(Unknown Source) ~[?:?] {}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(SourceFile:94) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.func_228028_b_(MouseHelper.java:174) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper$$Lambda$3530/1682774881.invoke(Unknown Source) ~[?:?] {}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(SourceFile:127) ~[?:?] {re:classloading}
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:999) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.5-36.1.0.jar:36.1] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$438/1260043537.call(Unknown Source) [forge-1.16.5-36.1.0.jar:36.1] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}

 

  • Tatuck changed the title to [SOLVED] How can I import an external librarie?

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yes that’s the full log, I managed to get it working last night, the anvil fix mod is what was causing it to crash
    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
  • Topics

×
×
  • Create New...

Important Information

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