Bstn1802 / AutoReconnect

Minecraft fabric mod which automatically reconnects the client to the last known server after disconnection
https://www.curseforge.com/minecraft/mc-mods/autoreconnect
GNU Lesser General Public License v3.0
29 stars 36 forks source link

Update to 1.20 #49

Closed EnderKill98 closed 1 year ago

EnderKill98 commented 1 year ago

Updates the mod to 1.20. Applied some recommendations and fixed a crash caused by changes as well.

See commits for more.

TheUnknownCod3r commented 1 year ago

Can confirm seems to work fine, Im currently using it on 1.20 with the compiled changes, and no issues. I've tested on a few server restarts, and manual restarts and all seems to run fine.

xanulus commented 1 year ago

Crashed to desktop after server crashed.

The game crashed whilst unexpected error Error: java.lang.ClassCastException: class net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 (net.minecraft.class_7842 and net.minecraft.class_4185 are in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @62e136d3)

crash-2023-06-19_13.08.21-client.txt

AndyIsHereBoi commented 1 year ago

@EnderKill98 I am also getting this error crashing the game. (Same as above) crash-2023-06-20_10.28.01-client.txt

EnderKill98 commented 1 year ago

That is the original error. It should not be possible anymore as I never blindly cast elements to Buttons anymore.

net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 means TextWidget cannot be cast to ButtonWidget which was the issue I fixed (caused by unchecked (ButtonWidget) someelement casts).

Here is a hand tool which can show you the names for the mapped ones: https://wagyourtail.xyz/Projects/MinecraftMappingViewer/App?version=1.20&mapping=YARN&search=class_7842

AndyIsHereBoi commented 1 year ago

That is the original error. It should not be possible anymore as I never blindly cast elements to Buttons anymore.

net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 means TextWidget cannot be cast to ButtonWidget which was the issue I fixed (caused by unchecked (ButtonWidget) someelement casts).

Here is a hand tool which can show you the names for the mapped ones: https://wagyourtail.xyz/Projects/MinecraftMappingViewer/App?version=1.20&mapping=YARN&search=class_7842

Check my crash log, I was using the build you put 3 comments before this one. The error may not be the exact same but it looked similar at first glance and I haven't launched my game with the mod to check if it was the same.

TheUnknownCod3r commented 1 year ago

That is the original error. It should not be possible anymore as I never blindly cast elements to Buttons anymore. net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 means TextWidget cannot be cast to ButtonWidget which was the issue I fixed (caused by unchecked (ButtonWidget) someelement casts). Here is a hand tool which can show you the names for the mapped ones: https://wagyourtail.xyz/Projects/MinecraftMappingViewer/App?version=1.20&mapping=YARN&search=class_7842

Check my crash log, I was using the build you put 3 comments before this one. The error may not be the exact same but it looked similar at first glance and I haven't launched my game with the mod to check if it was the same.

So I did some testing after the first crash report posted, I can't recreate the issue with my side, reconnecting works fine, I did 30 reconnect attempts to my personal server on restarts and no issues.

EnderKill98 commented 1 year ago

That is the original error. It should not be possible anymore as I never blindly cast elements to Buttons anymore. net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 means TextWidget cannot be cast to ButtonWidget which was the issue I fixed (caused by unchecked (ButtonWidget) someelement casts). Here is a hand tool which can show you the names for the mapped ones: https://wagyourtail.xyz/Projects/MinecraftMappingViewer/App?version=1.20&mapping=YARN&search=class_7842

Check my crash log, I was using the build you put 3 comments before this one. The error may not be the exact same but it looked similar at first glance and I haven't launched my game with the mod to check if it was the same.

Just looked at the version in the crash report. I think you used the prebuilt version from #46 (AutoReconnect 3.0.0-beta) and mistook it as a build of this PR.

I have not looked at it extensively but I'll assume that in that PR the 1.19.4 build had it's sourced bumped to 1.20 and the compilation errors fixed. I did the same initially and then ran in the same crash you got whenever the crash screen appeared.

