Waystones (Fabric Edition)

Waystones (Fabric Edition)

3M Downloads

[1.16.x bug(?)] Will not build from source, crashes at runtime with multiple NoSuchMethodErrors if forced to do so

jaimemccann opened this issue ยท 1 comments

commented

Overview

I tried to build this mod from source. It would not build, and after making some adjustments to force it to build, it would not run.

The modifications I wanted to make to the mod are documented in issue #312 ; however, the bug I'm reporting here occurs even without such modifications, with exactly the same presentation.

Please advise on how to get this build to work. Am I doing something wrong here?

Platform

OS: Debian Buster amd64
Gradle: 4.9 (via gradlew)
Java: OpenJDK 11
Minecraft: 1.16.3
Forge: 34.1.35

Steps to reproduce build failure

git clone https://github.com/blay09/Waystones
cd Waystones
git branch # shows 1.16.x
./gradlew build --stacktrace

Result:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jaime/Builds/Waystones/build.gradle' line: 98

* What went wrong:
A problem occurred evaluating root project 'Waystones'.
> /home/jaime/.gradle/daemon/4.9/run/obfmods

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'Waystones'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:204)
    [...]
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.io.FileNotFoundException: /home/jaime/.gradle/daemon/4.9/run/obfmods
    at build_5tfaqiqvds7g6qw2h7simwwhj$_run_closure4.doCall(/home/jaime/Builds/Waystones/build.gradle:98)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [...]
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
    ... 99 more

Part of build.gradle that causes this error, starting at line 89 as per the error message:

def obfModsDir = new File("run/obfmods")
obfModsDir.eachFile { file ->
    def parts = file.name.split('-', 2)
    def dep = "ignored:" + parts[0] + ":" + parts[1].replace(".jar", "");
    runtimeOnly fg.deobf(dep)
}

Bizarrely, this error occurs even if the file run/obfmods exists (in my case /home/jaime/.gradle/daemon/4.9/run/obfmods). Having it be a directory also does not help.

Steps to reproduce runtime failure

I tried commenting out the offending code concerning obfModsDir:

/*def obfModsDir = new File("run/obfmods")
obfModsDir.eachFile { file ->
    def parts = file.name.split('-', 2)
    def dep = "ignored:" + parts[0] + ":" + parts[1].replace(".jar", "");
    runtimeOnly fg.deobf(dep)
}*/

This allowed the mod to build without errors. I then loaded it in Forge and got the following runtime errors:

java.lang.NoSuchMethodError: 'net.minecraft.util.math.shapes.VoxelShape net.blay09.mods.waystones.block.WaystoneBlock.makeCuboidShape(double, double, double, double, double, double)'
    at net.blay09.mods.waystones.block.WaystoneBlock.<clinit>(WaystoneBlock.java:45) ~[waystones:7.3.0] {re:classloading}

java.lang.NoSuchMethodError: 'net.minecraft.item.Item$Properties net.minecraft.item.Item$Properties.group(net.minecraft.item.ItemGroup)'
    at net.blay09.mods.waystones.item.BoundScrollItem.<init>(BoundScrollItem.java:40) ~[waystones:7.3.0] {re:classloading}

java.lang.NoSuchMethodError: 'net.minecraft.tileentity.TileEntityType$Builder net.minecraft.tileentity.TileEntityType$Builder.create(java.util.function.Supplier, net.minecraft.block.Block[])'
    at net.blay09.mods.waystones.tileentity.ModTileEntities.build(ModTileEntities.java:25) ~[waystones:7.3.0] {re:classloading}

java.lang.NoSuchFieldError: CODEC
    at net.blay09.mods.waystones.worldgen.ModWorldGen.registerPlacements(ModWorldGen.java:61) ~[waystones:7.3.0] {re:classloading}

java.lang.NoSuchMethodError: 'net.minecraft.block.BlockState net.minecraft.block.Block.getDefaultState()'
    at net.blay09.mods.waystones.worldgen.ModWorldGen.registerFeatures(ModWorldGen.java:40) ~[waystones:7.3.0] {re:classloading}
commented

The obfmods folder should be changed to be optional in the build.gradle to avoid erroring if it doesn't exist, but I don't think it's the cause of the problem here, since there aren't any dependencies inside that folder.

However, according to the log in #314 it looks like ModMaven is down and apparently Gradle doesn't like that, so try removing the ModMaven repository from the build.gradle.