Posted December 29, 201311 yr So.... I tried some things.... Screwed a lot of them up... And I finally thought of this. I wanted to spawn a lightning bolt in the world whenever my custom projectile hit a block. One problem. The lightning does not appear. Oh, it lights the stuff on fire, makes the noise, and all that great stuff, even spawns the smoke particles I didn't even know appeared... But it doesn't render... What am I doing wrong? package net.CJCutrone.LegendofZelda.entity.Entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class EntityLightning extends EntityThrowable { public EntityLightning(World par1World) { super(par1World); } public EntityLightning(World par1World, EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); } @SideOnly(Side.CLIENT) public EntityLightning(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (!this.worldObj.isRemote) { double i = par1MovingObjectPosition.blockX; double j = par1MovingObjectPosition.blockY; double k = par1MovingObjectPosition.blockZ; worldObj.spawnEntityInWorld(new EntityLightningBolt(worldObj, i, j, k)); this.setDead(); } } public void setVelocity(double par1, double par3, double par5) { this.motionX = par1; this.motionY = par3; this.motionZ = par5; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)f) * 180.0D/ Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } } @Override protected float getGravityVelocity() { return 0.005F; } public float getShadowSize() { return 0.0F; } }
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.