Jump to content

Custom particle crash on server only


bltpyro

Recommended Posts

I am trying to get my mod working on a server, and seems to be crashing because of my particles. Single player works fine. I get these errors:

 

cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: bltpyro/mod/truesurvival/particles/EntityMagicStealFX

and further on

Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/particle/EntityFX

 

 

 

which from what I understand has to do with the server trying to use client code. This seems to make sense since net.minecraft.client.particle.EntityFX has @SideOnly(Side.CLIENT), but then I'm trying to register it using

EntityRegistry.registerModEntity(EntityMagicStealFX.class, "MagicStealParticleFX", 30, this, 50, 5, true);

in my main mod file. Is the registering causing a problem on the server because of the @SideOnly(Side.CLIENT)? Is there something I'm doing wrong in how I register the particle? I can't seem to get past this issue. Thanks

Link to comment
Share on other sites

  • 5 months later...

feels weird to bump an old topic, but im having the error of "Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER" and "java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient" when i put the effect on one of my entities! and no i didn't declare it like he did! this is my main particle class:

 

 

package moreores.particles;

public class MoreOresParticleEffects
{
private static Minecraft mc = Minecraft.getMinecraft();
private static World theWorld = mc.theWorld;

public static EntityFX spawnParticle(String particleName, double par2, double par4, double par6, double par8, double par10, double par12)
{
if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null)
{
int var14 = mc.gameSettings.particleSetting;

if (var14 == 1 && theWorld.rand.nextInt(3) == 0)
{
var14 = 2;
}

double var15 = mc.renderViewEntity.posX - par2;
double var17 = mc.renderViewEntity.posY - par4;
double var19 = mc.renderViewEntity.posZ - par6;
EntityFX var21 = null;
double var22 = 16.0D;

if (var15 * var15 + var17 * var17 + var19 * var19 > var22 * var22)
{
return null;
}
else if (var14 > 1)
{
return null;
}
else
{
if (particleName.equals("blueSlime"))
{
				var21 = new EntityBreakingFX(theWorld, par2, par4, par6, MoreOres.blueJelly);
			}


mc.effectRenderer.addEffect((EntityFX)var21);
return (EntityFX)var21;
}
}
return null;
}
}

 

 

 

and this is how i put it in my entity class:

 

 

                MoreOresParticleEffects.spawnParticle("blueSlime", this.posX + (double)f2, this.boundingBox.minY, this.posZ + (double)f3, 0.0D, 0.0D, 0.0D); //i dont think the params matter much for this case

 

 

 

any ideas what i could do to make it not crash the server? xD

 

-sorash67 || Skorpio

 

Link to comment
Share on other sites

great listener by continuing to try to make stupid things by calling particle spawning serverside WHICH YOU SHOULD NEVER DO

 

literally what part of "dont call particle spawning server side" do you not understand? you dont do it. its not a question of @Sideonly its a question of not writing the code 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

declaring and calling mean 2 completelly different thing in coding. its not a question what i WANT to call it its a question of using the right word

since theres only 2 side i would have tought that if its not server side it would be client side

 

you have 2 pot, the cookie is not in the first one, where is it???

 

btw dont answer im not trying anymore

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Well this:

Minecraft.getMinecraft();

Means your on the client side. Always.

 

It is a field in your object or called in its constructor ? Your object is client side.

Thus do not build your object nor call one of its methods on server side.

How to check which side you are on is left as an exercise.

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.