Jump to content

[SOLVED] [1.15.2] Server crashes on startup due to Dist issue with packets


Recommended Posts

Posted (edited)
[04Jun2020 22:28:17.891] [Server thread/DEBUG] [net.minecraftforge.fml.ModList/LOADING]: Dispatching parallel event LifecycleEvent:COMMON_SETUP
[04Jun2020 22:28:17.894] [modloading-worker-1/DEBUG] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Firing event for modid forge : FMLCommonSetupEvent
[04Jun2020 22:28:17.894] [modloading-worker-3/DEBUG] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Firing event for modid daboismod : FMLCommonSetupEvent
[04Jun2020 22:28:17.942] [modloading-worker-3/FATAL] [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/audio/ISound for invalid dist DEDICATED_SERVER
[04Jun2020 22:28:17.946] [modloading-worker-3/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Attempted to load class net/minecraft/client/audio/ISound for invalid dist DEDICATED_SERVER
	Index: 1
	Listeners:
		0: NORMAL
		1: net.minecraftforge.eventbus.EventBus$$Lambda$2660/977800848@3936f231
java.lang.RuntimeException: Attempted to load class net/minecraft/client/audio/ISound for invalid dist DEDICATED_SERVER
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClass(RuntimeDistCleaner.java:71)
	at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClass(ILaunchPluginService.java:103)
	at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85)
	at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:115)
	at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:239)
	at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:126)
	at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:96)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
	at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:975)
	at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1000)
	at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1394)
	at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1750)
	at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477)
	at com.github.kaydogz.daboismod.network.DBMPacketHandler.registerPackets(DBMPacketHandler.java:36)
	at com.github.kaydogz.daboismod.DaBoisMod.onCommonSetup(DaBoisMod.java:84)
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212)
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
	at net.minecraftforge.fml.ModList.lambda$null$10(ModList.java:135)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)
	at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

[04Jun2020 22:28:17.948] [modloading-worker-3/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event FMLCommonSetupEvent dispatch for modid daboismod
java.lang.RuntimeException: Attempted to load class net/minecraft/client/audio/ISound for invalid dist DEDICATED_SERVER
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClass(RuntimeDistCleaner.java:71) ~[forge-1.15.2-31.2.8_mapped_snapshot_20200604-1.15.1-launcher.jar:31.2]
	at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClass(ILaunchPluginService.java:103) ~[modlauncher-5.1.0.jar:5.1.0+69+master.79f13f7]
	at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) ~[modlauncher-5.1.0.jar:?]
	at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:115) ~[modlauncher-5.1.0.jar:?]
	at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:239) ~[modlauncher-5.1.0.jar:?]
	at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:126) ~[modlauncher-5.1.0.jar:?]
	at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:96) ~[modlauncher-5.1.0.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_251]
	at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[?:1.8.0_251]
	at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:975) ~[?:1.8.0_251]
	at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1000) ~[?:1.8.0_251]
	at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1394) ~[?:1.8.0_251]
	at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1750) ~[?:1.8.0_251]
	at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477) ~[?:1.8.0_251]
	at com.github.kaydogz.daboismod.network.DBMPacketHandler.registerPackets(DBMPacketHandler.java:36) ~[main/:?]
	at com.github.kaydogz.daboismod.DaBoisMod.onCommonSetup(DaBoisMod.java:84) ~[main/:?]
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.2.0-service.jar:?]
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.2.0-service.jar:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[?:31.2]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_251]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_251]
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[?:?]
	at net.minecraftforge.fml.ModList.lambda$null$10(ModList.java:135) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) [?:1.8.0_251]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291) [?:1.8.0_251]
	at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) [?:1.8.0_251]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_251]
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_251]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_251]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_251]
[04Jun2020 22:28:18.031] [modloading-worker-1/DEBUG] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Fired event for modid forge : FMLCommonSetupEvent
[04Jun2020 22:28:18.032] [Server thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event SETUP, 1 errors found
[04Jun2020 22:28:18.033] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Starting version check at https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[04Jun2020 22:28:18.032] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Encountered an unexpected exception
net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [
	Da Bois Mod (daboismod) encountered an error during the common_setup event phase
§7Attempted to load class net/minecraft/client/audio/ISound for invalid dist DEDICATED_SERVER
]
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:218) ~[?:?]
	at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:156) ~[?:?]
	at net.minecraftforge.fml.server.ServerModLoader.begin(ServerModLoader.java:46) ~[?:?]
	at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:125) ~[?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:638) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251]