I did fix that here, but I'm assuming the build you used (from #46) is NOT created from this PR which makes reporting the crash here not have any sense. These PRs are not related otherwise from having mentioned each other.

Here is the version I built and am currently using which is based on this PR: autoreconnect-2.1.0-beta.jar.zip

That crash should not be happening with it.

Bstn1802 commented 1 year ago

Hey, quick response from me. First of all, thanks for the work you all put in here. I've been quite busy and couldn't even look into this pr yet. I hope I can do that soon and I think I'll just merge and make a release as long as I don't find any major issues, just to provide something that works. Last time I got stuck with a minor issue and didn't have the time to fix it... I should be able to put in more work myself in the upcoming months tho, I hope.

HyCore commented 1 year ago

That is the original error. It should not be possible anymore as I never blindly cast elements to Buttons anymore. net.minecraft.class_7842 cannot be cast to class net.minecraft.class_4185 means TextWidget cannot be cast to ButtonWidget which was the issue I fixed (caused by unchecked (ButtonWidget) someelement casts). Here is a hand tool which can show you the names for the mapped ones: wagyourtail.xyz/Projects/MinecraftMappingViewer/App?version=1.20&mapping=YARN&search=class_7842

Check my crash log, I was using the build you put 3 comments before this one. The error may not be the exact same but it looked similar at first glance and I haven't launched my game with the mod to check if it was the same.

Just looked at the version in the crash report. I think you used the prebuilt version from #46 (AutoReconnect 3.0.0-beta) and mistook it as a build of this PR.

I have not looked at it extensively but I'll assume that in that PR the 1.19.4 build had it's sourced bumped to 1.20 and the compilation errors fixed. I did the same initially and then ran in the same crash you got whenever the crash screen appeared.

I did fix that here, but I'm assuming the build you used (from #46) is NOT created from this PR which makes reporting the crash here not have any sense. These PRs are not related otherwise from having mentioned each other.

Here is the version I built and am currently using which is based on this PR: autoreconnect-2.1.0-beta.jar.zip

That crash should not be happening with it.

it does work pretty well for the 1.20 indeed but somehow, like all the previous version, when you use it along side with MultiMC it will crash when trying to reconnect as there is somehow "no reconnect Strategy".

[13:26:54] [Render thread/ERROR]: Unreported exception thrown!
java.lang.NullPointerException: Cannot invoke "autoreconnect.reconnect.ReconnectStrategy.nextAttempt()" because "this.reconnectStrategy" is null
    at autoreconnect.AutoReconnect.startCountdown(AutoReconnect.java:71) ~[autoreconnect-2.1.0-beta.jar:?]
    at net.minecraft.class_419.handler$zzn001$autoreconnect$constructor(class_419.java:1037) ~[client-intermediary.jar:?]
    at net.minecraft.class_419.<init>(class_419.java:24) ~[client-intermediary.jar:?]
    at net.minecraft.class_634.method_10839(class_634.java:834) ~[client-intermediary.jar:?]
    at net.minecraft.class_2535.method_10768(class_2535.java:450) ~[client-intermediary.jar:?]
    at net.minecraft.class_636.method_2927(class_636.java:296) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1574(class_310.java:1853) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1181) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:234) ~[NewLaunch.jar:?]
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:269) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
[13:26:55] [Render thread/INFO]: emissive suffixes loaded: {_e}
[13:26:55] [Render thread/INFO]: [FastQuit] Exiting FastQuit.
---- Minecraft Crash Report ----
// There are four lights!

Time: 2023-07-03 13:26:55
Description: Unexpected error

