Fix crash when instantiating playerposition

This commit is contained in:
zontreck 2025-01-18 14:17:31 -07:00
parent d5dc0d5892
commit d35d888386
2 changed files with 4 additions and 6 deletions

View file

@ -68,7 +68,7 @@ namespace AriasServerUtils
api.Event.PlayerDeath += OnPlayerDeath; api.Event.PlayerDeath += OnPlayerDeath;
api.Event.PlayerJoin += OnPlayerJoin; api.Event.PlayerJoin += OnPlayerJoin;
api.Event.PlayerDisconnect += OnPlayerDC; api.Event.PlayerDisconnect += OnPlayerDC;
api.Event.PlayerLeave += OnPlayerDC; //api.Event.PlayerLeave += OnPlayerDC;

View file

@ -1,15 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using Vintagestory.API.Common; using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities; using Vintagestory.API.Common.Entities;
using Vintagestory.API.MathTools; using Vintagestory.API.MathTools;
using Vintagestory.GameContent;
namespace AriasServerUtils namespace AriasServerUtils
{ {
[Serializable] [Serializable]
public class PlayerPosition : ICloneable public class PlayerPosition
{ {
public int X { get; set; } = 0; public int X { get; set; } = 0;
public int Y { get; set; } = 0; public int Y { get; set; } = 0;
@ -19,7 +17,7 @@ namespace AriasServerUtils
public float Yaw { get; set; } = 0.0f; public float Yaw { get; set; } = 0.0f;
public float Pitch { get; set; } = 0.0f; public float Pitch { get; set; } = 0.0f;
public readonly PlayerPosition ZERO = new(0, 0, 0, 0, 0.0f, 0.0f); public static readonly PlayerPosition ZERO = new(0, 0, 0, 0, 0.0f, 0.0f);
public PlayerPosition() { } public PlayerPosition() { }
internal PlayerPosition(int x, int y, int z, int dim, float yaw, float pitch) internal PlayerPosition(int x, int y, int z, int dim, float yaw, float pitch)
@ -62,7 +60,7 @@ namespace AriasServerUtils
return pos; return pos;
} }
public object Clone() public PlayerPosition Clone()
{ {
return new PlayerPosition(this.X, this.Y, this.Z, this.Dimension, this.Yaw, this.Pitch); return new PlayerPosition(this.X, this.Y, this.Z, this.Dimension, this.Yaw, this.Pitch);
} }