[04Jun2020 22:28:18.049] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: This crash report has been saved to: C:\Users\mrkdo\Desktop\Modding\DaBoisMod\run\.\crash-reports\crash-2020-06-04_22.28.18-server.txt
[04Jun2020 22:28:18.065] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Stopping server
[04Jun2020 22:28:18.066] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving worlds
[04Jun2020 22:28:18.066] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Exception stopping the server
java.lang.RuntimeException: The server has failed to initialize correctly due to mod loading errors. Examine the crash report for more details.
	at net.minecraftforge.common.DimensionManager.getWorld(DimensionManager.java:185) ~[?:?]
	at net.minecraft.server.MinecraftServer.getWorld(MinecraftServer.java:1053) ~[?:?]
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:552) ~[?:?]
	at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:587) ~[?:?]
	at net.minecraft.server.dedicated.DedicatedServer.stopServer(DedicatedServer.java:602) ~[?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:701) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251]
[04Jun2020 22:28:18.071] [Server thread/DEBUG] [net.minecraftforge.fml.loading.FileUtils/CORE]: Found existing serverconfig directory : .\world\serverconfig
[04Jun2020 22:28:18.071] [Server thread/DEBUG] [net.minecraftforge.fml.config.ConfigTracker/CONFIG]: Unloading configs type SERVER
[04Jun2020 22:28:18.411] [Forge Version Check/DEBUG] [net.minecraftforge.fml.VersionChecker/]: [forge] Received version check data:
{
  "homepage": "http://files.minecraftforge.net/maven/net/minecraftforge/forge/",
  "promos": {
    "1.1-latest": "1.3.2.6",
    "1.10-latest": "12.18.0.2000",
    "1.10.2-latest": "12.18.3.2511",
    "1.10.2-recommended": "12.18.3.2185",
    "1.11-latest": "13.19.1.2199",
    "1.11-recommended": "13.19.1.2189",
    "1.11.2-latest": "13.20.1.2588",
    "1.11.2-recommended": "13.20.1.2386",
    "1.12-latest": "14.21.1.2443",
    "1.12-recommended": "14.21.1.2387",
    "1.12.1-latest": "14.22.1.2485",
    "1.12.1-recommended": "14.22.1.2478",
    "1.12.2-latest": "14.23.5.2854",
    "1.12.2-recommended": "14.23.5.2854",
    "1.13.2-latest": "25.0.219",
    "1.14.2-latest": "26.0.63",
    "1.14.3-latest": "27.0.60",
    "1.14.4-latest": "28.2.18",
    "1.14.4-recommended": "28.2.0",
    "1.15-latest": "29.0.4",
    "1.15.1-latest": "30.0.51",
    "1.15.2-latest": "31.2.8",
    "1.15.2-recommended": "31.2.0",
    "1.5.2-latest": "7.8.1.738",
    "1.5.2-recommended": "7.8.1.737",
    "1.6.1-latest": "8.9.0.775",
    "1.6.2-latest": "9.10.1.871",
    "1.6.2-recommended": "9.10.1.871",
    "1.6.3-latest": "9.11.0.878",
    "1.6.4-latest": "9.11.1.1345",
    "1.6.4-recommended": "9.11.1.1345",
    "1.7.10-latest": "10.13.4.1614",
    "1.7.10-latest-1.7.10": "10.13.2.1343",
    "1.7.10-recommended": "10.13.4.1558",
    "1.7.2-latest": "10.12.2.1147",
    "1.7.2-recommended": "10.12.2.1121",
    "1.8-latest": "11.14.4.1577",
    "1.8-recommended": "11.14.4.1563",
    "1.8.8-latest": "11.15.0.1655",
    "1.8.9-latest": "11.15.1.2318",
    "1.8.9-recommended": "11.15.1.1722",
    "1.9-latest": "12.16.0.1942",
    "1.9-recommended": "12.16.1.1887",
    "1.9.4-latest": "12.17.0.2051",
    "1.9.4-recommended": "12.17.0.1976",
    "latest-1.7.10": "10.13.2.1343"
  }
}
[04Jun2020 22:28:18.414] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Found status: AHEAD Current: 31.2.8 Target: null

