Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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

  • Author

Omg it works, thank you :D

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.