cabaletta / baritone

google maps for block game
GNU Lesser General Public License v3.0
7.16k stars 1.43k forks source link

The apache logger can't find method info() and crushes the game during initialization (BaritownedDeveloperEnvironment 1.15.x, 1.16.x) #2464

Open DylanWake opened 3 years ago

DylanWake commented 3 years ago

Some information

Operating system: Windows 10 Java version: 15 Minecraft version: Intellij Idea Development Environment 1.15.2 , 1.16.1, 1.16.4 Baritone version: 1.6.1 Forge mods (if used):

Issue description

I've encountered the same exception on all three versions of minecraft, emerges after gradle automatically updated dependencies from repo.spongepowered.org before launching the game, it seems like org.apache.logging.log4j.Logger is missing or modified. ( though i see it get downloaded when executing task :BuildNeeded )

Exception, error or logs

3:22:31 PM: Executing task 'runClient'...

> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:processResources NO-SOURCE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE

> Configure project :
New Dep: com.github.ImpactDevelopment:Vanilla:1.15.2_mapped_snapshot_20200515-1.15.1

> Task :compileApiJava UP-TO-DATE
> Task :processApiResources NO-SOURCE
> Task :apiClasses UP-TO-DATE
> Task :compileSchematica_apiJava UP-TO-DATE
> Task :processSchematica_apiResources NO-SOURCE
> Task :schematica_apiClasses UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :downloadMcpConfig
> Task :extractSrg UP-TO-DATE
> Task :createMcpToObf UP-TO-DATE
> Task :createMcpToSrg UP-TO-DATE

> Task :compileLaunchJava
Potential refmap conflict. Duplicate refmap name mixins.baritone.refmap.json specified for sourceSet launch, already defined for sourceSet launch
ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger
Note: SpongePowered MIXIN Annotation Processor Version=0.8.2
Note: ObfuscationServiceMCP supports type: "searge"
Note: ObfuscationServiceMCP supports type: "notch"
Note: Loading searge mappings from C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\createMcpToSrg\output.srg
Note: Loading notch mappings from C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\createMcpToObf\output.srg
Note: Writing refmap to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\compileLaunchJava-refmap.json
Note: Writing refmap to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\compileLaunchJava-refmap.json
Note: Writing searge output SRGs to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\mcp-srg.srg
Note: Writing notch output SRGs to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\mcp-notch.srg
Note: Writing refmap to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\compileLaunchJava-refmap.json
Note: Writing refmap to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\compileLaunchJava-refmap.json
Note: Writing searge output SRGs to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\mcp-srg.srg
Note: Writing notch output SRGs to C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\build\tmp\compileLaunchJava\mcp-notch.srg
Note: C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\src\launch\java\baritone\launch\BaritoneTweaker.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :processLaunchResources UP-TO-DATE
> Task :launchClasses
> Task :downloadMCMeta UP-TO-DATE
> Task :downloadAssets
> Task :extractNatives UP-TO-DATE
> Task :prepareRuns
> Task :prepareRunClient

