8000 Using executesNative's getLocation() generates a Location with the wrong pitch and yaw · Issue #390 · CommandAPI/CommandAPI · GitHub
[go: up one dir, main page]

Skip to content
Using executesNative's getLocation() generates a Location with the wrong pitch and yaw #390
Closed
@JorelAli

Description

@JorelAli

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingimplemented for next releaseThis has been implemented in the current dev build for the next public release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0