Posted March 31, 201510 yr So, I added EntityFX derived particles, and the dedicated server crashes on startup, because: Attempted to load class net/minecraft/client/particle/EntityFX for invalid side SERVER The issue is, I surrounded all creation of instances of the EntityFX derived classes with world.isRemote checks, and the error hasn't gone away, so I'm not sure what's wrong here. Example
March 31, 201510 yr You should not ever use client-only methods/class if it is neither in proxy nor with sideonly annotation, even if you have something like if(worldObj.isRemote). Although it would never be called, The code snippet will be loaded anyway. I recommend you to move the EntityFX spawning code into the proxy class. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
March 31, 201510 yr Author Yeah I was suspecting I needed to do that, but had to go to bed after posting that message
March 31, 201510 yr Author So, what should I be doing for the particles made inside onUpdate() in the entity an item fires? I need to give the particle constructor a world object, which I'm going to have to get by getting the player via their entity ID then getting the worldObj from that afaik, but I don't have access to the player to be able to get their ID in onUpdate, so what should I do about that? Also, the particles made in clientProxy from the item right click don't show up in SMP, but they show up in SSP.
April 1, 201510 yr Author Nevermind, I was being a derp. But now this brings up a bigger issue, the release/firing of the beam from the light staff crashes the server in SMP, all particles crash SSP with java.lang.NullPointerException: Unexpected error at net.minecraft.entity.Entity.getBrightnessForRender(Entity.java:1214) at net.minecraft.client.particle.EffectRenderer.renderLitParticles(EffectRenderer.java:215) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1347) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057) at net.minecraft.client.Minecraft.run(Minecraft.java:951) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) And everything besides the light staff firing (it has a charge period, which spawns particles, then release like a bow to fire) gives continual errors on SMP: java.lang.NullPointerException at cpw.mods.fml.common.network.FMLOutboundHandler$OutboundTarget$5.selectNetworks(FMLOutboundHandler.java:129) at cpw.mods.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:273) at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:637) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:115) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToAll(SimpleNetworkWrapper.java:182) at izzyaxel.arcaneartificing.entity.BlazeBeam.onUpdate(BlazeBeam.java:68) at izzyaxel.arcaneartificing.entity.BlazeBeam.updateUntilDead(BlazeBeam.java:101) at izzyaxel.arcaneartificing.items.staves.ItemBlazeStaff.onUsingTick(ItemBlazeStaff.java:36) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:273) at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) at net.minecraft.world.World.updateEntity(World.java:2258) at net.minecraft.world.World.updateEntities(World.java:2108) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2087) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1029) at net.minecraft.client.Minecraft.run(Minecraft.java:951) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) Misc: Main Client Proxy Message/Handler Items: Blaze Staff Healing Staff Light Staff Magnet Entities: Blaze Beam Healing Beam Light Beam Particles: Blaze Beam FX Healing Beam Core FX Healing Beam FX Light Beam Core FX Light Beam FX Light Charge Ball FX Light Charge FX Light Charge Full FX Warp FX
April 1, 201510 yr You're sending the packet to the server. Just do "sendTo" not "sendToAll". I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 1, 201510 yr Author Is the comment wrong then? It says sendToAll is client side, and if I cant use that, then should I use sendToAllAround to get the other players too? And how am I getting the player instance inside onUpdate in the entity classes?
April 1, 201510 yr Because this is a client class, you can get the instance of Minecraft "Minecraft mc = Minecraft.getMinecraft" and use the "thePlayer". I believe when you do sendToAll, it thinks there is more than one player. Just try my idea and see if it works. If it doesn't, then your packet is returning null. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 1, 201510 yr Author That gets rid of most of the crashes, but the particles still aren't showing up on SSP or SMP, the light beam entity crashes the server when spawned in SMP because I had no isRemote check around it which I go into later, it works fine in SSP, and none of the other entities are getting spawned at all. I then realized I had limited the entity spawning to the client side on everything except the light beam, which I forgot to put an isRemote around, which was the cause for the crash, and for the rest, of course was doing nothing because you dont spawn entities client side, but I can't change that to server side, or it'll crash because of the client sided stuff I'm now doing inside the entity class. What do?
April 1, 201510 yr Hm. You load the entity texture in your client proxy, correct? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 1, 201510 yr Author The entity doesn't have a texture, I'm using its position to spawn particles, though giving the entity a texture sounds like it'd be useful to replace the core FXs, I didn't know you could do that.
April 1, 201510 yr Author I did a bit of experimenting, and discovered I have to use sendToAll when the packet sending is inside an entity, so now everything works on SSP, albeit the particles spawned within an item class are offset down at the player's feet, but in SMP, all 3 entities created by these staves crash the server on creation. PS sendToAll works everywhere, so using that instead.
April 1, 201510 yr If you got a crash, post the crash report. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
April 1, 201510 yr Author Description: Exception in server tick loop java.lang.NoSuchMethodError: izzyaxel.arcaneartificing.entity.LightBeam.setVelocity(DDD)V at izzyaxel.arcaneartificing.entity.LightBeam.<init>(LightBeam.java:36) at izzyaxel.arcaneartificing.items.staves.ItemLightStaff.onPlayerStoppedUsing(ItemLightStaff.java:94) at net.minecraft.item.ItemStack.onPlayerStoppedUsing(ItemStack.java:500) at net.minecraft.entity.player.EntityPlayer.stopUsingItem(EntityPlayer.java:232) at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:473) at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61) at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) So, it didn't like this.setVelocity, which I didn't know was client sided until this prompted me to read the comments on that function, so changed it to this.motionX /= 10 etc and the entites spawn fine now. I changed it to check for client and then directly spawn particles in the entity classes, but the particles on the beam still aren't spawning on SMP, and don't spawn on SSP anymore. public class LightBeam extends EntityThrowable { Vector3 movVec; final int maxTicks = 150; public LightBeam(World world, EntityLivingBase elb) { super(world, elb); this.motionX /= 10; this.motionY /= 10; this.motionZ /= 10; movVec = new Vector3(this.motionX, this.motionY, this.motionZ); } @Override protected void onImpact(MovingObjectPosition mop) { if(mop.entityHit != null) { if(mop.entityHit != this.getThrower() && this.getThrower() instanceof EntityPlayer && mop.entityHit instanceof EntityLiving) { EntityLiving mob = (EntityLiving)mop.entityHit; double x, y, z; Random rand = new Random(); for(int i = 0; i < 20; i++) { x = mob.posX + (rand.nextInt(2) - 1 * rand.nextFloat()); y = mob.posY; z = mob.posZ + (rand.nextInt(2) - 1 * rand.nextFloat()); if(worldObj.isRemote) { ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamHitFX, x, y + 1, z, (x - mob.posX) * 0.01, 0, (z - mob.posZ) * 0.01, 10, 300); ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamHitFX, x, y + 1, z, (x - mob.posX) / 2, (y - mob.posY) / 2, (z - mob.posZ) / 2, 10, 5); } } mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 300, 10)); } return; } } @Override public void onUpdate() { motionX = movVec.x; motionY = movVec.y; motionZ = movVec.z; super.onUpdate(); Random rand = new Random(); double x, y, z, x2, y2, z2; for(int i = 0; i < 2; i++) { x = posX + rand.nextInt(2) - 1 * rand.nextFloat(); y = posY + rand.nextInt(2) - 1 * rand.nextFloat(); z = posZ + rand.nextInt(2) - 1 * rand.nextFloat(); x2 = (x - posX) / 15; y2 = (y - posY) / 15; z2 = (z - posZ) / 15; if(worldObj.isRemote) { ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamFX, x, y, z, x2, y2, z2, 20, 12); } } if(worldObj.isRemote) { ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamCoreFX, posX, posY, posZ, 0, 0, 0, 10, 5); } ++ticksExisted; if(ticksExisted >= maxTicks) { setDead(); } } @Override public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { super.setThrowableHeading(par1, par3, par5, par7, par8); float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); par1 /= (double)f2; par3 /= (double)f2; par5 /= (double)f2; par1 += 0.007499999832361937D * (double)par8; par3 += 0.007499999832361937D * (double)par8; par5 += 0.007499999832361937D * (double)par8; par1 *= (double)par7; par3 *= (double)par7; par5 *= (double)par7; this.motionX = par1; this.motionY = par3; this.motionZ = par5; } public void updateUntilDead() { while(!isDead) { onUpdate(); } } @Override protected float getGravityVelocity() { return 0F; }}
April 1, 201510 yr Author It was a leftover !world.isRemote check for spawning the entity. Strangely, the particles in onImpact still aren't spawning, do I need packets for those? @Override protected void onImpact(MovingObjectPosition mop) { if(mop.entityHit != null) { if(mop.entityHit != this.getThrower() && this.getThrower() instanceof EntityPlayer && mop.entityHit instanceof EntityLiving) { EntityLiving mob = (EntityLiving)mop.entityHit; double x, y, z; Random rand = new Random(); for(int i = 0; i < 20; i++) { x = mob.posX + (rand.nextInt(2) - 1 * rand.nextFloat()); y = mob.posY; z = mob.posZ + (rand.nextInt(2) - 1 * rand.nextFloat()); if(worldObj.isRemote) { ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamHitFX, x, y + 1, z, (x - mob.posX) * 0.01, 0, (z - mob.posZ) * 0.01, 10, 300); ArcaneArtificing.proxy.doParticles(worldObj, Reference.LightBeamHitFX, x, y + 1, z, (x - mob.posX) / 2, (y - mob.posY) / 2, (z - mob.posZ) / 2, 10, 5); } } mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 300, 10)); } return; } }
April 1, 201510 yr Author Ok, thanks, now everything is working how it should, and I've learned a lot.
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.