> Task :runClient
LOGGING IN: ----------------------------------
[15:22:36] [main/INFO]: Logging in with username & password
----------- LaunchInfo -----------
userProperties :: [{"name":"preferredLanguage","value":"zh-cn"},{"name":"registrationCountry","value":"HK"}] 
assetsDir :: C:\Users\10200\.gradle\caches\forge_gradle\assets 
assetIndex :: 1.15 
userType :: mojang 
accessToken :: <Access Token> 
version :: 1.16 
uuid :: <uuid>
tweakClass :: baritone.launch.BaritoneTweaker 
username :: KiteJencien 
----------------------------------
[15:22:38] [main/INFO]: Loading tweak class name baritone.launch.BaritoneTweaker
[15:22:38] [main/INFO]: Using primary tweak class name baritone.launch.BaritoneTweaker
[15:22:38] [main/INFO]: Calling tweak class baritone.launch.BaritoneTweaker
[15:22:38] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/C:/Users/10200/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.2/1cf212283d26f706fd3074318870bebd14d2a9ed/mixin-0.8.2.jar Service=LaunchWrapper Env=UNKNOWN
[15:22:38] [main/INFO]: FML platform manager could not load class cpw.mods.fml.relauncher.CoreModManager. Proceeding without FML support.
[15:22:38] [main/INFO]: Compatibility level set to JAVA_8
[15:22:38] [main/ERROR]: Mixin config mixins.baritone.json does not specify "minVersion" property
[15:22:38] [main/INFO]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker
[15:22:38] [main/INFO]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker
[15:22:38] [main/WARN]: Reference map 'mixins.baritone.refmap.json' for mixins.baritone.json could not be read. If this is a development environment you can ignore this message
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinBitArray, name: baritone.launch.mixins.MixinBitArray
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinChunkArray, name: baritone.launch.mixins.MixinChunkArray
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinClientChunkProvider, name: baritone.launch.mixins.MixinClientChunkProvider
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinClientPlayerEntity, name: baritone.launch.mixins.MixinClientPlayerEntity
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinClientPlayNetHandler, name: baritone.launch.mixins.MixinClientPlayNetHandler
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinCommandSuggestionHelper, name: baritone.launch.mixins.MixinCommandSuggestionHelper
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinEntity, name: baritone.launch.mixins.MixinEntity
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinEntityRenderManager, name: baritone.launch.mixins.MixinEntityRenderManager
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinItemStack, name: baritone.launch.mixins.MixinItemStack
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinLivingEntity, name: baritone.launch.mixins.MixinLivingEntity
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinLootContext, name: baritone.launch.mixins.MixinLootContext
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinMinecraft, name: baritone.launch.mixins.MixinMinecraft
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinNetworkManager, name: baritone.launch.mixins.MixinNetworkManager
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinPalettedContainer, name: baritone.launch.mixins.MixinPalettedContainer
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinPlayerController, name: baritone.launch.mixins.MixinPlayerController
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinScreen, name: baritone.launch.mixins.MixinScreen
[15:22:38] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinWorldRenderer, name: baritone.launch.mixins.MixinWorldRenderer
[15:22:39] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}
---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 2/11/21 3:22 PM
Description: Initializing game

