PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.66k stars 2.25k forks source link

Teleporting an entity resets its velocity #10201

Open Mitality opened 7 months ago

Mitality commented 7 months ago

Expected behavior

Moving minecart: Using /execute at <minecart> run tp <minecart> ~10 ~ ~ with a moving minecart should quickly move it 10 blocks east, before it would continue to move like normal (works with normal vanilla Minecraft)

Falling creeper: Executing /execute at <creeper> run tp <creeper> ~ ~ ~ on a creeper that is falling from the sky should leave it falling like nothing happened, because it doesn't modify the creepers position at all (also works fine with vanilla Minecraft)

Observed/Actual behavior

Moving minecart: The minecart is quickly moved 10 blocks east, but it then stops, completely losing its momentum.

Falling creeper: The creeper stops mid air, before starting to fall again.

Steps/models to reproduce

  1. Create a default PaperMC 1.20.4 minecraft server.
  2. Log on to the server and have a creeper stand on a block high in the air.
  3. Knock the creeper down, execute /execute at <creeper> run tp <creeper> ~ ~ ~, and watch it stop mid air, before starting to fall again.
  4. Build a track with powered rails and have a minecart move on it from north to south.
  5. Execute /execute at <minecart> run tp <minecart> ~10 ~ ~, and watch the minecart quickly move 10 blocks forward, before it just stops

Plugin and Datapack List

None.

Paper version

[13:36:23 INFO]: This server is running Paper version git-Paper-389 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 848a396)

Other

Velocity seems to be reset for any entity that is teleportet EXCEPT players.

### Tasks
jstN0body commented 7 months ago

From what I can tell, this issue was caused by patch 0430. Not sure if there was a specific reason behind this, as it seems the patch is deliberately resetting entity velocity. I'd be happy to fix this if it needs to be undone.

Mitality commented 7 months ago

I could implement another method to teleport entities with their velocity via a plugin, but because it differs from vanilla gameplay behavior, I'd suggest to fix it... I mean it's a bug, so...

Mitality commented 7 months ago

No idea why that was even changed

Leguan16 commented 7 months ago

No idea why that was even changed

Just as a note why this was added: https://github.com/PaperMC/Paper/pull/4210

ghost commented 6 months ago

Interesting, I do not think this should be changed even though its vanilla behaviour. Removing velocity after a teleport seems more logical.

Mitality commented 6 months ago

That's right, but most datapacks modify entity speed by teleporting them slightly forward... This just stops them on paper now

electronicboy commented 6 months ago

the main reason for the thing resetting of the velocity was to avoid issues with entities having weird movement velocities when teleporting. It would make sense, imho, to retain the velocity when doing relative teleports