Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Crash on server start-up due to custom packets
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
M4thG33k

[1.7.10] Crash on server start-up due to custom packets

By M4thG33k, July 30, 2015 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

M4thG33k    0

M4thG33k

M4thG33k    0

  • Stone Miner
  • M4thG33k
  • Members
  • 0
  • 58 posts
Posted July 30, 2015

Greetings! I've received this crash report from someone who's been using my mod and I can't seem to pinpoint the actual source of the crash: http://pastebin.com/YQ91FgMM

 

From my understanding, the crash is happening when Forge is attempting to register my packet classes. The interesting thing is, this crash just recently appeared. I was fixing other bugs that were found, and then this crash crept in, which I find extremely odd. If there are any ideas as to what the problem could be (besides "you're attempting to use client-only classes on the server" since I can see that much), I would appreciate it.

 

Here's the line that I can trace back to from the crash report that is apparently causing the issue: https://goo.gl/fDL8OZ

 

Thanks in advance!

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45628 posts
Posted July 30, 2015

Your message handlers are directly referencing client-only classes. You can't do that.

  • Quote

Share this post


Link to post
Share on other sites

M4thG33k    0

M4thG33k

M4thG33k    0

  • Stone Miner
  • M4thG33k
  • Members
  • 0
  • 58 posts
Posted July 30, 2015

Would it be possible for you to tell me which client-only classes I'm using? I know I'm using EntityFX in my code, but I thought that I was providing enough checks to make sure that all of that code is only being run on the client side. I suppose I'm still not fully understanding how packets are supposed to work (despite reading quite a few tutorials)...

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45628 posts
Posted July 30, 2015

E.g. Minecraft.class is client only.

It doesn't matter that you are checking. The server will load both your IMessage and your IMessageHandler class, therefor nothing in that class can reference client-only code. Your IMessageHandler has a reference to the class Minecraft in it, therefor the server will crash.

  • Quote

Share this post


Link to post
Share on other sites

M4thG33k    0

M4thG33k

M4thG33k    0

  • Stone Miner
  • M4thG33k
  • Members
  • 0
  • 58 posts
Posted July 30, 2015

Ok, so is there a "proper way" to have the packet handler get a Minecraft world instance, then? I can't pass it in to the packet at all, but the packet should know what world it ends up in, right?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45628 posts
Posted July 30, 2015

Make a method in your proxy class that throws an exception on the server (it will never be called there) and does the stuff that your packet handler does now on the client. Then call that method from your packet handler.

  • Quote

Share this post


Link to post
Share on other sites

Ernio    598

Ernio

Ernio    598

  • Reality Controller
  • Ernio
  • Forge Modder
  • 598
  • 2638 posts
Posted July 30, 2015

Get world via proxy.

 

In Common:

public World getClientWorld() { return null; }

In Client:

public World getClientWorld() {return Minecraft.getMinecraft().theWorld; }

 

EDIT

Dammit, he was faster :D

  • Quote

Share this post


Link to post
Share on other sites

M4thG33k    0

M4thG33k

M4thG33k    0

  • Stone Miner
  • M4thG33k
  • Members
  • 0
  • 58 posts
Posted July 30, 2015

All right, thanks to both of you! This makes perfect sense (even before seeing Ernio's code haha). I will attempt to put this into practice soon. Thanks for the quick responses!

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Rixxaw
      Minecraft Core Issue/Forge Issue???

      By Rixxaw · Posted 8 minutes ago

      Download the Twitch App, and go to "Mods" then select a modpack from the list of packs there.  Assuming you are attempting to "Create" your own modpack.  There are thousands of modpacks already created and it is very likely you will find one with the mods you want.  If  Not, look for a Vanilla+ pack, and then unlock the profile, and add whatever mods you want.  The App will make sure they are of the right version and what not.  Thus you essentially create your own pack that way in a sense.
    • Iceo
      1.12.2 Server Crash with Applied Energistics 2

      By Iceo · Posted 9 minutes ago

      I dont know what you mean by OpenJDK don't you use that for developing mods?
    • Iceo
      1.12.2 Server Crash with Applied Energistics 2

      By Iceo · Posted 32 minutes ago

      I have no idea what you mean. I just run it using server.pro using a tutorial I found and I get this crash. I run it fine on client though.
    • DaemonUmbra
      1.12.2 Server Crash with Applied Energistics 2

      By DaemonUmbra · Posted 41 minutes ago

      Do you get this issue running OpenJDK?
    • DaemonUmbra
      Minecraft Forge Mods Won't Load for Me

      By DaemonUmbra · Posted 43 minutes ago

      Modded worlds are almost never portable between versions, as it requires modders to publish their mod in both versions as well as include code to upgrade old save data
  • Topics

    • Aaronade
      2
      Minecraft Core Issue/Forge Issue???

      By Aaronade
      Started 4 hours ago

    • Iceo
      3
      1.12.2 Server Crash with Applied Energistics 2

      By Iceo
      Started 45 minutes ago

    • runescaper
      7
      Minecraft Forge Mods Won't Load for Me

      By runescaper
      Started 1 hour ago

    • catcube
      6
      is there a way to get alpha Textures, sounds and old lighting into MC 1.13.2? (Hire a modder?)

      By catcube
      Started November 27, 2018

    • Aeriona
      2
      Forge or mods not working

      By Aeriona
      Started 2 hours ago

  • Who's Online (See full list)

    • Choco
    • Lordyammer
    • Iceo
    • Rixxaw
    • Elrol_Arrowsend
    • ErYizus
    • Nuparu00
    • enduringgamer
    • saxon564
    • imacatlolol
    • Pi Man
    • abesterre
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Crash on server start-up due to custom packets
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community