Posted July 7, 201312 yr hello guys it's again me with my entity now what i want to ask is if there is a specific code for if an entity projectile hits a block i wanna have that my entity projectile only explodes on block but now it's also exploding on entitys, so yeah... corect my code please package invizzble.mods.nc.entities.projectiles; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityWeatherEffect; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityStaffODarknessAmmo extends EntityThrowable{ public EntityStaffODarknessAmmo(World par1World) { super(par1World); } public EntityStaffODarknessAmmo(World par1World,EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); } private int explosionRadius= 3; @Override protected void onImpact(MovingObjectPosition par1Movingobjectposition) { if (par1Movingobjectposition.entityHit != null) { byte b0 = 30; par1Movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0); this.setDead(); } if(!this.worldObj.isRemote){ this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, explosionRadius, true); this.setDead(); } } @Override protected float getGravityVelocity() { return 0F; } } http://i.imgur.com/sKDS7bj.png[/img] http://www.minecraftforum.net/topic/1877292-15x-forge-smp-nightmarecraft-alpha-10-it-started-with-a-dream-new/
July 8, 201312 yr Look at MovingObjectPosition.typeOfHit. Also, I don't believe you should be calling setDead on the client for an entity which exists on both the client and the server.
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.