Skip to content

Commit b6fd0e7

Browse files
committed
Preserve the old position when respawning entities
This fixes broken concrete behaviour when merging is enabled.
1 parent ef63d89 commit b6fd0e7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sakura-server/src/main/java/me/samsuik/sakura/entity/EntityState.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
@NullMarked
1313
public record EntityState(
14+
Vec3 oldPosition,
1415
Vec3 position,
1516
Vec3 momentum,
1617
AABB bb,
@@ -21,6 +22,7 @@ public record EntityState(
2122
) {
2223
public static EntityState of(final Entity entity) {
2324
return new EntityState(
25+
entity.oldPosition(),
2426
entity.position(),
2527
entity.getDeltaMovement(),
2628
entity.getBoundingBox(),
@@ -32,6 +34,7 @@ public static EntityState of(final Entity entity) {
3234
}
3335

3436
public void apply(final Entity entity) {
37+
entity.setOldPosAndRot(this.oldPosition, 0.0f, 0.0f);
3538
entity.setPos(this.position);
3639
entity.setDeltaMovement(this.momentum);
3740
entity.setBoundingBox(this.bb);

0 commit comments

Comments
 (0)