Jump to content

Mod support for Server from Client (Proxys?)


XenParadox

Recommended Posts

Okay I'm not entirely sure what this means I've tried to figure it out, but not matter how I look at it the only conclusion I can come up with is that It's a proxy issue. My proxys are pretty basic, my clientproxy extends my server/commonproxy which is all it does and my commonproxy renders my models and thrown items. If there is any more info needed to assist me please let me know. I'm not sure why I'm having an issue and if I did something wrong in the beginning I will just blame it on bad Tuts. :P

 

Thanks in Advance,

XenParadox

 

---- Minecraft Crash Report ----
// There are four lights!

Time: 9/1/14 6:40 PM
Description: Exception in server tick loop

java.lang.NoClassDefFoundError: com/eightbittree/xencreepers/mob/ModelFemaleCreeper
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:59)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:492)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:491)
at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:87)
at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:313)
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:117)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:442)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:746)
Caused by: java.lang.ClassNotFoundException: com.eightbittree.xencreepers.mob.ModelFemaleCreeper
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 31 more
Caused by: java.lang.RuntimeException: Attempted to load class com/eightbittree/xencreepers/mob/ModelFemaleCreeper for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174)
... 33 more


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

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows NT (unknown) (amd64) version 6.2
Java Version: 1.7.0, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 974978336 bytes (929 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed
FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed
Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed
xencreepers{1.1} [Female Creepers] (bin) Unloaded
Profiler Position: N/A (disabled)
Is Modded: Definitely; Server brand changed to 'fml,forge'
Type: Dedicated Server (map_server.txt)

Link to comment
Share on other sites

My proxys are pretty basic, my clientproxy extends my server/commonproxy which is all it does and my commonproxy renders my models and thrown items.

What makes you think that the server proxy would have any code to render models or even have rendering code available? It's pretty obvious that you have no idea why a proxy even exists.

FMLSidedProxy is a special kind of object that is instantiated only on one side so it has access to side-specific classes and code. The Common proxy is considered the base class of all sides and is usually an abstract class with no method bodies defined or only code common to both client and server and should never refer to rendering or other client-side classes. Client-proxy is the subclass of common-proxy class (or interface) and is put in the SidedProxy annotation to represent client-side only code.  Server-proxy is the other subclass of commonproxy specified in the annotation. This class will be instantiated when not running on the server. It can uses all the rendering classes and methods of the client. Both of the derived classes can call super(...) if needed for common code.

Which proxy object class will be created and called is automatically determined for you when minecraft runs. The proper object will be put in the field that was annotated (usually proxy). So, common proxy object is normally not used directly; it is only a base class for the proper side-dependent proxy. But, that class is used to declare the proxy field.

Like such:

 

  // Inside my mod class
    @SidedProxy(clientSide = "us.sequitur.metalmod.client.ClientProxy",
                serverSide = "us.sequitur.metalmod.server.ServerProxy",
                modId = MODID) private static CommonProxy            proxy;

CommonProxy is declared in my metalmod.common package. It declares all of the methods that are overridden in ClientProxy and ServerProxy. I make my Common proxy either an interface or an abstract class. That way I will not accidentally try to call it's methods or create it.

public abstract class CommonProxy {
   public abstract void commonMethod(...);
   ...
}
public class ClientProxy extends CommonProxy {
   @Override
   public void commonMethod(...) {
      // do something on the client
      super(...); // not needed here as super is abstract and does nothing
   }
}
public class ServerProxy extends CommonProxy {
    @Override
    public void commonMethod(...) {
       // do something server side
       super(... ); // not needed here as super is abstract and does nothing
       // finish up
    }
}

The above classes go in separate java files.

I hope that explains things.

 

Link to comment
Share on other sites

If you need to see my ModelFemaleCreeper class I'll post it below. However I did have it prefixed with @SideOnly(Side.Client) which I may have done because I was trying to figure out what was updated in forge from 1.6.4 to 1.7.10 when I start updating and I found a fair amount of tuts explaining things that may have f***ed me over. Which is one reason I moved my renders from my ClientProxy to the CommonProxy, it didn't make since to me at the time because I know that rendering is done client side but I wasn't going to go against it because I figured what I was watching had to have some merit to it. Although now I'm doubting it.

 

I did remove the prefix from the ModelFemaleCreeper and I think I've got a different error, I'm not entirely sure because aspects of it look like it's referencing some of the same things, so I'm not sure what the hell is going on at this point. :/

 

package com.eightbittree.xencreepers.mob;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;


public class ModelFemaleCreeper extends ModelBase {
public ModelRenderer head;
public ModelRenderer field_78133_b;
public ModelRenderer body;
public ModelRenderer leg1;
public ModelRenderer leg2;
public ModelRenderer leg3;
public ModelRenderer leg4;
private static final String __OBFID = "CL_00000837";

public ModelFemaleCreeper() {
	this(0.0F);
}

public ModelFemaleCreeper(float par1) {
	byte b0 = 4;
	this.head = new ModelRenderer(this, 0, 0);
	this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
	this.head.setRotationPoint(0.0F, (float) b0, 0.0F);
	this.field_78133_b = new ModelRenderer(this, 32, 0);
	this.field_78133_b.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
	this.field_78133_b.setRotationPoint(0.0F, (float) b0, 0.0F);
	this.body = new ModelRenderer(this, 16, 16);
	this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
	this.body.setRotationPoint(0.0F, (float) b0, 0.0F);
	this.leg1 = new ModelRenderer(this, 0, 16);
	this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
	this.leg1.setRotationPoint(-2.0F, (float) (12 + b0), 4.0F);
	this.leg2 = new ModelRenderer(this, 0, 16);
	this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
	this.leg2.setRotationPoint(2.0F, (float) (12 + b0), 4.0F);
	this.leg3 = new ModelRenderer(this, 0, 16);
	this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
	this.leg3.setRotationPoint(-2.0F, (float) (12 + b0), -4.0F);
	this.leg4 = new ModelRenderer(this, 0, 16);
	this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
	this.leg4.setRotationPoint(2.0F, (float) (12 + b0), -4.0F);
}

/**
 * Sets the models various rotation angles then renders the model.
 */
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
	this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);

	if (this.isChild) {
		float f6 = 2.0F;
		GL11.glPushMatrix();
		GL11.glTranslatef(0.0F, 11.0F * par7, -0.25F * par7);
		this.head.render(par7);
		GL11.glPopMatrix();
		GL11.glPushMatrix();
		GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
		GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
		this.body.render(par7);
		this.leg1.render(par7);
		this.leg2.render(par7);
		this.leg3.render(par7);
		this.leg4.render(par7);
		GL11.glPopMatrix();
	} else {
		this.head.render(par7);
		this.body.render(par7);
		this.leg1.render(par7);
		this.leg2.render(par7);
		this.leg3.render(par7);
		this.leg4.render(par7);
	}
}

