generated from AriasCreations/vsmodtemplate
TODO: only take the backpack slots not the backpack contents; also exclude the character's clothing
53 lines
No EOL
1.4 KiB
C#
53 lines
No EOL
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Vintagestory.API.Common;
|
|
using Vintagestory.API.Common.Entities;
|
|
using Vintagestory.API.MathTools;
|
|
using Vintagestory.GameContent;
|
|
|
|
namespace AriasServerUtils
|
|
{
|
|
[Serializable]
|
|
public class PlayerPosition
|
|
{
|
|
public int X { get; set; } = 0;
|
|
public int Y { get; set; } = 0;
|
|
public int Z { get; set; } = 0;
|
|
public int Dimension { get; set; } = 0;
|
|
|
|
public float Yaw { get; set; } = 0.0f;
|
|
|
|
|
|
public void Merge(Entity entity)
|
|
{
|
|
entity.TeleportTo(new BlockPos(X, Y, Z, Dimension));
|
|
entity.Pos.SetYaw(Yaw);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Generates a PlayerPosition object using a entity.
|
|
/// </summary>
|
|
/// <param name="entity">A player entity</param>
|
|
/// <returns>PlayerPos snapshot object of the entity</returns>
|
|
public static PlayerPosition from(Entity entity)
|
|
{
|
|
PlayerPosition pos = new PlayerPosition();
|
|
|
|
BlockPos playerPos = entity.Pos.AsBlockPos;
|
|
pos.X = playerPos.X;
|
|
pos.Y = playerPos.Y;
|
|
pos.Z = playerPos.Z;
|
|
pos.Dimension = playerPos.dimension;
|
|
|
|
pos.Yaw = entity.Pos.Yaw;
|
|
|
|
return pos;
|
|
}
|
|
}
|
|
|
|
public class PlayerInventory
|
|
{
|
|
public List<ItemStack> Items = new List<ItemStack>();
|
|
}
|
|
} |