toNeko

toNeko

5.7k Downloads

The game crashes in Minecraft 1.21

QWERTY770 opened this issue ยท 5 comments

commented

I installed toNeko 1.0.0-pre-1.21 and ctlib 0.1.10, but the game crashed when I tried to start it.

The other mods I installed are AdvancementInfo 1.20.4-fabric0.91.2-1.4, XPlus Autofish 1.1.1-fabric-1.21, Cloth Config v15 15.0.127, Fabric API 0.100.4+1.21, GeckoLib 4 4.5.6, Lithium 0.12.7, MaLiLib 0.19.999-sakura.6, Mod Menu 11.0.1, Sodium 0.5.11+mc1.21, Tweakeroo 0.20.999-sakura.10, Xaero's Minimap 24.2.1 and Xaero's World Map 1.38.8.

Here is the crash report: (I omitted some information of the system, such as CPU and Windows modules)

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 2024-07-05 00:09:56
Description: Initializing game

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'toneko'!
	at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388)
	at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
	at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386)
	at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
	at net.minecraft.class_310.<init>(class_310.java:477)
	at net.minecraft.client.main.Main.main(Main.java:239)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
	at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:215)
	at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:173)
	at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:168)
	at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:123)
	at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1204)
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:320)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:238)
	at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:210)
	at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
	at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:152)
	at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:156)
	at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:178)
	at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:493)
	at org.yaml.snakeyaml.Yaml.load(Yaml.java:434)
	at org.cneko.ctlib.common.file.YamlConfiguration.<init>(YamlConfiguration.java:21)
	at org.cneko.ctlib.common.file.YamlConfiguration.fromFile(YamlConfiguration.java:223)
	at org.cneko.toneko.common.util.ConfigUtil.load(ConfigUtil.java:53)
	at org.cneko.toneko.common.Bootstrap.bootstrap(Bootstrap.java:40)
	at org.cneko.toneko.fabric.ToNeko.onInitialize(ToNeko.java:18)
	at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384)
	... 6 more
Caused by: java.nio.charset.MalformedInputException: Input length = 1
	at java.base/java.nio.charset.CoderResult.throwException(CoderResult.java:279)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:405)
	at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:217)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:171)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:188)
	at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:118)
	at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:180)
	... 25 more


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

-- Head --
Thread: Render thread
Stacktrace:
	at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388)
	at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
	at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386)
	at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
	at net.minecraft.class_310.<init>(class_310.java:477)

-- Initialization --
Details:
	Modules: ...

Stacktrace:
	at net.minecraft.client.main.Main.main(Main.java:239)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

