mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-27 05:44:43 +00:00
Add AbstractGameRule.cs & derived classes
This commit is contained in:
31
PckStudio.Core/GameRule/SpawnPositionSet.cs
Normal file
31
PckStudio.Core/GameRule/SpawnPositionSet.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 SpawnPositionSet : AbstractGameRule
|
||||
{
|
||||
internal enum SpanPositionMethod
|
||||
{
|
||||
OnStart,
|
||||
OnRespawn
|
||||
}
|
||||
private SpanPositionMethod _method;
|
||||
|
||||
internal SpawnPositionSet(SpanPositionMethod method) => _method = method;
|
||||
|
||||
public void AddSpawnPosition(int x, int y, int z, int xRot, int yRot) => AddRule(new UpdatePlayer(new Vector3(x, y, z), new Vector2(xRot, yRot)));
|
||||
|
||||
protected override GameRuleFile.GameRule GetGameRule()
|
||||
{
|
||||
var gameRule = new GameRuleFile.GameRule("SpawnPositionSet");
|
||||
gameRule.AddParameter(new GameRuleFile.IntParameter("method", (int)_method));
|
||||
return gameRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user