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

@ -2328,10 +2328,10 @@ index ebe6a002d883721d80cbfcc004064e8a57934a56..cce0e570c8217c8e7cc81642d303e1b9
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0d6c3cdd0c8fa8c6983e8a35bac89ff062e1a97f..af3e0049beb5590520ed84b52d6df85ad22a8f23 100644
index c4ffa8519b520e0793af90e149518951d7ffb65b..688916c8fef40d4c81379ad38609a97993b4b702 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2429,30 +2429,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2430,30 +2430,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}