Posted November 28, 201410 yr Heyho Guys! I created a custom bow for custom arrows. The problem with this thing is, that the arrows rotate while they are flying, but only if the player is in survivalmode. Basically the entity just extends EntityArrow without changing any thing of the movement. I didn't attach a renderer, the default one is used instead. Code of the Arrow: public class EntityMagicArrow extends EntityArrow { public EntityMagicArrow(World world) { super(world); } public EntityMagicArrow(World world, double x, double y, double z) { super(world, x, y, z); } public EntityMagicArrow(World world, EntityLivingBase source, EntityLivingBase target, float f1, float f2) { super(world, source, target, f1, f2); } public EntityMagicArrow(World world, EntityLivingBase source, float speed) { super(world, source, speed); } @Override public void onUpdate() { super.onUpdate(); //No Gravity this.motionY += 0.049999; this.motionX /= 0.99; this.motionY /= 0.99; this.motionZ /= 0.99; if (this.posY > 512) this.kill(); } } http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
November 29, 201410 yr Hi It looks to me like you are trying to undo the motion effects of Entity arrow by guessing what onUpdate did and then undoing it. The reason your arrow is still spinning is because you undo motion but not rotation. I'd suggest the best way to do this is to save a copy of the motionX, Y, Z and the rotationPitch and rotationYaw and overwrite them again afterwards if the arrow hasn't stuck in the ground or bounced off an entity or been destroyed or similar so eg {save motion and rotatino variables} super.onUpdate() if (! inGround && ticksInAir != 0) {copy variables back} -TGG
November 29, 201410 yr Author Yes, this can be the reason, thanks. Only one problem: inGround is private, so I need to use reflection again... I'll try and let you know of it works. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
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.