Only expose velocity relative tp flags to API (#11532)

Since 1.21.2, vanilla split relative teleportation flags into position
and delta/velocity flags into separate enum entries.
This highlighted a design flaw in the paper api addition for teleport
flags, which just simply mirrored internals while also only being able
to apply the delta/velocity part of a flag, given the teleport target is
always absolute in the API.

This patch proposes to simply no longer expose the non-velocity related
flags to the API, instead marking the entire Relative enum as being
purely velocity related, as non-velocity related flags are not useful to
callers. This was done over simply exposing all internal flags, as
another vanilla change to the internal enum would result in the same
breakage.

The newly proposed API *only* promises that the passed flags prevent the
loss of velocity in the specific axis/context, which should be
independent enough of vanillas specific implementation of this feature.
This commit is contained in:
Bjarne Koll 2024-10-31 17:25:52 +01:00 committed by GitHub
parent 147b7961fe
commit ad9c58e103
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 157 additions and 124 deletions

View file

@ -52,10 +52,10 @@ index 4e47611f85f3db6a638d0fc6a0dd712b245cf229..ebe6a002d883721d80cbfcc004064e8a
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 79eceb995f92b3f3d7b695dc6d2a0a4a824ce871..345d5069d0ebb8ad74158334fd230d0ea64b909d 100644
index f5e05a34afee8f5750b3a7871083968c5d75d2e7..7f1fc7523ff98bf932ffc31035c233f6517e5192 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3448,7 +3448,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3449,7 +3449,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {