Jump to content

Recommended Posts

Posted

Hey guys,

I need some help with my entity. I created a a gun which shoots my own entity extends from entityThrowable, but in fact it spawns in my own Player. I already tried a few stuff but nothing worked good, I tried to spown it somewhere out of my character, but then it isn't in the middl of the screen. Do you have any Idea what I can do to fix the problem?

public EntityBullet(World world, EntityLivingBase entity, float damage) {
	super(world, entity);
	this.thrower = entity;
        this.setSize(0.25F, 0.25F);
        this.setLocationAndAngles(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.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;
        float f = 0.4F;
        this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
        this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
        this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * f);
        this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 1.0F);
}
@Override
protected void entityInit() {


}
@Override
public void readEntityFromNBT(NBTTagCompound p_70037_1_) {


}
@Override
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {

}
@Override
protected void onImpact(MovingObjectPosition mop) {
	if(mop.entityHit instanceof EntityPlayerMP){
		if(mop.entityHit != null && !(mop.entityHit instanceof EntityPlayerMP)){
			mop.entityHit.attackEntityFrom(DamageSourceAdvGuns.causeBulletDamage(this, getThrower()), 10F);
			System.out.println(mop.entityHit);

		}else{

		}
		setDead();
	}else{
		System.out.println("Player");

	}
}
public float getGravityVelocity(){
	return 0;
}


}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

Do you mean the float damage in the Constructor? Ialready set the Damage in the onImpact Method, so I dontknow what you exactly mean

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.