/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are
 * used for animating the movement of arms and legs, where par1 represents
 * the time(so that arms and legs swing back and forth) and par2 represents
 * how "far" arms and legs can swing at most.
 */
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {
	this.head.rotateAngleY = par4 / (180F / (float) Math.PI);
	this.head.rotateAngleX = par5 / (180F / (float) Math.PI);
	this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
	this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
	this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
	this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
}
}

 

---- Minecraft Crash Report ----
// I'm sorry, Dave.

Time: 9/2/14 6:48 PM
Description: Exception in server tick loop

java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/Render
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:59)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:492)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
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.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:491)
at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:87)
at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:313)
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:117)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:442)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:746)
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.entity.Render
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 31 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/renderer/entity/Render for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174)
... 33 more


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

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows NT (unknown) (amd64) version 6.2
Java Version: 1.7.0, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 938925848 bytes (895 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed
FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed
Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed
xencreepers{1.1} [Female Creepers] (bin) Unloaded
Profiler Position: N/A (disabled)
Is Modded: Definitely; Server brand changed to 'fml,forge'
Type: Dedicated Server (map_server.txt)

Link to comment
Share on other sites

Nope, that was the first thing I checked when I looked at the new error. if you want to see that class i'll put it below.

 

package com.eightbittree.xencreepers.mob;

import com.eightbittree.xencreepers.XenCrprMain;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;

public class RenderFemaleCreeper extends RenderLiving {
private static final ResourceLocation EntityTexture = new ResourceLocation(XenCrprMain.MODID + ":textures/mob/femcreeper.png");
protected ModelFemaleCreeper model;

public RenderFemaleCreeper(ModelBase par1ModelBase, float par2) {
	super(par1ModelBase, par2);
	model = ((ModelFemaleCreeper)mainModel);
}

public void renderFemaleCreeper(EntityFemaleCreeper entity, double par2, double par4, double par6, float par8, float par9){
	super.doRender(entity, par2, par4, par6, par8, par9);
}

public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){
	renderFemaleCreeper((EntityFemaleCreeper)par1EntityLiving, par2, par4, par6, par8, par9);		
}

public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9){
	renderFemaleCreeper((EntityFemaleCreeper)par1Entity, par2, par4, par6, par8, par9);		
}

@Override
protected ResourceLocation getEntityTexture(Entity var1) {

	return EntityTexture;
}

}

Link to comment
Share on other sites

Hi

 

It looks to me like you are running code on the server side which is trying to create or reference vanilla client-side-only classes (Render or a class inheriting from Render, probably RenderFemaleCreeper).  Perhaps a static client-side-only field? Where are you creating your RenderFemaleCreeper instance?

 

You shouldn't have to add @SideOnly(Side.Client) in front of your classes (at least - I've never had to).  You just need to make sure that none of your server-side code ever refers to vanilla client-side-only classes.

 

ClientProxy: rendering etc; client side only

CommonProxy: things that happen both on client and server.

 

If you're still not sure, this link might help (what sequituri said, with a bit more detail)

 

http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html

 

-TGG

 

PS this is dodgy, delete it....

private static final String __OBFID = "CL_00000837";

Link to comment
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.
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.