java.lang.NullPointerException: Cannot invoke "autoreconnect.reconnect.ReconnectStrategy.nextAttempt()" because "this.reconnectStrategy" is null
    at autoreconnect.AutoReconnect.startCountdown(AutoReconnect.java:71)
    at net.minecraft.class_419.handler$zzn001$autoreconnect$constructor(class_419.java:1037)
    at net.minecraft.class_419.<init>(class_419.java:24)
    at net.minecraft.class_634.method_10839(class_634.java:834)
    at net.minecraft.class_2535.method_10768(class_2535.java:450)
    at net.minecraft.class_636.method_2927(class_636.java:296)
    at net.minecraft.class_310.method_1574(class_310.java:1853)
    at net.minecraft.class_310.method_1523(class_310.java:1181)
    at net.minecraft.class_310.method_1514(class_310.java:802)
    at net.minecraft.client.main.Main.main(Main.java:250)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:234)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:269)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)
EnderKill98 commented 1 year ago

I guess the "should not happen" happened :laughing:

https://github.com/Bstn1802/AutoReconnect/blob/edc5a158abf2b7233fd364a9f065e863dab08312/src/main/java/autoreconnect/AutoReconnect.java#L66-L75

Not sure what the implications of returning there is, because it got passed an "IntConsumer" (which I never heard of, but assume it expects some response). Probably happened over a couple of version upgrades and java being java.

Edit: The easy solution is to just comment in that line above, but, as said, I'm not sure of the implications. If it was assumed to not happen the core issue might be something else.
That said I'm also using MultiMC and running 6 "Bots" for many days with it. They reconnected often and I didn't get an AutoConnect-Related crash with them or my main Account, yet. So it might be a rare race condition or related to the set of cooldowns. @HyCore maybe a screenshot/file of your settings might help to reproduce it.

HyCore commented 1 year ago

For me it somehow happen every time. I launch multimc, put the server to connect automatically in, and when i get disconnected for any reason, it crash.

Either on my shitty potato laptop or a powerful tower, it unconditionally crash when the server disconnect me. It only happen when using the auto server join feature.

I let you my logs, crash, and a video of it happening.

crash-2023-07-03_15.47.41-client.txt latest.log https://cdn.discordapp.com/attachments/1100093086325022792/1125424386149724260/2023-07-03-15-46-45.mp4 (if it doesn't work: https://tempclip.com/FtcHIOxj13iikgO/watch)

[15:37:59] [Render thread/INFO]: [System] [CHAT] honiehomie was slain by -XtreoXD
[15:38:04] [Render thread/INFO]: [System] [CHAT] <honiehomie> bro
[15:38:05] [Render thread/INFO]: [System] [CHAT] -<ACCESS TOKEN> drowned
[15:38:08] [Render thread/INFO]: [System] [CHAT] <xKen_t> not true
[15:38:14] [Render thread/INFO]: [System] [CHAT] <-XtreoXD> yes?
[15:38:49] [Render thread/ERROR]: Unreported exception thrown!
java.lang.NullPointerException: Cannot invoke "autoreconnect.reconnect.ReconnectStrategy.nextAttempt()" because "this.reconnectStrategy" is null
    at autoreconnect.AutoReconnect.startCountdown(AutoReconnect.java:71) ~[autoreconnect-2.1.0-beta.jar:?]
    at net.minecraft.class_419.handler$zzc001$autoreconnect$constructor(class_419.java:1037) ~[client-intermediary.jar:?]
    at net.minecraft.class_419.<init>(class_419.java:24) ~[client-intermediary.jar:?]
    at net.minecraft.class_634.method_10839(class_634.java:834) ~[client-intermediary.jar:?]
    at net.minecraft.class_2535.method_10768(class_2535.java:450) ~[client-intermediary.jar:?]
    at net.minecraft.class_636.method_2927(class_636.java:296) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1574(class_310.java:1853) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1181) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:234) ~[NewLaunch.jar:?]
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:269) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 2023-07-03 15:38:50
Description: Unexpected error

