mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-15 18:00:00 +00:00
Core - Impprove AbstractGameRule classes
This commit is contained in:
@@ -1,32 +1,20 @@
|
||||
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
|
||||
{
|
||||
public sealed class SpawnPositionSet : AbstractGameRule
|
||||
{
|
||||
public override string Name => "SpawnPositionSet";
|
||||
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)));
|
||||
public void AddSpawnPosition(int x, int y, int z) => AddSpawnPosition(x, y, z, 0, 0);
|
||||
|
||||
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)));
|
||||
public void AddSpawnPosition(int x, int y, int z) => AddSpawnPosition(x, y, z, 0, 0);
|
||||
|
||||
protected override GameRuleFile.GameRule GetGameRule()
|
||||
{
|
||||
var gameRule = new GameRuleFile.GameRule("SpawnPositionSet");
|
||||
gameRule.AddParameter(new GameRuleFile.IntParameter("method", (int)_method));
|
||||
return gameRule;
|
||||
}
|
||||
internal SpawnPositionSet(SpanPositionMethod method) => AddParameter("method", (int)method);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user