Skip to content

Commit

Permalink
fix player position desync when travelling through an ITeleporter portal
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 committed Jan 17, 2025
1 parent 5484c0a commit bef62db
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public ServerPlayerMixin(Level world, BlockPos pos, float yaw, GameProfile gameP
@Shadow
protected abstract void createEndPlatform(ServerLevel world, BlockPos centerPos);

@Shadow
public abstract void setServerLevel(ServerLevel serverLevel);

@Inject(method = "<init>", at = @At("RETURN"))
private void port_lib$init(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, CallbackInfo ci) {
ServerPlayerCreationCallback.EVENT.invoker().onCreate((ServerPlayer) (Object) this);
Expand Down Expand Up @@ -133,10 +136,10 @@ public Entity changeDimension(ServerLevel p_9180_, ITeleporter teleporter) {

serverlevel.getProfiler().pop();
serverlevel.getProfiler().push("placing");
this.setLevel(p_9180_);
this.setServerLevel(p_9180_);
this.connection.teleport(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z, portalinfo.yRot, portalinfo.xRot);
this.connection.resetPosition();
p_9180_.addDuringPortalTeleport((ServerPlayer) (Object) this);
this.setRot(portalinfo.yRot, portalinfo.xRot);
this.moveTo(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z);
serverlevel.getProfiler().pop();
this.triggerDimensionChangeTriggers(serverlevel);
return this;//forge: this is part of the ITeleporter patch
Expand Down

0 comments on commit bef62db

Please sign in to comment.