java.lang.NullPointerException: Cannot invoke "autoreconnect.reconnect.ReconnectStrategy.nextAttempt()" because "this.reconnectStrategy" is null
    at autoreconnect.AutoReconnect.startCountdown(AutoReconnect.java:71)
    at net.minecraft.class_419.handler$zzc001$autoreconnect$constructor(class_419.java:1037)
    at net.minecraft.class_419.<init>(class_419.java:24)
    at net.minecraft.class_634.method_10839(class_634.java:834)
    at net.minecraft.class_2535.method_10768(class_2535.java:450)
    at net.minecraft.class_636.method_2927(class_636.java:296)
    at net.minecraft.class_310.method_1574(class_310.java:1853)
    at net.minecraft.class_310.method_1523(class_310.java:1181)
    at net.minecraft.class_310.method_1514(class_310.java:802)
    at net.minecraft.client.main.Main.main(Main.java:250)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:234)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:269)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

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

-- Head --
Thread: Render thread
Stacktrace:
    at autoreconnect.AutoReconnect.startCountdown(AutoReconnect.java:71)
    at net.minecraft.class_419.handler$zzc001$autoreconnect$constructor(class_419.java:1037)
    at net.minecraft.class_419.<init>(class_419.java:24)
    at net.minecraft.class_634.method_10839(class_634.java:834)
    at net.minecraft.class_2535.method_10768(class_2535.java:450)
    at net.minecraft.class_636.method_2927(class_636.java:296)

-- Last reload --
Details:
    Reload number: 1
    Reload reason: initial
    Finished: Yes
    Packs: vanilla, fabric, file/Mod Menu Helper.zip, file/Chat Reporting Helper.zip, file/Fast Better Grass.zip
Stacktrace:
    at net.minecraft.class_6360.method_36565(class_6360.java:49)
    at net.minecraft.class_310.method_1587(class_310.java:2413)
    at net.minecraft.class_310.method_1514(class_310.java:826)
    at net.minecraft.client.main.Main.main(Main.java:250)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:234)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:269)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

