#100kb to 1kb

80 messages · Page 1 of 1 (latest)

tired smelt
#

when i run ./gradlew clean shadowJar it builds the mod and becomes 100kb, but then after i run ./gradlew remapJar it goes down to 1kb can someone please help me
heres my build.grandle
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

archives_base_name = 'Sterns-Lock-Off-Client'
version = '1.0.0'
group = 'net.stern.tutorialmod'

repositories {
mavenCentral()
maven { url = "https://maven.fabricmc.net/" }
}

dependencies {
minecraft "com.mojang:minecraft:1.21.1"
mappings "net.fabricmc🧶1.21.1+build.3:v2"
modImplementation "net.fabricmc:fabric-loader:0.16.14"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.116.3+1.21.1"
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
    expand "version": inputs.properties.version
}

}

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
inputs.property "archivesName", project.archives_base_name

from("LICENSE") {
    rename { "${it}_${inputs.properties.archivesName}" }
}

}

distant umbra
#

what exactly are you trying to do

#

are you trying to build the mod normally or something else

tired smelt
#

like what my mod is ttrying to do?

distant umbra
#

no

#

are you trying to build your mod normally

#

like get a working normal jar

tired smelt
#

yeah i guess

distant umbra
#

okay then use the gradle build task

#

it's just build

#

not remapjar or clean shadow jar

#

running build will give you a jar you can use to distribute your mod

tired smelt
#

when i build it is 13 kb and way too small

distant umbra
#

have you actually tested your mod

#

with the jar you created

tired smelt
#

a while ago but it crashed

#

and it crashed again just now

distant umbra
#

what jar are you using

#

show a picture of the directory

tired smelt
#

should i try it without other mods

distant umbra
#

well do you have the crash log

tired smelt
#

yea

distant umbra
#

Caused by: net.fabricmc.loader.api.LanguageAdapterException: java.lang.ClassNotFoundException: net.stern.tutorialmod.DiscordWebhookNotifier

toxic halo
toxic halo
tired smelt
#

do i need shadow plugin for that?

toxic halo
#

Sometimes, depend from library you might need more than one include. But we not use shadow for that

tired smelt
toxic halo
#

Ye

#

But in my case its Kotlin Gradle

tired smelt
#

how should i format it

tired smelt
#

include 'com.squareup.okhttp3:okhttp:4.12.0'

toxic halo
#

Ye

#

Then you need monitor by logs is there any ClassNotFound issue after make release jar and use it out of IDEA

tired smelt
#

Could not get unknown property 'archives_basename' for root project 'Sterns Lock Off Client' of type org.gradle.api.Project.

toxic halo
#

it means that line is incorrect archives_base_name = 'Sterns-Lock-Off-Client'

#

Did GPT gen it or?

tired smelt
#

uh yeah

toxic halo
#

Here official template

#

GPT sucks in most cases

tired smelt
#

oh wait no i got it from the oifficial fabric template i just asked gpt how to change stuff

toxic halo
#
base {
    archivesName = project.archives_base_name // (or just hardcode name)
}
tired smelt
#

ok so should i build it from there

toxic halo
#

try

tired smelt
#

it made me upgrade grandle to 8.12

#

now i get this error

#

Configure project :
Fabric Loom: 1.10.5

Task :compileJava
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\TutorialMod.java:4: error: package net.fabricmc.fabric.api.client.networking.v1 does not exist
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
^
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\TutorialMod.java:5: error: package net.minecraft.client does not exist
import net.minecraft.client.MinecraftClient;
^
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\WebhookSender.java:9: error: cannot find symbol
private static final OkHttpClient client = new OkHttpClient();
^
symbol: class OkHttpClient
location: class WebhookSender
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\WebhookSender.java:3: error: package okhttp3 does not exist
import okhttp3.*;
^
4 errors

Task :compileJava FAILED

[Incubating] Problems report is available at: file:///C:/Users/ebene/Downloads/Sterns%20Lock%20Off%20Client/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileJava'.
toxic halo
tired smelt
#

Build file 'C:\Users\ebene\Downloads\Sterns Lock Off Client\build.gradle' line: 45

A problem occurred evaluating root project 'Sterns Lock Off Client'.

Could not get unknown property 'archives_basename' for root project 'Sterns Lock Off Client' of type org.gradle.api.Project.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

#

thats what happened when i synced it

#

i updated it to loom 1.10-snapshot in the plugins
plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'maven-publish'
}

toxic halo
#

and wrap it into codeblocks

#

```gradle
code here
```

tired smelt
#

it works now

#

749 kb

#
    id 'fabric-loom' version '1.10-SNAPSHOT'
    id 'maven-publish'
}

base {
    archivesName = "Sterns-Lock-Off-Client"
}


version = '1.0.0'
group = 'net.stern.tutorialmod'

repositories {
    mavenCentral()
    maven { url = "https://maven.fabricmc.net/" }
    maven { url = "https://maven.quiltmc.org/repository/snapshot/" }
}

dependencies {
    minecraft "com.mojang:minecraft:1.21.1"
    mappings "net.fabricmc:yarn:1.21.1+build.3:v2"
    modImplementation "net.fabricmc:fabric-loader:0.16.14"
    modImplementation "net.fabricmc.fabric-api:fabric-api:0.116.3+1.21.1"
    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
    include 'com.squareup.okhttp3:okhttp:4.12.0'
}


processResources {
    inputs.property "version", project.version

    filesMatching("fabric.mod.json") {
        expand "version": inputs.properties.version
    }
}

tasks.withType(JavaCompile).configureEach {
    it.options.release = 21
}

java {
    withSourcesJar()
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

jar {
    inputs.property "archivesName", project.archives_base_name

    from("LICENSE") {
        rename { "${it}${inputs.properties.archivesName}" }
    }
}```
#

i dont think the mod is going to work

toxic halo
tired smelt
#

it crashes ever6ytime i join a server

toxic halo
#

Logs

tired smelt
toxic halo
#

Caused by: java.lang.ClassNotFoundException: okio.Buffer

#

Now you need research with package provide okio.Buffer and include it too

#

Thats why I reccomend use build in HttpClient if not making something complicated

tired smelt
#

include 'com.squareup.okio:okio:3.9.0'

#

like that?

#

do i also need to use implementation

toxic halo
#

it's implemented by okhttp

#

but incude not make recursive so you neeed attach required for your task deps manually

toxic halo
#

Not sure

#

I didn't use OkHttp for 7 years

tired smelt
# toxic halo I didn't use OkHttp for 7 years

i added htis loom block
loom {
splitEnvironmentSourceSets()
mods {
"tutorialmod" {
sourceSet sourceSets.main
}
}

jar {
    from {
        configurations.runtimeClasspath.filter { it.name.endsWith(".jar") }.collect { zipTree(it) }
    }
}

}

but when i run it i get this error Compilation failed; see the compiler output below.
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\TutorialMod.java:4: error: package net.fabricmc.fabric.api.client.networking.v1 does not exist
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
^
C:\Users\ebene\Downloads\Sterns Lock Off Client\src\main\java\net\stern\tutorialmod\TutorialMod.java:5: error: package net.minecraft.client does not exist
import net.minecraft.client.MinecraftClient;
^
2 errors

  • Try:

Check your code and dependencies to fix the compilation error(s)
Run with --scan to get full insights.

toxic halo
#

I'm not familiar with loom