Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<Entity> getIndirectPassengers() {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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();
}

Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ creating too large of a packet to sed.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>

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 {
Expand Down Expand Up @@ -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<ClientGamePa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ index db2054e84f5717a37683d57890dcd585769effbc..f0bfc37a0802397da1462e545e48f83d
// Paper start - add close param
this.save(progress, flush, skipSave, false);
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 55d27aa4cff91ea61ff2ab9256acd2cd8694304a..d4466c7d30f47614a70d9ef24002a2d39182b8f6 100644
index 03806d85044de907e8f3c5068c27b5d1a64478f1..eb3fe979b4e3feb7820200b5584db96b4b395c58 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -203,6 +203,7 @@ import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ index 47f34dfddfb1cce87e08c9eb93ad5b2b23c1075b..9934055a994c10d646d97a2d042d0e8b
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
profilerFiller.push("commandFunctions");
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index e683302032e1fb4e38eb674472ef7fd22c7ae6e8..5b0a22b637841e2fdaa52396c6490936e3e1cd23 100644
index 94ef81ae1e332b5c3879a6db8465e7c6d42d1963..20ece77fbd0315050cc9fff8499baae8671f485d 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -5218,6 +5218,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
@@ -5225,6 +5225,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
this.getBukkitEntity().taskScheduler.retire();
}
// Paper end - Folia schedulers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ index 75fe6e026e3f91b66dcf5b97a86491d5277f7661..9b8222bda0f119f272d90f980c9f9540
profiler.popPush("tickSpawningChunks");

diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index d4466c7d30f47614a70d9ef24002a2d39182b8f6..a98eb760677b0337d2da9560148a55862fc4d721 100644
index eb3fe979b4e3feb7820200b5584db96b4b395c58..345574c5eb2432bb33517b593c907d6ced500af8 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -409,6 +409,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ index 9b8222bda0f119f272d90f980c9f9540211af84a..af67b07722bb0125acd081dab767d7e7
spawnState = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true);
} else {
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index a98eb760677b0337d2da9560148a55862fc4d721..c855c48ede60eb744cc65e1b560b9a7a3417d8aa 100644
index 345574c5eb2432bb33517b593c907d6ced500af8..c1089477a6fa8f93ed4a86f5d40dcc9e8a4bbfaf 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -413,6 +413,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@
}
}

@@ -989,25 +_,95 @@
@@ -989,25 +_,84 @@
}

private boolean isPvpAllowed() {
Expand Down Expand Up @@ -694,18 +694,7 @@
+ location = respawnEvent.getRespawnLocation();
+
+ return new RespawnResult(
+ new TeleportTransition(
+ ((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle(),
+ org.bukkit.craftbukkit.util.CraftLocation.toVec3(location),
+ teleportTransition.deltaMovement(),
+ location.getYaw(),
+ location.getPitch(),
+ teleportTransition.missingRespawnBlock(),
+ teleportTransition.asPassenger(),
+ teleportTransition.relatives(),
+ teleportTransition.postTeleportTransition(),
+ teleportTransition.cause()
+ ),
+ teleportTransition.withChangedLocation(location),
+ isBedSpawn,
+ isAnchorSpawn
+ );
Expand Down Expand Up @@ -750,7 +739,7 @@
if (this.isRemoved()) {
return null;
} else {
@@ -1083,13 +_,48 @@
@@ -1083,13 +_,38 @@

ServerLevel level = teleportTransition.newLevel();
ServerLevel serverLevel = this.level();
Expand All @@ -776,17 +765,7 @@
+ }
+ if (!newExit.equals(exit)) {
+ level = ((org.bukkit.craftbukkit.CraftWorld) newExit.getWorld()).getHandle();
+ teleportTransition = new TeleportTransition(
+ level,
+ org.bukkit.craftbukkit.util.CraftLocation.toVec3(newExit),
+ Vec3.ZERO,
+ newExit.getYaw(),
+ newExit.getPitch(),
+ teleportTransition.missingRespawnBlock(),
+ teleportTransition.asPassenger(),
+ Set.of(),
+ teleportTransition.postTeleportTransition(),
+ teleportTransition.cause());
+ teleportTransition = teleportTransition.withChangedLocation(newExit).withVelocity(Vec3.ZERO).withRelatives(Set.of());
+ }
+ // CraftBukkit end
if (!teleportTransition.asPassenger()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@
+ }
+ if (!to.equals(teleEvent.getTo())) {
+ to = teleEvent.getTo();
+ teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3(to), Vec3.ZERO, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause());
+ teleportTransition = teleportTransition.withChangedLocation(to).withVelocity(Vec3.ZERO).withRelatives(Set.of());
+ // Paper start - Call EntityPortalExitEvent
+ velocity = Vec3.ZERO;
+ }
Expand All @@ -1515,7 +1515,7 @@
+ to = event.getTo().clone();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toVec3(event.getAfter());
+ }
+ teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3(to), velocity, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause());
+ teleportTransition = teleportTransition.withChangedLocation(to).withRelatives(Set.of()).withVelocity(velocity);
+ }
+ }
+ if (this.isRemoved()) {
Expand Down Expand Up @@ -1543,6 +1543,20 @@

for (Entity entity2 : list) {
entity2.startRiding(entityx, true, false);
@@ -3035,6 +_,13 @@
private TeleportTransition calculatePassengerTransition(TeleportTransition teleportTransition, Entity entity) {
float f = teleportTransition.yRot() + (teleportTransition.relatives().contains(Relative.Y_ROT) ? 0.0F : entity.getYRot() - this.getYRot());
float f1 = teleportTransition.xRot() + (teleportTransition.relatives().contains(Relative.X_ROT) ? 0.0F : entity.getXRot() - this.getXRot());
+ // Paper start - reposition entity as rider when teleporting via API call
+ // This change is mostly required for plugins teleporting entities *every* tick with passengers, specifically player passengers.
+ // The relative teleport of players, which base their location on the server -> 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 @@
}

Expand Down Expand Up @@ -1585,7 +1599,7 @@
+
+ public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading
Loading