^Here is the crash part of the debug.log.

Whenever I try to launch a server using runServer, the server crashes on startup during the FMLCommonSetupEvent, caused by referencing a client-only file on the dedicated server. The referencing of the client-only file is in the handler of a packet I am registering (server to client) during the event. I'm not sure why this is occurring, because the packet is only sent when a certain entity dies. How would I fix this? Registering of the packet: https://pastebin.com/Csb4cVVn  Packet Handling: https://pastebin.com/S71eimkr . Any help is appreciated.

Edited by kaydogz
Posted

You are referencing the ISound class in your packet, which is only accessible from the physical client side.

Looking and guessing from your posted code (please post your complete mod code to GitHub when requesting help), I assume you reference the class from SPlaySoundPacket.

  • Don't use client- or sever-only classes in common code (such as networking). Consider using SoundEvent.
  • Why do you need a packet for playing sounds? Can't you use World#playSound(PlayerEntity, BlockPos, SoundEvent, SoundCategory, float, float)?
  • If you really need to reference client- or server-only classes for any reason, reference them only in FMLClientSetupEvent or FMLDedicatedServerSetupEvent, and in a seperate class.
Posted
2 minutes ago, sciwhiz12 said:

You are referencing the ISound class in your packet, which is only accessible from the physical client side.

Looking and guessing from your posted code (please post your complete mod code to GitHub when requesting help), I assume you reference the class from SPlaySoundPacket.

  • Don't use client- or sever-only classes in common code (such as networking). Consider using SoundEvent.
  • Why do you need a packet for playing sounds? Can't you use World#playSound(PlayerEntity, BlockPos, SoundEvent, SoundCategory, float, float)?
  • If you really need to reference client- or server-only classes for any reason, reference them only in FMLClientSetupEvent or FMLDedicatedServerSetupEvent, and in a seperate class.

I need to use a custom packet because I want to play a custom sound globally from a logical server, but World#playBroadcastSound doesn’t work since it requires a hard-coded sound type.

Posted (edited)

Looking at the code for World#playBroadcastSound leads to WorldRenderer#broadcastSound, which calculates coordinates based on the given position and the player's PoV pos (I think?), which eventually just calls ClientWorld#playSound.

 

Based on this, I recommend that in your packet, change from ISound to SoundEvent (+ pitch & volume), and copy the coordinates code from WorldRenderer#broadcastSound, and calling ClientWorld#playSound(double, double, double, SoundEvent, SoundCategory, float, float, boolean).

Edited by sciwhiz12
typo
  • Thanks 1
Posted
8 hours ago, sciwhiz12 said:

Looking at the code for World#playBroadcastSound leads to WorldRenderer#broadcastSound, which calculates coordinates based on the given position and the player's PoV pos (I think?), which eventually just calls ClientWorld#playSound.

 

Based on this, I recommend that in your packet, change from ISound to SoundEvent (+ pitch & volume), and copy the coordinates code from WorldRenderer#broadcastSound, and calling ClientWorld#playSound(double, double, double, SoundEvent, SoundCategory, float, float, boolean).

Thanks, this worked.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.