Baritone in forge: java.lang.NoSuchFieldError: gameDir
reticivis-net opened this issue · 13 comments
What do you need help with?
Error log:
java.lang.NoSuchFieldError: gameDir
at baritone.api.utils.SettingsUtil.<clinit>(SettingsUtil.java:50) ~[SettingsUtil.class:1.2.13]
at baritone.api.BaritoneAPI.<clinit>(BaritoneAPI.java:38) ~[BaritoneAPI.class:1.2.13]
at com.example.examplemod.ExampleMod.onKeyInput(ExampleMod.java:63) ~[ExampleMod.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ExampleMod_onKeyInput_KeyInputEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:565) [FMLCommonHandler.class:?]
at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2143) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1934) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1187) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
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:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:25) [start/:?]
my code:
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (gokey.isPressed()) {
// ---- MOD KEY IS PRESSED MAIN CODE HERE ----
LOGGER.info("starting plugin code");
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
}
}
the game crashes as soon as i hit the binded key
Final checklist
- I know how to properly use check boxes
- I have not used any OwO's or UwU's in this issue.
this is my build.gradle file. mind you, this hasnt been edited since presumably around when this issue was raised so its over a year old.
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
group 'baritone'
version '1.2.13'
buildscript {
repositories {
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
jcenter()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = "UTF-8" // allow emoji in comments :^)
}
sourceSets {
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
schematica_api {
compileClasspath += main.compileClasspath
}
main {
compileClasspath += schematica_api.output
}
}
minecraft {
version = '1.12.2'
mappings = 'stable_39'
tweakClass = 'baritone.launch.BaritoneTweaker'
runDir = 'run'
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
makeObfSourceJar = false
}
repositories {
mavenCentral()
maven {
name = 'spongepowered-repo'
url = 'http://repo.spongepowered.org/maven/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
}
dependencies {
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2')
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
testImplementation 'junit:junit:4.12'
}
mixin {
defaultObfuscationEnv searge
add sourceSets.launch, 'mixins.baritone.refmap.json'
}
javadoc {
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
options.linkSource true
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}
jar {
from sourceSets.launch.output, sourceSets.api.output
preserveFileTimestamps = false
reproducibleFileOrder = true
manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json',
'Implementation-Title': 'Baritone',
'Implementation-Version': version
)
}
}
task proguard(type: ProguardTask) {
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
extract 'proguard6.0.3/lib/proguard.jar'
}
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
this is my build.gradle file. mind you, this hasnt been edited since presumably around when this issue was raised so its over a year old.
/* * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see <https://www.gnu.org/licenses/>. */ group 'baritone' version '1.2.13' buildscript { repositories { maven { name = 'forge' url = 'http://files.minecraftforge.net/maven' } maven { name = 'SpongePowered' url = 'http://repo.spongepowered.org/maven' } jcenter() } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' } } import baritone.gradle.task.CreateDistTask import baritone.gradle.task.ProguardTask apply plugin: 'java' apply plugin: 'net.minecraftforge.gradle.tweaker-client' apply plugin: 'org.spongepowered.mixin' sourceCompatibility = targetCompatibility = '1.8' compileJava { sourceCompatibility = targetCompatibility = '1.8' options.encoding = "UTF-8" // allow emoji in comments :^) } sourceSets { launch { compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output } schematica_api { compileClasspath += main.compileClasspath } main { compileClasspath += schematica_api.output } } minecraft { version = '1.12.2' mappings = 'stable_39' tweakClass = 'baritone.launch.BaritoneTweaker' runDir = 'run' // The sources jar should use SRG names not MCP to ensure compatibility with all mappings makeObfSourceJar = false } repositories { mavenCentral() maven { name = 'spongepowered-repo' url = 'http://repo.spongepowered.org/maven/' } maven { name = 'impactdevelopment-repo' url = 'https://impactdevelopment.github.io/maven/' } } dependencies { runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2') runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') { // Mixin includes a lot of dependencies that are too up-to-date exclude module: 'launchwrapper' exclude module: 'guava' exclude module: 'gson' exclude module: 'commons-io' exclude module: 'log4j-core' } testImplementation 'junit:junit:4.12' } mixin { defaultObfuscationEnv searge add sourceSets.launch, 'mixins.baritone.refmap.json' } javadoc { options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error options.linkSource true options.encoding "UTF-8" // allow emoji in comments :^) source = sourceSets.api.allJava classpath += sourceSets.api.compileClasspath } jar { from sourceSets.launch.output, sourceSets.api.output preserveFileTimestamps = false reproducibleFileOrder = true manifest { attributes( 'MixinConfigs': 'mixins.baritone.json', 'Implementation-Title': 'Baritone', 'Implementation-Version': version ) } } task proguard(type: ProguardTask) { url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip' extract 'proguard6.0.3/lib/proguard.jar' } task createDist(type: CreateDistTask, dependsOn: proguard) build.finalizedBy(createDist)
Try pulling new changes into your branch, there has been some changes which mean that you wouldn't be able to build anyway.
Sorry about this, someone dmed me on discord asking for help about this issue and my dumb brain sent the code here instead of to discord lol
This is a user problem as you’re using different mappings. Hence the missing gameDir field.
Are the mappings a problem with my build of baritone or the forge environment? And how exactly would i change the mappings?
I think baritone’s mapping was something like “stable_39” and I was able to change forge to use it
You’re still running an obfuscated version against the obfuscated jar..?