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

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();
}
}

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

 

 

 

 

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.