mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-13 04:18:08 +00:00
Core - Add LevelRules class
This commit is contained in:
31
PckStudio.Core/GameRule/LevelRules.cs
Normal file
31
PckStudio.Core/GameRule/LevelRules.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 LevelRules : AbstractGameRule
|
||||
{
|
||||
private readonly GameRuleFile.GameRuleParameter[] _parameters;
|
||||
|
||||
public static LevelRules Default { get; } = new LevelRules([new UpdatePlayer(Vector3.Zero, Vector2.Zero)]);
|
||||
public static LevelRules GetLevelRules(MiniGameId miniGame) => new LevelRules(Enumerable.Empty<AbstractGameRule>(), new GameRuleFile.IntParameter("ruleType", (int)miniGame));
|
||||
|
||||
public LevelRules(IEnumerable<AbstractGameRule> gameRules, params GameRuleFile.GameRuleParameter[] parameters)
|
||||
{
|
||||
AddRules(gameRules);
|
||||
_parameters = parameters;
|
||||
}
|
||||
|
||||
protected override GameRuleFile.GameRule GetGameRule()
|
||||
{
|
||||
var gameRule = new GameRuleFile.GameRule("LevelRules");
|
||||
gameRule.AddParameters(_parameters);
|
||||
return gameRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user