Jump to content

Recommended Posts

Posted

Hey guys,

 

So I have made a small cosmetic mod that adds in some different blocks. Everything is working fine on the client side. But when I try to add my mod to my server, the server crashes at start-up. This made me think if there's something I need to add in one of my proxies, or somewhere else, to make my mod work on servers. I don't know much about proxies so I have no idea. I'm also a novice in modding, so I don't know much in general about modding.

I have looked at some modders source code, but some seem to do nothing special in the proxies, while others seems to have lots of code in them. My problem is that I can't really tell if the code is for server stuff.

 

My proxy classes is inside the spoiler

 

 

public class ClientProxy extends CommonProxy
{
@Override
public void registerRenders()
{
	HaWMBlocks.registerRenders();
	HaWMItems.registerRenders();
}
}

public class CommonProxy
{
public void registerRenders()
{

}
}

 

 

Posted

If your mod works on the client but crashes the dedicated server, you're most likely using client-only classes from common code.

 

You've given us very little information to work with, so we can't really be more specific than that. Show us the crash report and the classes mentioned in it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

If your mod works on the client but crashes the dedicated server, you're most likely using client-only classes from common code.

 

You've given us very little information to work with, so we can't really be more specific than that. Show us the crash report and the classes mentioned in it.

 

Crash report

 

 

---- Minecraft Crash Report ----

// I bet Cylons wouldn't have this problem.

 

Time: 05-05-16 16:38

Description: Exception in server tick loop

 

net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/block/statemap/IStateMapper

at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:162)

at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:543)

at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:87)

at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:320)

at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:115)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:508)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/block/statemap/IStateMapper

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:468)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:512)

... 5 more

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.block.statemap.IStateMapper

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 30 more

Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@269f4bad from coremod FMLCorePlugin

at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234)

at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)

... 32 more

Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/renderer/block/statemap/IStateMapper for invalid side SERVER

at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49)

at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230)

... 34 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.8.9

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_91, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 873960904 bytes (833 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP 9.19 Powered by Forge 11.15.1.1722 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UC mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UC FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1722.jar)

UC Forge{11.15.1.1722} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1722.jar)

UE hawm{1.0.b} [Hedges And Walls Mod] (bin)

Loaded coremods (and transformers):

Profiler Position: N/A (disabled)

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

 

 

Not sure what classes you need. But are you saying that I can't use stuff like @SideOnly(Side.CLIENT) in my mod?

Posted

If a class, field or method is marked with

@SideOnly(Side.CLIENT)

, it doesn't exist on the dedicated server and can't be used in common code. You must ensure that you don't reference client-only things outside of client-only code (e.g. your client proxy or a

World#isRemote

check). This page explains sides in more detail. This thread explains why you shouldn't use

@SideOnly

yourself.

 

In this case, you tried to use

IStateMapper

outside of client-only code.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

If a class, field or method is marked with

@SideOnly(Side.CLIENT)

, it doesn't exist on the dedicated server and can't be used in common code. You must ensure that you don't reference client-only things outside of client-only code (e.g. your client proxy or a

World#isRemote

check). This page explains sides in more detail. This thread explains why you shouldn't use

@SideOnly

yourself.

 

In this case, you tried to use

IStateMapper

outside of client-only code.

 

Ok, so I have removed alle the @SideOnly(Side.CLIENT) code from my mod, and everything seems to still be working, not sure why I had them in my code. I also had to remove ModelLoader.setCustomStateMapper(HaWMBlocks.wall_stonebrick, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build()); from my code, but that leaves me with a huge problem, as this code removes the variants from blockwall, which I need to do otherwise the block will not have textures. Is there a way to use that code, without having a server crashing?

Posted

Ok, so I have removed alle the @SideOnly(Side.CLIENT) code from my mod, and everything seems to still be working, not sure why I had them in my code. I also had to remove ModelLoader.setCustomStateMapper(HaWMBlocks.wall_stonebrick, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build()); from my code, but that leaves me with a huge problem, as this code removes the variants from blockwall, which I need to do otherwise the block will not have textures. Is there a way to use that code, without having a server crashing?

 

Move the client-only code to your client proxy (or a class called from it).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Move the client-only code to your client proxy (or a class called from it).

 

Things seem to be working, however I have encountered a major problem. With the mod installed I can't join any servers, doesn't matter if the server has my mod or not, i just get the message "Failed to login: Invalid session (Try restarting your game)", but that doesn't help. On client side, everything is still working as it should. I know that you guys can't really help with the server joining issue. But I thank you for your time and expertise. Now I just need to figure out the heck is wrong :P

Posted

That just means you are not logged in (as is the case by default in the development environment). Either put the server into offline mode or start the game with --username <u> and --password <p> using your mojang credentials to log you in.

I have already tried that :)

Posted

If the login failed it will say so in the log.

If it succeeded you will not get that error message.

 

This is so strange, it works now... I closed eclipse and re-opened it again, and now it works :P

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.