-- System Details --
Details:
	Minecraft Version: 1.21
	Minecraft Version ID: 1.21
	Operating System: Windows 11 (amd64) version 10.0
	Java Version: 21.0.3, Microsoft
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Microsoft
	...
	JVM Flags: 11 total; -Xmx2048m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32m -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -XX:-DontCompileHugeMethods -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	Fabric Mods: 
		advancementinfo: AdvancementInfo 1.20.4-fabric0.91.2-1.4
		autofish: XPlus Autofish 1.1.1-fabric-1.21
		cloth-config: Cloth Config v15 15.0.127
			cloth-basic-math: cloth-basic-math 0.6.1
		ctlib: ctLib 0.1.10
		fabric-api: Fabric API 0.100.4+1.21
			fabric-api-base: Fabric API Base 0.4.42+6573ed8cd1
			fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.67+b5597344d1
			fabric-biome-api-v1: Fabric Biome API (v1) 13.0.28+6fc22b99d1
			fabric-block-api-v1: Fabric Block API (v1) 1.0.22+0af3f5a7d1
			fabric-block-view-api-v2: Fabric BlockView API (v2) 1.0.10+6573ed8cd1
			fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.52+0af3f5a7d1
			fabric-client-tags-api-v1: Fabric Client Tags 1.1.15+6573ed8cd1
			fabric-command-api-v1: Fabric Command API (v1) 1.2.48+f71b366fd1
			fabric-command-api-v2: Fabric Command API (v2) 2.2.27+6a6dfa19d1
			fabric-commands-v0: Fabric Commands (v0) 0.2.65+df3654b3d1
			fabric-content-registries-v0: Fabric Content Registries (v0) 8.0.14+b5597344d1
			fabric-convention-tags-v1: Fabric Convention Tags 2.0.15+7f945d5bd1
			fabric-convention-tags-v2: Fabric Convention Tags (v2) 2.3.2+78017270d1
			fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.29+0af3f5a7d1
			fabric-data-attachment-api-v1: Fabric Data Attachment API (v1) 1.1.24+6a6dfa19d1
			fabric-data-generation-api-v1: Fabric Data Generation API (v1) 20.2.9+16c4ae25d1
			fabric-dimensions-v1: Fabric Dimensions API (v1) 4.0.0+6fc22b99d1
			fabric-entity-events-v1: Fabric Entity Events (v1) 1.6.12+6fc22b99d1
			fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.7.10+e633f883d1
			fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.52+6573ed8cd1
			fabric-item-api-v1: Fabric Item API (v1) 11.0.0+afdfc921d1
			fabric-item-group-api-v1: Fabric Item Group API (v1) 4.1.2+78017270d1
			fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.47+0af3f5a7d1
			fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.45+df3654b3d1
			fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.3.11+8f3583aed1
			fabric-loot-api-v2: Fabric Loot API (v2) 3.0.11+6573ed8cd1
			fabric-message-api-v1: Fabric Message API (v1) 6.0.13+6573ed8cd1
			fabric-model-loading-api-v1: Fabric Model Loading API (v1) 2.0.0+fe474d6bd1
			fabric-networking-api-v1: Fabric Networking API (v1) 4.2.0+ab7edbacd1
			fabric-object-builder-api-v1: Fabric Object Builder API (v1) 15.1.12+d1321076d1
			fabric-particles-v1: Fabric Particles (v1) 4.0.2+6573ed8cd1
			fabric-recipe-api-v1: Fabric Recipe API (v1) 5.0.10+65089712d1
			fabric-registry-sync-v0: Fabric Registry Sync (v0) 5.0.23+78017270d1
			fabric-renderer-api-v1: Fabric Renderer API (v1) 3.3.0+0ae0b97dd1
			fabric-renderer-indigo: Fabric Renderer - Indigo 1.6.5+48fb1586d1
			fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.67+df3654b3d1
			fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.48+73761d2ed1
			fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.1.6+b5597344d1
			fabric-rendering-v0: Fabric Rendering (v0) 1.1.70+df3654b3d1
			fabric-rendering-v1: Fabric Rendering (v1) 5.0.4+5a8c785ed1
			fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 4.2.1+d153f344d1
			fabric-resource-loader-v0: Fabric Resource Loader (v0) 1.1.5+78017270d1
			fabric-screen-api-v1: Fabric Screen API (v1) 2.0.24+b5597344d1
			fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.80+b5597344d1
			fabric-sound-api-v1: Fabric Sound API (v1) 1.0.23+6573ed8cd1
			fabric-transfer-api-v1: Fabric Transfer API (v1) 5.1.15+3dccd343d1
			fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 6.0.12+6573ed8cd1
		fabricloader: Fabric Loader 0.15.11
			mixinextras: MixinExtras 0.3.5
		geckolib: GeckoLib 4 4.5.6
		java: OpenJDK 64-Bit Server VM 21
		lithium: Lithium 0.12.7
		malilib: MaLiLib 0.19.999-sakura.6
		minecraft: Minecraft 1.21
		modmenu: Mod Menu 11.0.1
			placeholder-api: Placeholder API 2.4.0-pre.2+1.21
		sodium: Sodium 0.5.11+mc1.21
		toneko: toNeko 1.0.0-pre
		tweakeroo: Tweakeroo 0.20.999-sakura.10
		xaerominimap: Xaero's Minimap 24.2.1
		xaeroworldmap: Xaero's World Map 1.38.8
	Launched Version: 1.21
	Launcher name: HMCL
	Backend library: LWJGL version 3.3.3-snapshot
	Backend API: Unknown
	Window size: <not initialized>
	GFLW Platform: <error>
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: <disabled>
	Is Modded: Definitely; Client brand changed to 'fabric'
	Universe: 404
	Type: Client (map_client.txt)
	Locale: zh_CN
	System encoding: GBK
	File encoding: GB18030
	CPU: <unknown>
commented

After some tests I fixed the bug. See pull request #45 .

Analysis: In the method WriteFile of the class org.cneko.toneko.common.util.FileUtil, the charset is not specified. Thus, the operating system will use its own charset (like GBK) instead of UTF-8. But the YamlConfiguration class only supports UTF-8 encoded files, and this caused the game to crash.
Line 48 should be like this:
FileWriter fw = new FileWriter(f, StandardCharsets.UTF_8);

commented

Already aware of it, will solve it as soon as possible, thank you for your feedback.

commented

It seems that you use GBK,But the mod Using UTF8, try switching to UTF8?Maybe this time it will work.

commented

It seems that you use GBK,But the mod Using UTF8, try switching to UTF8?Maybe this time it will work.

I added JVM flag "-Dfile.encoding=UTF-8" but the game crashed again. Why?

commented

Well, later I'll try to build the mod from the source code in order to find out the reason why the game crashed.