Posted April 21, 201510 yr I don't know what's happening. I'm using the same code as all other projectiles, just heavily simplified without all the criticals/particles/sounds extras but every time I throw the item at a mob it just goes right through them. Why won't this hit mobs? public class EntityThrowingKnife extends EntityThrowable { public EntityThrowingKnife(World world) { super(world); } public EntityThrowingKnife(World world, EntityLivingBase entity) { super(world, entity); } public EntityThrowingKnife(World world, double x, double y, double z) { super(world, x, y, z); } @Override protected void onImpact(MovingObjectPosition mop) { World world = this.worldObj; if (mop.entityHit != null) { mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 5); } if(world.isRemote) { setDead(); } } }
April 21, 201510 yr Author That just makes it crash, repeating this... at net.minecraft.entity.projectile.EntityThrowable.onUpdate(EntityThrowable.java:229) at apocalypse.fandomcraft.horror.EntityThrowingKnife.onImpact(EntityThrowingKnife.java:34) hundreds of times...
April 23, 201510 yr if(world.isRemote) { setDead(); } You're telling the client to kill the entity on impact, not the server... Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 24, 201510 yr if(!world.isRemote) { mop.entityHit.setdead(); } use that instead.. otherwise you're telling the knife to kill itself on the client.
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.