Posted December 16, 201212 yr Hello, I have this code to spawn a bullet into the world inside the entity of the bullet; super(par1World); Random rand = new Random(); this.shootingEntity = par2EntityLiving; this.setSize(0.5F, 0.5F); this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; this.motionX = (double)(-MathHelper.sin(this.rotationYaw / ((rand.nextFloat() * 10) + 175.0F) * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = (double)(MathHelper.cos(this.rotationYaw / ((rand.nextFloat() * 10) + 175.0F) * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionY = (double)(-MathHelper.sin(this.rotationPitch / ((rand.nextFloat() * 10) + 175.0F) * (float)Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 20F * 1.5F, 1.0F); When this is called upon by the player to shoot the gun it works fine without any problems. However, when this is called upon by a mob to shoot it hits the mob and damages it. The mobs model is ModelBiped so I can't see why this doesn't work.
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.