java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:343)
    at net.minecraft.client.main.Main.main(Main.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at baritone.launch.LaunchTesting.main(LaunchTesting.java:72)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:343)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.main.Main.main(Main.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at baritone.launch.LaunchTesting.main(LaunchTesting.java:72)

-- System Details --
Details:
    Minecraft Version: 1.15.2
    Minecraft Version ID: 1.15.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_241, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 299050280 bytes (285 MB) / 358088704 bytes (341 MB) up to 7628390400 bytes (7275 MB)
    CPUs: 8
    JVM Flags: 0 total; 
    Launched Version: 1.16
    Backend library: LWJGL version 3.2.2 build 10
    Backend API: NO CONTEXT
    GL Caps: 
    Using VBOs: Yes
    Is Modded: Very likely; Jar signature invalidated
    Type: Client (map_client.txt)
    CPU: <unknown>
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\10200\Desktop\MyJavaProjects\baritone-1.15.2 (1)\baritone-1.15.2\run\.\crash-reports\crash-2021-02-11_15.22.40-client.txt

> Task :runClient FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runClient'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_241\bin\java.exe'' finished with non-zero exit value -1

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 9s
13 actionable tasks: 4 executed, 9 up-to-date
3:22:40 PM: Task execution finished 'runClient'.

How to reproduce

1: Build the project with build.gradle 2: build : "buildDependencies" & "buildNeeded" 3: build : “run client”

Final checklist

DylanWake commented 3 years ago

the class for launchTesting.java //i did a little modification to allow login with mojang accounts

/**
 * Based on GradleStart from ForgeGradle 2.3
 *
 * @author Brady
 * @since 3/11/2019
 */
public class LaunchTesting {

    public static void main(String[] args) {
        Map<String, String> arguments = new HashMap<>();

        hackNatives();
        arguments.put("version", "1.16");
        arguments.put("assetIndex", System.getenv("assetIndex"));
        arguments.put("assetsDir", System.getenv().getOrDefault("assetDirectory", "assets"));
        arguments.put("accessToken", "FML");
        arguments.put("userProperties", "{}");
        arguments.put("tweakClass", System.getenv("tweakClass"));
        attemptLogin(arguments, "<username>", "<password>");
        //arguments.put("username","KJBot");

        List<String> argsArray = new ArrayList<>();

        System.out.println("----------- LaunchInfo -----------");

        arguments.forEach((k, v) -> {
            System.out.printf("%s :: %s \n",k,v);
            argsArray.add("--" + k);
            argsArray.add(v);
        });

        System.out.println("----------------------------------");

        Launch.main(argsArray.toArray(new String[0]));
    }

    private static void hackNatives() {
        String paths = System.getProperty("java.library.path");
        String nativesDir = System.getenv().get("nativesDirectory");

        if (Strings.isNullOrEmpty(paths))
            paths = nativesDir;
        else
            paths += File.pathSeparator + nativesDir;

        System.setProperty("java.library.path", paths);

        // hack the classloader now.
        try {
            final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
            sysPathsField.setAccessible(true);
            sysPathsField.set(null, null);
        } catch (Throwable ignored) {}
    }

    private static void attemptLogin(Map<String, String> argMap, String username, String password) {
        System.out.println("LOGGING IN: ----------------------------------");

        YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) (new YggdrasilAuthenticationService(Proxy.NO_PROXY, "1")).createUserAuthentication(Agent.MINECRAFT);
        auth.setUsername(username);
        auth.setPassword(password);

        try {
            auth.logIn();
        } catch (AuthenticationException var4) {
            var4.printStackTrace();
            throw new RuntimeException(var4);
        }

        argMap.put("accessToken", auth.getAuthenticatedToken());
        argMap.put("uuid", auth.getSelectedProfile().getId().toString().replace("-", ""));
        argMap.put("username", auth.getSelectedProfile().getName());
        argMap.put("userType", auth.getUserType().getName());
        argMap.put("userProperties", (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(auth.getUserProperties()));
    }
}
scorbett123 commented 3 years ago

Does it work whilst using a non modified launchTesting.java?

scorbett123 commented 3 years ago

No actually I am now experiencing this @l1ving have sponge changed their repos again?

DylanWake commented 3 years ago

Yes since I have sponge not working and I manually updated the link in the maven of build.gradle My version:

epositories {
    mavenCentral()

    maven {
        name = 'spongepowered-repo'
        url = 'https://repo.spongepowered.org/maven/'
    }

    maven {
        name = 'impactdevelopment-repo'
        url = 'https://impactdevelopment.github.io/maven/'
    }
}

it did correctly downloaded needed dependencies, but since then I have the exception described

DylanWake commented 3 years ago

no, I also tried the default LaunchTesting.java , and even cloning and rebuilding the project do no help

DylanWake commented 3 years ago

Log for 1.16.4 project :runClient I just build without any modifications in code or gradle settings :

[11:55:14] [main/ERROR]: Classloader restrictions [PACKAGE_CLASSLOADER_EXCLUSION] encountered loading mixins.baritone.json:MixinWorldRenderer, name: baritone.launch.mixins.MixinWorldRenderer
[11:55:14] [main/WARN]: Error loading class: me/jellysquid/mods/sodium/client/world/SodiumChunkManager (java.lang.ClassNotFoundException: The specified class 'me.jellysquid.mods.sodium.client.world.SodiumChunkManager' was not found)
[11:55:14] [main/WARN]: Error loading class: me/jellysquid/mods/sodium/client/util/collections/FixedLongHashTable (java.lang.ClassNotFoundException: The specified class 'me.jellysquid.mods.sodium.client.util.collections.FixedLongHashTable' was not found)
[11:55:14] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[11:55:19] [Render thread/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[11:55:22] [Render thread/ERROR]: Failed to verify authentication
com.mojang.authlib.exceptions.AuthenticationUnavailableException
    at com.mojang.authlib.yggdrasil.YggdrasilSocialInteractionsService.checkPrivileges(YggdrasilSocialInteractionsService.java:97) ~[YggdrasilSocialInteractionsService.class:?]
    at com.mojang.authlib.yggdrasil.YggdrasilSocialInteractionsService.<init>(YggdrasilSocialInteractionsService.java:40) ~[YggdrasilSocialInteractionsService.class:?]
    at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.createSocialInteractionsService(YggdrasilAuthenticationService.java:152) ~[YggdrasilAuthenticationService.class:?]
    at net.minecraft.client.Minecraft.func_244735_a(Minecraft.java:552) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:387) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:149) [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 baritone.launch.LaunchTesting.main(LaunchTesting.java:66) [launch/:?]
---- Minecraft Crash Report ----
// Why did you do that?

Time: 2/12/21 11:55 AM
Description: Initializing game

java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:389)
    at net.minecraft.client.main.Main.main(Main.java:149)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at baritone.launch.LaunchTesting.main(LaunchTesting.java:66)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
ScottBot10 commented 3 years ago

I also get this error. Did you find out how to fix it?

ZacSharp commented 2 years ago

When I searched for the error I found that it seems to be some versions of log4j not behaving how they should and tried adding a random log4j version by adding runtime launchCompile('org.apache.logging.log4j:log4j-core:2.8') to the dependencies in the buildscript, which apparently made it work. Tested on 1.13.2, 1.14.4, 1.15.2 and 1.16.5