-- System Details --
Details:
    Minecraft Version: 1.20.1
    Minecraft Version ID: 1.20.1
    Operating System: Windows 11 (amd64) version 10.0
    Java Version: 17.0.7, Eclipse Adoptium
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
    Memory: 568834416 bytes (542 MiB) / 985661440 bytes (940 MiB) up to 4294967296 bytes (4096 MiB)
    CPUs: 8
    Processor Vendor: AuthenticAMD
    Processor Name: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx  
    Identifier: AuthenticAMD Family 23 Model 24 Stepping 1
    Microarchitecture: Zen / Zen+
    Frequency (GHz): 2.10
    Number of physical packages: 1
    Number of physical CPUs: 4
    Number of logical CPUs: 8
    Graphics card #0 name: Parsec Virtual Display Adapter
    Graphics card #0 vendor: Parsec Cloud, Inc.
    Graphics card #0 VRAM (MB): 0.00
    Graphics card #0 deviceId: unknown
    Graphics card #0 versionInfo: DriverVersion=0.41.0.0
    Graphics card #1 name: AMD Radeon(TM) Vega 8 Graphics
    Graphics card #1 vendor: Advanced Micro Devices, Inc. (0x1002)
    Graphics card #1 VRAM (MB): 1024.00
    Graphics card #1 deviceId: 0x15d8
    Graphics card #1 versionInfo: DriverVersion=31.0.14057.5006
    Memory slot #0 capacity (MB): 4096.00
    Memory slot #0 clockSpeed (GHz): 2.67
    Memory slot #0 type: DDR4
    Memory slot #1 capacity (MB): 4096.00
    Memory slot #1 clockSpeed (GHz): 2.67
    Memory slot #1 type: DDR4
    Virtual memory max (MB): 16831.64
    Virtual memory used (MB): 8483.30
    Swap memory total (MB): 9728.00
    Swap memory used (MB): 121.38
    JVM Flags: 3 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xms402m -Xmx4096m
    Fabric Mods: 
        autoreconnect: AutoReconnect 2.1.0-beta
        cloth-config: Cloth Config v11 11.0.99
            cloth-basic-math: cloth-basic-math 0.6.1
        fabric-api: Fabric API 0.84.0+1.20.1
            fabric-api-base: Fabric API Base 0.4.29+b04edc7a77
            fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.34+4d8536c977
            fabric-biome-api-v1: Fabric Biome API (v1) 13.0.10+b3afc78b77
            fabric-block-api-v1: Fabric Block API (v1) 1.0.9+e022e5d177
            fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.39+b3afc78b77
            fabric-client-tags-api-v1: Fabric Client Tags 1.0.20+b3afc78b77
            fabric-command-api-v1: Fabric Command API (v1) 1.2.32+f71b366f77
            fabric-command-api-v2: Fabric Command API (v2) 2.2.11+b3afc78b77
            fabric-commands-v0: Fabric Commands (v0) 0.2.49+df3654b377
            fabric-containers-v0: Fabric Containers (v0) 0.1.61+df3654b377
            fabric-content-registries-v0: Fabric Content Registries (v0) 4.0.7+b3afc78b77
            fabric-convention-tags-v1: Fabric Convention Tags 1.5.3+b3afc78b77
            fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.18+aeb40ebe77
            fabric-data-generation-api-v1: Fabric Data Generation API (v1) 12.1.11+b3afc78b77
            fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.51+b3afc78b77
            fabric-entity-events-v1: Fabric Entity Events (v1) 1.5.21+b3afc78b77
            fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.6.0+b3afc78b77
            fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.61+df3654b377
            fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.38+b04edc7a77
            fabric-item-api-v1: Fabric Item API (v1) 2.1.26+b3afc78b77
            fabric-item-group-api-v1: Fabric Item Group API (v1) 4.0.7+b3afc78b77
            fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.36+fb8d95da77
            fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.34+df3654b377
            fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.2.20+b3afc78b77
            fabric-loot-api-v2: Fabric Loot API (v2) 1.1.37+b3afc78b77
            fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.1.41+9e7660c677
            fabric-message-api-v1: Fabric Message API (v1) 5.1.6+b3afc78b77
            fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.47+b3afc78b77
            fabric-models-v0: Fabric Models (v0) 0.3.35+b3afc78b77
            fabric-networking-api-v1: Fabric Networking API (v1) 1.3.8+b3afc78b77
            fabric-networking-v0: Fabric Networking (v0) 0.3.48+df3654b377
            fabric-object-builder-api-v1: Fabric Object Builder API (v1) 11.0.6+b3afc78b77
            fabric-particles-v1: Fabric Particles (v1) 1.0.28+b3afc78b77
            fabric-recipe-api-v1: Fabric Recipe API (v1) 1.0.18+b3afc78b77
            fabric-registry-sync-v0: Fabric Registry Sync (v0) 2.2.6+b3afc78b77
            fabric-renderer-api-v1: Fabric Renderer API (v1) 3.1.0+c154966e77
            fabric-renderer-indigo: Fabric Renderer - Indigo 1.4.0+c154966e77
            fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.44+df3654b377
            fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.33+b3afc78b77
            fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.0.26+b3afc78b77
            fabric-rendering-v0: Fabric Rendering (v0) 1.1.47+df3654b377
            fabric-rendering-v1: Fabric Rendering (v1) 3.0.6+b3afc78b77
            fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.3.5+ea08f9d877
            fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.11.7+f7923f6d77
            fabric-screen-api-v1: Fabric Screen API (v1) 2.0.6+b3afc78b77
            fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.27+b3afc78b77
            fabric-sound-api-v1: Fabric Sound API (v1) 1.0.12+b3afc78b77
            fabric-transfer-api-v1: Fabric Transfer API (v1) 3.2.2+b3afc78b77
            fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 4.2.0+b3afc78b77
        fabricloader: Fabric Loader 0.14.21
        java: OpenJDK 64-Bit Server VM 17
        minecraft: Minecraft 1.20.1
    Launched Version: 1.20.1
    Backend library: LWJGL version 3.3.1 SNAPSHOT
    Backend API: AMD Radeon(TM) Vega 8 Graphics  GL version 3.2.0 Core Profile Context 23.5.2.230523, ATI Technologies Inc.
    Window size: 956x961
    GL Caps: Using framebuffer using OpenGL 3.2
    GL debug messages: 
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fabric'
    Type: Client (map_client.txt)
    Graphics mode: fancy
    Resource Packs: vanilla, fabric, file/Mod Menu Helper.zip, file/Chat Reporting Helper.zip, file/Fast Better Grass.zip
    Current Language: en_us
    CPU: 8x AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx 
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Administrator\Documents\UltimMC\instances\1.20.1 KAIO\.minecraft\crash-reports\crash-2023-07-03_15.38.50-client.txt
Process exited with code -1 (0xffffffffffffffff).
Please note that usually neither the exit code, nor its description are enough to diagnose issues!
Always upload the entire log and not just the exit code.
znopp commented 1 year ago

