mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-18 02:51:53 +00:00
Add AbstractGameRule.cs & derived classes
This commit is contained in:
35
PckStudio.Core/GameRule/UpdatePlayer.cs
Normal file
35
PckStudio.Core/GameRule/UpdatePlayer.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.GameRule;
|
||||
|
||||
namespace PckStudio.Core.GameRule
|
||||
{
|
||||
internal sealed class UpdatePlayer : AbstractGameRule
|
||||
{
|
||||
private Vector3 _spawn;
|
||||
private Vector2 _rot;
|
||||
|
||||
public UpdatePlayer(Vector3 spawn, Vector2 rot)
|
||||
{
|
||||
_spawn = spawn;
|
||||
_rot = rot;
|
||||
}
|
||||
|
||||
protected override GameRuleFile.GameRule GetGameRule()
|
||||
{
|
||||
var gameRule = new GameRuleFile.GameRule("UpdatePlayer");
|
||||
gameRule.AddParameters(
|
||||
new GameRuleFile.IntParameter("x", (int)_spawn.X),
|
||||
new GameRuleFile.IntParameter("y", (int)_spawn.Y),
|
||||
new GameRuleFile.IntParameter("z", (int)_spawn.Z),
|
||||
new GameRuleFile.IntParameter("xRot", (int)_rot.X),
|
||||
new GameRuleFile.IntParameter("yRot", (int)_rot.Y)
|
||||
);
|
||||
return gameRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user