Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete ServerPos #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
21 changes: 7 additions & 14 deletions Common/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@ static Entity()
/// <summary>
/// Client position
/// </summary>
public EntityPos Pos = new EntityPos();
public EntityPos Pos { get; private set; } = new EntityPos();

/// <summary>
/// Server simulated position. May not exactly match the client positon
/// </summary>
public EntityPos ServerPos = new EntityPos();
[Obsolete("Use Pos instead.")]
public EntityPos ServerPos => Pos;

[Obsolete("Use Pos instead.")]
public EntityPos SidedPos => Pos;

/// <summary>
/// Server simulated position copy. Needed by Entities server system to send pos updatess only if ServerPos differs noticably from PreviousServerPos
Expand Down Expand Up @@ -357,15 +358,7 @@ public virtual double SwimmingOffsetY
/// CollidedVertically || CollidedHorizontally
/// </summary>
public bool Collided { get { return CollidedVertically || CollidedHorizontally; } }

/// <summary>
/// ServerPos on server, Pos on client
/// </summary>
public EntityPos SidedPos
{
get { return World.Side == EnumAppSide.Server ? ServerPos : Pos; }
}


/// <summary>
/// The height of the eyes for the given entity.
/// </summary>
Expand Down
5 changes: 2 additions & 3 deletions Common/Entity/EntityChunky.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public void AssociateWithDimension(IMiniDimension blocks)
this.blocks = blocks;
this.subDimensionIndex = blocks.subDimensionId;
(WatchedAttributes.GetAttribute("dim") as IntAttribute).value = this.subDimensionIndex;
this.ServerPos.SetFrom(blocks.CurrentPos);
this.Pos = blocks.CurrentPos;
this.Pos.SetFrom(blocks.CurrentPos);
}

public override void Initialize(EntityProperties properties, ICoreAPI api, long chunkindex3d)
Expand Down Expand Up @@ -220,4 +219,4 @@ public override double SwimmingOffsetY
get { return base.SwimmingOffsetY; }
}
}
}
}