I noticed that the 1.20 jar from #46 is "3.0.0-beta", whereas the jar file in this PR is "2.1.0-beta". Are there any major changes, content or otherwise (except the version ofc)?

EnderKill98 commented 1 year ago

I did not bump the version in this PR and just used whatever version was on the master branch. Not sure if #46 pulled/updated to a later version where it was bumped or bumped the version on its own.

HyCore commented 1 year ago

I guess the "should not happen" happened 😆

https://github.com/Bstn1802/AutoReconnect/blob/edc5a158abf2b7233fd364a9f065e863dab08312/src/main/java/autoreconnect/AutoReconnect.java#L66-L75

Not sure what the implications of returning there is, because it got passed an "IntConsumer" (which I never heard of, but assume it expects some response). Probably happened over a couple of version upgrades and java being java.

Edit: The easy solution is to just comment in that line above, but, as said, I'm not sure of the implications. If it was assumed to not happen the core issue might be something else. That said I'm also using MultiMC and running 6 "Bots" for many days with it. They reconnected often and I didn't get an AutoConnect-Related crash with them or my main Account, yet. So it might be a rare race condition or related to the set of cooldowns. @HyCore maybe a screenshot/file of your settings might help to reproduce it.

can you send me the source of the 1.20.1 version, and if you also can, the built version with the line commented out (it would save me some time) otherwise np i will do it.

Bstn1802 commented 1 year ago

So I finally had the time to look into this pr and it looks really good, even though there hasn't changed much, but I'll go ahead and merge this. My testing so far suggests that this update is working fine, at least I couldn't find any issues so far, so I think it's fine if I release first and then try to find and fix the issue with that crash that one of you had here and possibly some other issues, but hopefully not, although I should have more time now to work on this and maybe even add some requested features... Anyways, thanks again for all the contribution and sorry for checking it out so late

Bstn1802 commented 1 year ago

I guess the "should not happen" happened 😆

https://github.com/Bstn1802/AutoReconnect/blob/edc5a158abf2b7233fd364a9f065e863dab08312/src/main/java/autoreconnect/AutoReconnect.java#L66-L75

Not sure what the implications of returning there is, because it got passed an "IntConsumer" (which I never heard of, but assume it expects some response). Probably happened over a couple of version upgrades and java being java.

Edit: The easy solution is to just comment in that line above, but, as said, I'm not sure of the implications. If it was assumed to not happen the core issue might be something else. That said I'm also using MultiMC and running 6 "Bots" for many days with it. They reconnected often and I didn't get an AutoConnect-Related crash with them or my main Account, yet. So it might be a rare race condition or related to the set of cooldowns. @HyCore maybe a screenshot/file of your settings might help to reproduce it.

The "should not happen" is actually something different, can't remember what exactly on the spot, but I think it was possible at one point, that this method was called twice, so I simply returned when a countdown was already running, but then it didn't happend anymore and I convinced myself that it shouldn't anymore, so I left that comment (?)

