Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Yes, yes, I know this "if you don't know what are you doing, don't do it" and "you shouldn't use it" arguments. But I am simply experimenting with classLoaders.

 

Common Proxy (when you launch server):

public void initNetwork()
{
try
{
	theNetwork = ServerNetwork.class.newInstance();
}
catch (Exception e)
{
	RoAMain.log.log(Level.FATAL, "Could not initialize server network! A lot of errors can be expected.");
}
}

ClientProxy (for clients):

@Override
public void initNetwork()
{
theNetwork = new ClientNetwork();
}

 

theNetwork is AbstractNetwork

ServerNetwork extends AbstractNetwork is @SideOnly(Side.SERVER)

ClientNetwork extends AbstractNetwork is @SideOnly(Side.CLIENT)

 

Question is quite simple: Is what I done above (#newInstance()) only way of avoiding NoClassDefFound?

Obviously when you use theNetwork = new ServerNetwork(); It will crash, and above is only thing I could think of.

 

Reflection is evil in my case (above is not it, above is an example).

 

Thanks.

 

EDIT

Oh and before someone asks - the @SideOnly is not used because I want it to be there, it is there because I want to simulate classes not being there in my dev env (because they are not there in real-life).

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Reflection is evil in my case (above is not it, above is an example).

 

Network might have been bad naming here. Even if network would be the actual network, it wouldn't matter - integrated server won't even use what I am doing (it's being developed as dedicated server feature - server sends and makes client load classes, don't ask xD, and yes, it's secured).

 

EDIT

Basically - is there a way to make instance of class that is @SideOnly without reflection?

1.7.10 is no longer supported by forge, you are on your own.

  • Author

How could I not think of this :P

 

Thanks m8, as always.

1.7.10 is no longer supported by forge, you are on your own.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.