Skip to content

Commit e63f637

Browse files
committed
Fix #39: Ensure teleport to camera is sync
1 parent f226be2 commit e63f637

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@
3434
private ServerPlayer.@Nullable RespawnConfig respawnConfig;
3535
private final TextFilter textFilter;
3636
private boolean textFilteringEnabled;
37+
@@ -752,9 +_,11 @@
38+
39+
Entity camera = this.getCamera();
40+
if (camera != this) {
41+
- if (camera.isAlive()) {
42+
+ if (camera.isAlive() && camera.level() == this.level()) { // ShreddedPaper - ensure telelport to camera sync
43+
+ ShreddedPaper.ensureSync(this, camera, () -> { // ShreddedPaper - ensure telelport to camera sync
44+
this.absSnapTo(camera.getX(), camera.getY(), camera.getZ(), camera.getYRot(), camera.getXRot());
45+
this.level().getChunkSource().move(this);
46+
+ }); // ShreddedPaper - ensure telelport to camera sync
47+
if (this.wantsToStopRiding()) {
48+
this.setCamera(this);
49+
}
3750
@@ -1352,39 +_,43 @@
3851
public record RespawnResult(TeleportTransition transition, boolean isBedSpawn, boolean isAnchorSpawn) {
3952
}

0 commit comments

Comments
 (0)