The Exception thrown here is caused by the reconnectStrategy object being null, which can only mean that the mod didn't pick up what kind of server you were connecting to, so like whether it's a realm, a 3rd party server or the integrated server when playing singleplayer. I'll do some investigation as to why that could happen, if I can reproduce it or hopefully even fix it.

I guess I'll just quick fix it for now by return if the strategy is null.

The IntConsumer, by the way, is basically representing a function taking an integer as an argument and not returning anything. In this case it's a callback passed from the disconnect screen mixin, so I'm able to send back updates about the number of seconds left which it should display.

HyCore commented 1 year ago

I guess the "should not happen" happened 😆

https://github.com/Bstn1802/AutoReconnect/blob/edc5a158abf2b7233fd364a9f065e863dab08312/src/main/java/autoreconnect/AutoReconnect.java#L66-L75

Not sure what the implications of returning there is, because it got passed an "IntConsumer" (which I never heard of, but assume it expects some response). Probably happened over a couple of version upgrades and java being java.

Edit: The easy solution is to just comment in that line above, but, as said, I'm not sure of the implications. If it was assumed to not happen the core issue might be something else. That said I'm also using MultiMC and running 6 "Bots" for many days with it. They reconnected often and I didn't get an AutoConnect-Related crash with them or my main Account, yet. So it might be a rare race condition or related to the set of cooldowns. @HyCore maybe a screenshot/file of your settings might help to reproduce it.

The "should not happen" is actually something different, can't remember what exactly on the spot, but I think it was possible at one point, that this method was called twice, so I simply returned when a countdown was already running, but then it didn't happend anymore and I convinced myself that it shouldn't anymore, so I left that comment (?)

The Exception thrown here is caused by the reconnectStrategy object being null, which can only mean that the mod didn't pick up what kind of server you were connecting to, so like whether it's a realm, a 3rd party server or the integrated server when playing singleplayer. I'll do some investigation as to why that could happen, if I can reproduce it or hopefully even fix it.

I guess I'll just quick fix it for now by return if the strategy is null.

The IntConsumer, by the way, is basically representing a function taking an integer as an argument and not returning anything. In this case it's a callback passed from the disconnect screen mixin, so I'm able to send back updates about the number of seconds left which it should display.

