Why run normal in dev but build jar will crash
2A5F opened this issue ยท 4 comments
log
[00:13:10] [main/INFO]: Loading for game Minecraft 1.16.2
[00:13:11] [main/INFO]: [FabricLoader] Loading 48 mods: [email protected]+8bcfced84e, [email protected]+872498414e, [email protected], [email protected]+b50ffc7b4e, [email protected]+3fa9f7c54e, [email protected]+5ce533984e, [email protected]+build.207, [email protected]+ccce563e4e, [email protected], [email protected]+fb0d9b0e4e, [email protected]+8bcfced84e, [email protected]+045df74f4e, [email protected]+432ea1884e, [email protected]+29679fd64e, [email protected]+b7f9825d4e, [email protected]+e2e6cdad4e, [email protected]+91555cd14e, [email protected]+build.1, [email protected]+12a8474c4e, [email protected]+534104904e, [email protected]+432ea1884e, [email protected]+730711c64e, [email protected], [email protected]+b7f9825d4e, [email protected]+facf3bbf4e, [email protected]+eae12eb84e, [email protected], [email protected], [email protected]+059ea8664e, [email protected]+ac8e8c594e, [email protected]+fb0d9b0e4e, [email protected], [email protected]+52d308364e, [email protected]+fcdfdfa14e, [email protected]+c6a8ea894e, [email protected]+74cc3b204e, [email protected]+b764ce994e, [email protected]+e2862de64e, [email protected], [email protected]+432ea1884e, [email protected]+16acbe5b4e, [email protected]+build.401-1.16, [email protected]+fb0d9b0e4e, [email protected]+dfdb52d64e, [email protected]+438f96364e, [email protected]+e00ecb5f4e, [email protected]+432ea1884e, [email protected]
[00:13:11] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.1 Source=file:/C:/Users/Administrator/Desktop/aa/sub/fabric-server-launch.jar Service=Knot/Fabric Env=SERVER
[00:13:11] [main/WARN]: Reference map 'necessary-refmap.json' for necessary.mixins.json could not be read. If this is a development environment you can ignore this message
[00:13:16] [main/FATAL]: Failed to start the minecraft server
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'necessary'!
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:53) ~[fabric-server-launch.jar:?]
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke(EntrypointUtils.java:36) ~[fabric-server-launch.jar:?]
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointServer.start(EntrypointServer.java:32) ~[fabric-server-launch.jar:?]
at net.minecraft.server.Main.main(Main.java:93) [intermediary-server.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:192) [fabric-server-launch.jar:?]
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:140) [fabric-server-launch.jar:?]
at net.fabricmc.loader.launch.knot.KnotServer.main(KnotServer.java:26) [fabric-server-launch.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
at net.fabricmc.loader.launch.server.FabricServerLauncher.launch(FabricServerLauncher.java:61) [fabric-server-launch.jar:?]
at net.fabricmc.loader.launch.server.FabricServerLauncher.setup(FabricServerLauncher.java:105) [fabric-server-launch.jar:?]
at net.fabricmc.loader.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:49) [fabric-server-launch.jar:?]
Caused by: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy35.onInitialize(Unknown Source) ~[?:?]
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50) ~[fabric-server-launch.jar:?]
... 17 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
at net.fabricmc.loader.util.DefaultLanguageAdapter$1.invoke(DefaultLanguageAdapter.java:122) ~[fabric-server-launch.jar:?]
at com.sun.proxy.$Proxy35.onInitialize(Unknown Source) ~[?:?]
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50) ~[fabric-server-launch.jar:?]
... 17 more
Caused by: java.lang.UnsupportedOperationException
at com.sun.nio.zipfs.ZipPath.toFile(ZipPath.java:597) ~[zipfs.jar:1.8.0_131]
at co.volight.necessary.lang.Lang.reg(Lang.java:24) ~[necessary-0.2.0.jar:?]
at co.volight.necessary.lang.Lang.reg$default(Lang.java:22) ~[necessary-0.2.0.jar:?]
at co.volight.necessary.NecKt.init(NecKt.java:19) ~[necessary-0.2.0.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
at net.fabricmc.loader.util.DefaultLanguageAdapter$1.invoke(DefaultLanguageAdapter.java:122) ~[fabric-server-launch.jar:?]
at com.sun.proxy.$Proxy35.onInitialize(Unknown Source) ~[?:?]
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50) ~[fabric-server-launch.jar:?]
... 17 more
source
@Mixin(ServerPlayNetworkHandler::class)
class LangGetMixin {
@Inject(at = [At("HEAD")], method = ["Lnet/minecraft/server/network/ServerPlayNetworkHandler;onClientSettings(Lnet/minecraft/network/packet/c2s/play/ClientSettingsC2SPacket;)V"])
private fun onClientSettings(clientSettingsC2SPacket: ClientSettingsC2SPacket?, info: CallbackInfo) {
if (clientSettingsC2SPacket == null || clientSettingsC2SPacket !is ClientSettingsC2SPacketWithLanguage) return
val language = clientSettingsC2SPacket.getLanguage()
val player = (this as ServerPlayNetworkHandler).player
PlayerLangInfo.playerLanguage[player.uuid] = language.toLowerCase()
}
}
@Mixin(ClientSettingsC2SPacket::class)
interface ClientSettingsC2SPacketWithLanguage {
@Accessor("Lnet/minecraft/network/packet/c2s/play/ClientSettingsC2SPacket;language:Ljava/lang/String;")
fun getLanguage(): String
}
Your mod here: https://github.com/2A5F/Necessary/blob/4a700159a0eaf4741a495d4235e08eb6462d914a/src/main/kotlin/co/volight/necessary/lang/Lang.kt#L24 is trying to covert a java NIO path to a file.
This is not a safe assumption to make, thus this crash.
You MUST always use java NIO to read files from a mod jar, or the mod jar its self as it can be loaded from memory via the jar in jar system
@modmuss50 thanks
But how to solve this
Reference map 'necessary-refmap.json' for necessary.mixins.json could not be read. If this is a development environment you can ignore this message