diff --git a/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch b/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch index 4511dc554575..e9d3b9087d72 100644 --- a/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch +++ b/paper-server/patches/features/0001-Moonrise-optimisation-patches.patch @@ -27028,7 +27028,7 @@ index f25d50bcccf9b35ae70f8162c6b2b67fffcd319a..5494b92ab1c3c202a640e483e8a4bcb6 } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 09470e7c4238a66be16b3cf8cf93444700cc2508..55d27aa4cff91ea61ff2ab9256acd2cd8694304a 100644 +index 43ca01dd6b818814387c1d3da101f4e12dbd56a9..03806d85044de907e8f3c5068c27b5d1a64478f1 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -201,7 +201,7 @@ import net.minecraft.world.scores.criteria.ObjectiveCriteria; @@ -28126,7 +28126,7 @@ index 8cc5c0716392ba06501542ff5cbe71ee43979e5d..09fd99c9cbd23b5f3c899bfb00c9b896 + // Paper end - block counting } diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae8c3524e9 100644 +index 43798f035d22c39e369b7ba628e227273a1e2e88..2b6a73dc8380e57b64daaaa0275c505967261a7b 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -152,7 +152,7 @@ import org.jetbrains.annotations.Contract; @@ -28601,7 +28601,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae } public InteractionResult interact(Player player, InteractionHand hand) { -@@ -4318,15 +4555,17 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4325,15 +4562,17 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } public Iterable getIndirectPassengers() { @@ -28627,7 +28627,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae } public int countPlayerPassengers() { -@@ -4475,77 +4714,126 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4482,77 +4721,126 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return Mth.lerp(partialTick, this.yRotO, this.yRot); } @@ -28812,7 +28812,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae public boolean touchingUnloadedChunk() { AABB aabb = this.getBoundingBox().inflate(1.0); -@@ -4705,6 +4993,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4712,6 +5000,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { @@ -28828,7 +28828,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae if (!checkPosition(this, x, y, z)) { return; } -@@ -4854,6 +5151,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4861,6 +5158,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @Override public final void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.@Nullable Cause cause) { // CraftBukkit - add Bukkit remove cause @@ -28841,7 +28841,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers if (this.removalReason == null) { -@@ -4864,7 +5167,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4871,7 +5174,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.stopRiding(); } @@ -28850,7 +28850,7 @@ index 159a2392c7e080da7bc1052ed31eb5964ffe205e..9ba74df17cad8b5039e4657d97daefae this.levelCallback.onRemove(removalReason); this.onRemoval(removalReason); // Paper start - Folia schedulers -@@ -4898,7 +5201,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4905,7 +5208,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name public boolean shouldBeSaved() { return (this.removalReason == null || this.removalReason.shouldSave()) && !this.isPassenger() diff --git a/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch b/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch index 90e87c807793..7856c41dd5b0 100644 --- a/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch +++ b/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch @@ -464,7 +464,7 @@ index 5461bd9a39bb20ad29d3bc110c38860cf35a770a..75f80787966cdda6f51f55a8f6cb2218 public void tick() { super.tick(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 9ba74df17cad8b5039e4657d97daefae8c3524e9..e683302032e1fb4e38eb674472ef7fd22c7ae6e8 100644 +index 2c27c35ced4588fec828e05b75871d4980712d99..65d15bc8eaa20ee3fb78150971b9d10aa75f180e 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -368,6 +368,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name diff --git a/paper-server/patches/features/0007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/paper-server/patches/features/0007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch index 79957e9faa04..028ebc23a06c 100644 --- a/paper-server/patches/features/0007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch +++ b/paper-server/patches/features/0007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch @@ -154,7 +154,7 @@ index 674966c580220a4e0c83a628c763aaea8bfd0b1c..859b859d29b637200cf7c9a0bd52d9f7 public void setControlFlag(Goal.Flag flag, boolean enabled) { diff --git a/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/net/minecraft/world/entity/ai/goal/WrappedGoal.java -index 4bdbd323b642ed3422948fe24780be8b503602dc..2c2ab6a1df9d3d23773e44ce4041cc1c21b55163 100644 +index d0249ae3fee041245445a087dee2bb15a4067fc6..44a7c97164ac7ee731068f909372218350a8682d 100644 --- a/net/minecraft/world/entity/ai/goal/WrappedGoal.java +++ b/net/minecraft/world/entity/ai/goal/WrappedGoal.java @@ -69,7 +69,7 @@ public class WrappedGoal extends Goal { diff --git a/paper-server/patches/features/0009-Handle-Oversized-block-entities-in-chunks.patch b/paper-server/patches/features/0009-Handle-Oversized-block-entities-in-chunks.patch index d1f3ce49f7b9..2b04a30e0fb3 100644 --- a/paper-server/patches/features/0009-Handle-Oversized-block-entities-in-chunks.patch +++ b/paper-server/patches/features/0009-Handle-Oversized-block-entities-in-chunks.patch @@ -9,7 +9,7 @@ creating too large of a packet to sed. Co-authored-by: Spottedleaf diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index de234f220ba09ad9b5e0c8215b49d20ca51d0ac7..e216a9d70be5a3da7c03ee99a8986391ef2dbd5b 100644 +index 7cdac4a18b13805aea60495d369ee7cdd1db784f..919eaac837298c1936ec7aa06375c72a7acd2daa 100644 --- a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -32,6 +32,14 @@ public class ClientboundLevelChunkPacketData { @@ -47,7 +47,7 @@ index de234f220ba09ad9b5e0c8215b49d20ca51d0ac7..e216a9d70be5a3da7c03ee99a8986391 } } diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java -index 3a384175f8e7f204234bbaf3081bdc20c47a0d4b..fdd164cd45a26c7ef25f1153ab8985ba50c01b14 100644 +index 8475c1c3d79e7fae9ab83dea1ac18f7a28ff60bb..3c0f0a612cc57c9f03abfb0ccb1f891305d03d45 100644 --- a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java @@ -71,4 +71,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet client -> server teleport packet cycle, means player ++ // positions can quickly be desynced from their rider position, leading to infinitely growing offsets from their vehicle. ++ // The addition to the teleport transition allows existing callers to this method to not accidentally mutate the entity state. ++ if (teleportTransition.passengerTeleportationMode() == TeleportTransition.PassengerTeleportationMode.POSITION_RIDER) this.positionRider(entity); ++ // Paper end - reposition entity as rider when teleporting via API call + Vec3 vec3 = entity.position().subtract(this.position()); + Vec3 vec31 = teleportTransition.position() + .add( @@ -3099,9 +_,17 @@ } @@ -1585,7 +1599,7 @@ + + public boolean teleportTo(ServerLevel level, double x, double y, double z, Set relativeMovements, float yaw, float pitch, boolean setCamera, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) { + // CraftBukkit end -+ Entity entity = this.teleport(new TeleportTransition(level, new Vec3(x, y, z), Vec3.ZERO, yaw, pitch, relativeMovements, TeleportTransition.DO_NOTHING, cause)); // CraftBukkit ++ Entity entity = this.teleport(new TeleportTransition(level, new Vec3(x, y, z), Vec3.ZERO, yaw, pitch, relativeMovements, TeleportTransition.DO_NOTHING).withCause(cause)); // CraftBukkit return entity != null; } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch index 5baf743b58a9..dfa9de634279 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch @@ -8,7 +8,7 @@ + // Store pre teleportation position as the teleport has been moved up. + final double preTeleportX = serverPlayer.getX(), preTeleportY = serverPlayer.getY(), preTeleportZ = serverPlayer.getZ(); + final float preTeleportYRot = serverPlayer.getYRot(), preTeleportXRot = serverPlayer.getXRot(); -+ ServerPlayer serverPlayer1 = serverPlayer.teleport(new TeleportTransition(serverLevel, vec3, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.ENDER_PEARL)); ++ ServerPlayer serverPlayer1 = serverPlayer.teleport(new TeleportTransition(serverLevel, vec3, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.ROTATION, Relative.DELTA), TeleportTransition.DO_NOTHING).withCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.ENDER_PEARL)); + if (serverPlayer1 == null) { + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); + return; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch index b0a0bea9ebad..bbd7a1e1758b 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch @@ -16,15 +16,16 @@ entity.setAsInsidePortal(this, pos); TheEndGatewayBlockEntity.triggerCooldown(level, pos, state, theEndGatewayBlockEntity); } -@@ -106,9 +_,9 @@ +@@ -106,10 +_,10 @@ return null; } else { return entity instanceof ThrownEnderpearl - ? new TeleportTransition(level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET) -+ ? new TeleportTransition(level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY) // CraftBukkit ++ ? new TeleportTransition(level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET).withCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY) // CraftBukkit - teleport cause : new TeleportTransition( -- level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET -+ level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY // CraftBukkit - ); + level, portalPosition, Vec3.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET +- ); ++ ).withCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY); // CraftBukkit - teleport cause } } else { + return null; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch index d9e3c4ce3361..11dfadd88e05 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch @@ -34,7 +34,7 @@ f = Direction.WEST.toYRot(); f1 = 0.0F; set = Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)); -@@ -96,15 +_,24 @@ +@@ -96,15 +_,25 @@ f1 = respawnData.pitch(); set = Relative.union(Relative.DELTA, Relative.ROTATION); if (entity instanceof ServerPlayer serverPlayer) { @@ -45,9 +45,6 @@ bottomCenter = entity.adjustSpawnLocation(level1, blockPos).getBottomCenter(); } -- return new TeleportTransition( -- level1, bottomCenter, Vec3.ZERO, f, f1, set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET) -- ); + // CraftBukkit start + set.removeAll(Relative.ROTATION); // remove relative rotation flags to simplify event mutation + float absoluteYaw = !flag ? f : entity.getYRot() + f; @@ -57,9 +54,11 @@ + return null; + } + org.bukkit.Location to = result.to(); -+ -+ return new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3(to), Vec3.ZERO, to.getYaw(), to.getPitch(), set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL); + // CraftBukkit end + return new TeleportTransition( + level1, bottomCenter, Vec3.ZERO, f, f1, set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET) +- ); ++ ).withChangedLocation(to).withCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - portal event & cause } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch index 30b239c9d2f8..ed254cfa46e4 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch @@ -122,7 +122,7 @@ Vec3 vec3 = new Vec3(blockPos.getX() + (flag ? d2 : d4), blockPos.getY() + d3, blockPos.getZ() + (flag ? d4 : d2)); Vec3 vec31 = PortalShape.findCollisionFreePosition(vec3, level, entity, dimensions); - return new TeleportTransition(level, vec31, Vec3.ZERO, i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), postTeleportTransition); -+ return new TeleportTransition(level, vec31, Vec3.ZERO, i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), postTeleportTransition, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit ++ return new TeleportTransition(level, vec31, Vec3.ZERO, i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), postTeleportTransition).withCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/portal/TeleportTransition.java.patch b/paper-server/patches/sources/net/minecraft/world/level/portal/TeleportTransition.java.patch index e497a2065335..58282a41137e 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/portal/TeleportTransition.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/portal/TeleportTransition.java.patch @@ -1,74 +1,144 @@ --- a/net/minecraft/world/level/portal/TeleportTransition.java +++ b/net/minecraft/world/level/portal/TeleportTransition.java -@@ -21,11 +_,18 @@ +@@ -21,7 +_,108 @@ boolean asPassenger, Set relatives, TeleportTransition.PostTeleportTransition postTeleportTransition -+ , org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause // CraftBukkit ++ // Paper start - additional transition data ++ , org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause, ++ PassengerTeleportationMode passengerTeleportationMode ) { - public static final TeleportTransition.PostTeleportTransition DO_NOTHING = entity -> {}; - public static final TeleportTransition.PostTeleportTransition PLAY_PORTAL_SOUND = TeleportTransition::playPortalSound; - public static final TeleportTransition.PostTeleportTransition PLACE_PORTAL_TICKET = TeleportTransition::placePortalTicket; - -+ // CraftBukkit start -+ public TeleportTransition(ServerLevel newLevel, Vec3 position, Vec3 deltaMovement, float yRot, float xRot, boolean missingRespawnBlock, boolean asPassenger, Set relatives, TeleportTransition.PostTeleportTransition postTeleportTransition) { -+ this(newLevel, position, deltaMovement, yRot, xRot, missingRespawnBlock, asPassenger, relatives, postTeleportTransition, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN); -+ } -+ // CraftBukkit end + - public TeleportTransition( - ServerLevel newLevel, Vec3 position, Vec3 deltaMovement, float yRot, float xRot, TeleportTransition.PostTeleportTransition postTeleportTransition - ) { -@@ -41,7 +_,21 @@ - Set relatives, - TeleportTransition.PostTeleportTransition postTeleportTransition - ) { -- this(newLevel, position, deltaMovement, yRot, xRot, false, false, relatives, postTeleportTransition); -+ // CraftBukkit start -+ this(newLevel, position, deltaMovement, yRot, xRot, relatives, postTeleportTransition, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN); ++ public enum PassengerTeleportationMode { ++ RELATIVE, ++ POSITION_RIDER + } ++ ++ // Vanilla compat constructor + public TeleportTransition( -+ ServerLevel newLevel, -+ Vec3 position, -+ Vec3 deltaMovement, -+ float yRot, -+ float xRot, -+ Set relatives, -+ TeleportTransition.PostTeleportTransition postTeleportTransition, -+ org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause ++ final ServerLevel newLevel, ++ final Vec3 position, ++ final Vec3 deltaMovement, ++ final float yRot, ++ final float xRot, ++ final boolean missingRespawnBlock, ++ final boolean asPassenger, ++ final Set relatives, ++ final TeleportTransition.PostTeleportTransition postTeleportTransition + ) { -+ this(newLevel, position, deltaMovement, yRot, xRot, false, false, relatives, postTeleportTransition, cause); -+ // CraftBukkit end - } - - private static void playPortalSound(Entity entity) { -@@ -100,7 +_,8 @@ - this.missingRespawnBlock(), ++ this( ++ newLevel, ++ position, ++ deltaMovement, ++ yRot, ++ xRot, ++ missingRespawnBlock, ++ asPassenger, ++ relatives, ++ postTeleportTransition, ++ org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN, ++ PassengerTeleportationMode.RELATIVE ++ ); ++ } ++ ++ public TeleportTransition withChangedLocation(final org.bukkit.Location location) { ++ return new TeleportTransition( ++ ((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle(), ++ org.bukkit.craftbukkit.util.CraftLocation.toVec3(location), ++ this.deltaMovement(), ++ location.getYaw(), ++ location.getPitch(), ++ this.missingRespawnBlock(), ++ this.asPassenger(), ++ this.relatives(), ++ this.postTeleportTransition(), ++ this.cause(), ++ this.passengerTeleportationMode() ++ ); ++ } ++ ++ public TeleportTransition withVelocity(final Vec3 velocity) { ++ return new TeleportTransition( ++ this.newLevel(), ++ this.position(), ++ velocity, ++ this.yRot(), ++ this.xRot(), ++ this.missingRespawnBlock(), ++ this.asPassenger(), ++ this.relatives(), ++ this.postTeleportTransition(), ++ this.cause(), ++ this.passengerTeleportationMode() ++ ); ++ } ++ ++ public TeleportTransition withRelatives(final Set relatives) { ++ return new TeleportTransition( ++ this.newLevel(), ++ this.position(), ++ this.deltaMovement(), ++ this.yRot(), ++ this.xRot(), ++ this.missingRespawnBlock(), ++ this.asPassenger(), ++ relatives, ++ this.postTeleportTransition(), ++ this.cause(), ++ this.passengerTeleportationMode() ++ ); ++ } ++ ++ public TeleportTransition withCause(final org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) { ++ return new TeleportTransition( ++ this.newLevel(), ++ this.position(), ++ this.deltaMovement(), ++ this.yRot(), ++ this.xRot(), ++ this.missingRespawnBlock(), ++ this.asPassenger(), ++ this.relatives(), ++ this.postTeleportTransition(), ++ cause, ++ this.passengerTeleportationMode() ++ ); ++ } ++ // Paper end - additional transition data ++ + public static final TeleportTransition.PostTeleportTransition DO_NOTHING = entity -> {}; + public static final TeleportTransition.PostTeleportTransition PLAY_PORTAL_SOUND = TeleportTransition::playPortalSound; + public static final TeleportTransition.PostTeleportTransition PLACE_PORTAL_TICKET = TeleportTransition::placePortalTicket; +@@ -101,6 +_,10 @@ this.asPassenger(), this.relatives(), -- this.postTeleportTransition() -+ this.postTeleportTransition(), -+ this.cause() // Paper - keep cause + this.postTeleportTransition() ++ // Paper start - keep additional data ++ , this.cause(), ++ this.passengerTeleportationMode() ++ // Paper end - keep additional data ); } -@@ -114,7 +_,8 @@ - this.missingRespawnBlock(), +@@ -115,6 +_,10 @@ this.asPassenger(), this.relatives(), -- this.postTeleportTransition() -+ this.postTeleportTransition(), -+ this.cause() // Paper - keep cause + this.postTeleportTransition() ++ // Paper start - keep additional data ++ , this.cause(), ++ this.passengerTeleportationMode() ++ // Paper end - keep additional data ); } -@@ -128,7 +_,8 @@ - this.missingRespawnBlock(), +@@ -129,6 +_,10 @@ true, this.relatives(), -- this.postTeleportTransition() -+ this.postTeleportTransition(), -+ this.cause() // Paper - keep cause + this.postTeleportTransition() ++ // Paper start - keep additional data ++ , this.cause(), ++ this.passengerTeleportationMode() ++ // Paper end - keep additional data ); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 2a572ef0ba74..48d6847fe483 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -316,9 +316,12 @@ protected boolean teleport0(Location location, TeleportCause cause, TeleportFlag Vec3.ZERO, location.getYaw(), location.getPitch(), + false, + false, relativeFlags, TeleportTransition.DO_NOTHING, - cause + cause, + TeleportTransition.PassengerTeleportationMode.POSITION_RIDER )) != null; }