Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using executesNative's getLocation() generates a Location with the wrong pitch and yaw #390

Closed
JorelAli opened this issue Dec 30, 2022 · 0 comments
Labels
bug Something isn't working implemented for next release This has been implemented in the current dev build for the next public release

Comments

@JorelAli
Copy link
Owner

CommandAPI version

8.6.1

Minecraft version

1.19.3

Are you shading the CommandAPI?

No

What I did

  • Using this code:
new CommandAPICommand("fire")
	.executesPlayer((player, args) -> {
		System.out.println(player.getLocation());
		player.launchProjectile(Arrow.class, player.getLocation().getDirection().multiply(2));
	})
	.register();

new CommandAPICommand("fire2")
	.executesNative((sender, args) -> {
		System.out.println(sender.getLocation());
		((Player) sender.getCaller()).launchProjectile(Arrow.class, sender.getLocation().getDirection().multiply(2));
	})
	.register();
  • Stand somewhere (and don't move)
  • Run /fire
  • Run /fire2

What actually happened

  • Running /fire states the pitch (let's call this A) and yaw (let's call this B). An arrow fires in the direction the player is looking at
  • Running /fire2 states the pitch as the value B and yaw as the value A. An arrow fires in some direction that isn't the direction the player is looking at

What should have happened

The pitch and yaw values should be identical between /fire and /fire2

Server logs and CommandAPI config

[23:31:29 INFO]: Skepter issued server command: /fire
[23:31:29 INFO]: Location{world=CraftWorld{name=world},x=79.09897261112293,y=63.0,z=40.51354432320863,pitch=16.050339,yaw=138.16844}
[23:31:31 INFO]: Skepter issued server command: /fire2
[23:31:31 INFO]: Location{world=CraftWorld{name=world},x=79.09897261112293,y=63.0,z=40.51354432320863,pitch=138.16844,yaw=16.050339}

Other

Found by JabberJerry from this comment in the CommandAPI Discord.

@JorelAli JorelAli added bug Something isn't working scheduled for next release This will be implemented for the next public release labels Dec 30, 2022
@JorelAli JorelAli added implemented for next release This has been implemented in the current dev build for the next public release and removed scheduled for next release This will be implemented for the next public release labels Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working implemented for next release This has been implemented in the current dev build for the next public release
Projects
Archived in project
Development

No branches or pull requests

1 participant