Posted November 24, 20195 yr I have a packet that goes to the client in my code, that the server is for some reason trying to load... This causes a crash with this error: [19:41:39] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [ Laser Mod (lasermod) encountered an error during the common_setup event phase §7Attempted to load class net/minecraft/client/world/ClientWorld for invalid dist DEDICATED_SERVER ] at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:201) ~[?:?] {re:classloading} at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:154) ~[?:?] {re:classloading} at net.minecraftforge.fml.server.ServerModLoader.begin(ServerModLoader.java:46) ~[?:?] {re:classloading} at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:124) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:622) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222] {} Here is where I reference a ClientWorld in my code: public static void handle(PacketLaserLensUpdate message, Supplier<NetworkEvent.Context> ctx) { ctx.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { World world = Minecraft.getInstance().world; TileEntity te = world.getTileEntity(message.pos); if (te instanceof LaserTileEntity) { LaserTileEntity laser = (LaserTileEntity) te; laser.color = message.color; laser.direction = message.direction; laser.maxDistance = message.distance; laser.thickness = message.thickness; laser.active = message.active; } })); ctx.get().setPacketHandled(true); } As you can see I tried using DistExecutor, but that isn't working for some reason. Im registering the packets in the FMLCommonSetupEvent. Edited November 26, 20195 yr by deerangle solved
November 26, 20195 yr Author Weirdly, when I inline the World in this part of the code World world = Minecraft.getInstance().world; TileEntity te = world.getTileEntity(message.pos); the error disappears... But that isn't really a fix to the problem, as in some situations, inlining might not be possible. What can I do to fix this error without inlining?
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.