dstars5 Posted May 18, 2013 Share Posted May 18, 2013 Hey guys, So I have what is essentially a custom snowball. I would like it to create particles when it flies. I looked in the bow class, and it uses the function onUpdate() to create the particles if the arrow is a critical hit. However, when I try using this function in the snowball class, the snowball renders, the particles render properly, but the snowball never moves. Anyone know how to fix this? Quote Link to comment Share on other sites More sharing options...
dstars5 Posted May 19, 2013 Author Share Posted May 19, 2013 Does anybody know? I really need this for my mod. Quote Link to comment Share on other sites More sharing options...
M1kep Posted May 19, 2013 Share Posted May 19, 2013 Can you post the code for your snowball class? Quote Link to comment Share on other sites More sharing options...
dstars5 Posted May 20, 2013 Author Share Posted May 20, 2013 Here it is. I have the onUpdate commented out though. package mods.StaffCraft; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityBombProjectile extends EntityThrowable { public int field_92057_e = 1; public EntityBombProjectile(World par1World) { super(par1World); } public EntityBombProjectile(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } public EntityBombProjectile(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } /** * Called when this EntityThrowable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { byte b0 = 99; if (par1MovingObjectPosition.entityHit instanceof EntityBlaze) { b0 = 3; } par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); } for (int i = 0; i < 8; ++i) { this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); if (!this.worldObj.isRemote) { this.setDead(); } } /* public void onUpdate() { ParticleEffects.spawnParticle("fire", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); }*/ /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("ExplosionPower", this.field_92057_e); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); if (par1NBTTagCompound.hasKey("ExplosionPower")) { this.field_92057_e = par1NBTTagCompound.getInteger("ExplosionPower"); } } } Quote Link to comment Share on other sites More sharing options...
Rekkyn Posted May 24, 2013 Share Posted May 24, 2013 Try putting super.onUpdate() in your update method, so that it runs the EntityThrowable update code, which contains the code to make it move. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.