Thanks for the insight, if you want I can create you a zip with UltimMC launcher (a multimc fork that doesn't require any Microsoft account) it will try to auto-connect to a server, if you don't do anything the server will kick you, and the game will crash. And I will test the strategy null quick fix. Also is it normal that the autoreconnect.yml doesn't get created it seems to spam that issue while crashing after all ?

Bstn1802 commented 1 year ago

The config should be called autoreconnect.json and it doesn't get created until you do changes to the default configuration. If the mod can't open the config file (e.g. bcs it doesn't exist) it will use the default config, but doesn't save it yet, not really necessary, I thought. It will also log the information that no config could be loaded and the exception that got thrown.

Regarding the issue you had, I will do some testing myself and see if I can reproduce the issue. If not I might try your setup, although it sounds a bit sketchy, not requiring a microsoft account...

Bstn1802 commented 1 year ago

@EnderKill98 Could you explain why you added an asterisk in the constructor mixin in the disconnected screen mixins? Also why was it necessary to retrieve the back button differently, on what screen is it not the first button?

EnderKill98 commented 1 year ago

Could you explain why you added an asterisk in the constructor mixin in the disconnected screen mixins?

That was an IDE recommendation (IntelliJ Minecraft Development Plugin) I thought I should just follow. Feel free to remove if that was wrong.

Also why was it necessary to retrieve the back button differently, on what screen is it not the first button?

That was the crash I initially ran into: ClassCassException. Seems some other type of UI element became the first child. I didn't check if it changed and thought it would be more future-proof to just find the button instead no matter when it got added. One of the checked translation texts (gui.back i think) is not needed tbh. Just added it to be sure.

HyCore commented 1 year ago

The config should be called autoreconnect.json and it doesn't get created until you do changes to the default configuration. If the mod can't open the config file (e.g. bcs it doesn't exist) it will use the default config, but doesn't save it yet, not really necessary, I thought. It will also log the information that no config could be loaded and the exception that got thrown.

Regarding the issue you had, I will do some testing myself and see if I can reproduce the issue. If not I might try your setup, although it sounds a bit sketchy, not requiring a microsoft account...

Yeh well it's just multimc but without the need of Microsoft, I don't really like GAFAM so when I can, I do without. But it doesn't matter for this issue.

HyCore commented 1 year ago

Yup, perfect fix https://github.com/Blaackyy/AutoReconnect/commit/c97266cd804d1c949f21aaf57d2c5e89c214eadb <3 thx again to all of you

Bstn1802 commented 1 year ago

Thanks for the quick response!

Could you explain why you added an asterisk in the constructor mixin in the disconnected screen mixins?

That was an IDE recommendation (IntelliJ Minecraft Development Plugin) I thought I should just follow. Feel free to remove if that was wrong.

Ah good to know, and I just checked, I have it as well, and it warns me too when I remove the asterisk and it seems to fix some kind of ambiguity somehow, gotta do some research about what exactly it does, couldn't find anything so far, that's why I was confused.

EDIT: I found out what it does: https://github.com/SpongePowered/Mixin/wiki/Advanced-Mixin-Usage---Callback-Injectors#62-wildcard-targets It's used to inject into all methods with the given name regardless of their signature, which is not really what I wanted, but maybe it's necessary since I want to inject into multiple classes? I'll leave it there, bcs now it injectes into all constructors and that shouldn't be an issue, if not even better

Also why was it necessary to retrieve the back button differently, on what screen is it not the first button?

That was the crash I initially ran into: ClassCassException. Seems some other type of UI element became the first child. I didn't check if it changed and thought it would be more future-proof to just find the button instead no matter when it got added. One of the checked translation texts (gui.back i think) is not needed tbh. Just added it to be sure.

Are you sure it had to do with the button? I'm wondering on what screen exactly it happened, but I guess it's really better, even for readability, when searching for the button specifically and by translation key, even though it looks unnecessary and inefficient at first, but well, how many buttons are there gonna be on a screen lol

Btw, the crash I initially ran into after merging in your PR was that I couldn't even test the mod, bcs mod menu and cloth config versions were too old. If you're running in IntelliJ aren't you testing from within there as well or do you build the mod and run it with minecraft yourself?

EnderKill98 commented 1 year ago

Are you sure it had to do with the button? I'm wondering on what screen exactly it happened, but I guess it's really better, even for readability, when searching for the button specifically and by translation key, even though it looks unnecessary and inefficient at first, but well, how many buttons are there gonna be on a screen lol

Yeah pretty sure. Got some weird class_xxxx name (Yarn Intermediate naming) and used this tool to confirm that it was related to the Button. (Not sure anymore, but the error was like an attempted cast from TextView or similart to the Button). Once I fixed them the error was gone.

Btw, the crash I initially ran into after merging in your PR was that I couldn't even test the mod, bcs mod menu and cloth config versions were too old. If you're running in IntelliJ aren't you testing from within there as well or do you build the mod and run it with minecraft yourself?

Not sure if I did test using the runClient task tbh. I might have but also not because of dependencies. I did test at least by building the mod and have been using it for a while now.

Bstn1802 commented 1 year ago

Hey, just a quick update, 1.20 has been released and seems to work for 1.20.1 too.

I am now working on fixing the issue you, @HyCore had which has been fixed in #53 but I don't really like the approach taken there and would like to integrate it more into the existing system, possibly tweaking it a lot to make that happen, but I really do see the need, especially since QuickPlay is a vanilla feature with the same issue (which I just found out exists since 1.20 lol). I created issue #54 to possibly discuss further ideas there. Together with fixing that issue I will probably target 1.20.1 instead of 1.20 with the next release and I might work on other requested features too.