Skip to content

Fix API teleport when Player is passenger #12740

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Doc94
Copy link
Contributor

@Doc94 Doc94 commented Jun 25, 2025

This close #12737
currently the API with the passengers flags works for normal entities but when the passenger is a player this not works, the PR move that logic when need teleport and retain-passengers to use the NMS teleport like happen with crossDimension teleport and if not just use the snapTo

@Doc94 Doc94 requested a review from a team as a code owner June 25, 2025 15:19
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Jun 25, 2025
@Doc94
Copy link
Contributor Author

Doc94 commented Jun 25, 2025

An example running

this.getServer().getCommandMap().register("fallback", new BukkitCommand("test1", "cool hi command", "<>", List.of("hialias")) {
            @Override
            public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
                if (sender instanceof Player player) {
                    Entity vehicle = player.getVehicle();
                    if (vehicle != null) {
                        vehicle.teleport(vehicle.getLocation().clone().add(0, 5, 0), TeleportFlag.EntityState.RETAIN_VEHICLE, TeleportFlag.EntityState.RETAIN_PASSENGERS);

                    }
                }
                return true;
            }
        });
2025-06-25_11-21-14.mp4

@Clexus
Copy link

Clexus commented Jun 26, 2025

I want to mention that the retain_vehicle flag also doesn't work for non-player entities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

RETAIN_VEHICLE doesn't work anymore
2 participants