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

Teleport with RetainPassengers flag doesn't appear to retain passengers. #11003

Open
ShaneBeee opened this issue Jul 1, 2024 · 1 comment
Open
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.21.4

Comments

@ShaneBeee
Copy link

ShaneBeee commented Jul 1, 2024

Expected behavior

I would expect the passengers of an entity to be able to teleport

Observed/Actual behavior

I noticed when a player is riding an entity, if you teleport it (with flags) the player doesn't get teleported.
The player also gets stuck in some weird limbo.
For example if you move a few chunks, the chunks no longer load, and if you attempt to break a block, nothing.
If I relog, the player is then matched up with their vehicle.

Steps/models to reproduce

Test code to reproduce:

Random random = new Random();
Entity vehicle = player.getVehicle();
World world = vehicle.getWorld();

int x = random.nextInt(10000);
int z = random.nextInt(10000);
Location highest = world.getHighestBlockAt(x, z).getLocation().add(0, 1, 0);

vehicle.teleport(highest, TeleportFlag.EntityState.RETAIN_PASSENGERS);

I simply make myself ride a sheep, and ran a command with that code.

Plugin and Datapack List

[18:17:09 INFO]: Server Plugins (1):
[18:17:09 INFO]: Bukkit Plugins:
[18:17:09 INFO]:  - TestPlugin

Paper version

Paper version 1.21-39-master@aa8d38d

Other

When looking at vanilla NMS Entity#teleportTo, I see they do the following:
(not sure if I can show Mojang code here, so ill just write short form)

this.moveTo(...
this.teleportPassengers();
this.setYHeatRot(...

For testing sakes, I decided to incorporate this into CraftEntity's teleport method:
Screenshot 2024-06-30 at 6 04 53 PM
Did a quick build, and did a few simple test runs, the code I provided above now seems to work flawlessly.

@ShaneBeee ShaneBeee added status: needs triage type: bug Something doesn't work as it was intended to. labels Jul 1, 2024
@papermc-projects papermc-projects bot moved this to 🕑 Needs Triage in Issues: Bugs Jul 1, 2024
@stitchinger
Copy link

Yep, this is still happening.
Teleporting a player is not happening with passenger and RETAIN_PASSENGERS flag

@Warriorrrr Warriorrrr added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.20.4 Game version 1.20.4 and removed status: needs triage labels Dec 27, 2024
@papermc-projects papermc-projects bot moved this from 🕑 Needs Triage to ✅ Accepted in Issues: Bugs Dec 27, 2024
@Warriorrrr Warriorrrr added version: 1.21.4 and removed version: 1.20.4 Game version 1.20.4 labels Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.21.4
Projects
Status: ✅ Accepted
Development

No branches or pull requests

3 participants