/// <summary> /// Intializes a new <see cref="SmeltRecipe"/>. Inherite from this constructor. /// </summary> /// <param name="packNamespace">The namespace the recipe is in</param> /// <param name="fileName">The name of the recipe file</param> /// <param name="writeSetting">The settings for how to write this file</param> /// <param name="group">The name of the recipe group the recipe is in. Leave null for no group.</param> /// <param name="recipeType">The type of smelting recipe</param> /// <param name="ingredients">The different types of items which can be used in the recipe</param> /// <param name="result">The result from the recipe</param> /// <param name="experience">The amount of experience to get for smelting the item</param> /// <param name="cookingTime">The amount of time it takes to cook the item</param> /// <param name="_">Unused parameter used for specifing you want to use this constructor</param> protected SmeltRecipe(bool _, BasePackNamespace packNamespace, string?fileName, SmeltType recipeType, IItemType[] ingredients, ID.Item result, double experience, NoneNegativeTime <int>?cookingTime = null, string?group = null, WriteSetting writeSetting = WriteSetting.LockedAuto) : base(packNamespace, fileName, group, writeSetting, "minecraft:" + recipeType.ToString()) { Ingredients = ingredients; Result = result; Experience = experience; CookingTime = cookingTime; }
/// <summary> /// Runs the specified function /// </summary> /// <param name="runFunction">the function to run</param> /// <param name="delay">the amount of time to function execution should be delayed. null doesnt delay it. /// (If value is other than null the function will ignore the arguments send in the execute command which executed it)</param> /// <param name="append">If the function is being scheduled: if false replace the last time the function was scheduled</param> /// <returns>The ran function</returns> public IFunction Function(IFunction runFunction, NoneNegativeTime <int>?delay = null, bool append = true) { if (delay == null) { ForFunction.AddCommand(new RunFunctionCommand(runFunction)); } else { ForFunction.AddCommand(new ScheduleAddCommand(runFunction, delay, append)); } return(runFunction); }
/// <summary> /// Changes when the worldborder starts to show red on the players' screens /// </summary> /// <param name="distance">the maximum distance in blocks the player has be away from the border for the red to show</param> /// <param name="time">The maximum amount of time the player is away from the border for the red to show. /// (Time as in: "the world border will be at the player in X seconds")</param> public void Warning(int?distance = null, NoneNegativeTime <int>?time = null) { if (distance is null && time is null) { throw new System.ArgumentException("Both arguments may not be null at the same time"); } if (distance is null) { ForFunction.AddCommand(new WorldborderWarningTimeCommand(time !)); } if (time is null) { ForFunction.AddCommand(new WorldborderWarningDistanceCommand(distance !.Value)); } ForFunction.Custom.GroupCommands((g) => { g.AddCommand(new WorldborderWarningDistanceCommand(distance !.Value)); g.AddCommand(new WorldborderWarningTimeCommand(time !)); }); }
/// <summary> /// Intializes a new <see cref="ScheduleAddCommand"/> /// </summary> /// <param name="function">The function to schedule</param> /// <param name="time">The amount of time before the function should run</param> /// <param name="append">True if the function should append. False if it should replace other times the function has been scheduled.</param> public ScheduleAddCommand(IFunction function, NoneNegativeTime <int> time, bool append = false) { Function = function; Time = time; Append = append; }
/// <summary> /// Sets the world border's size in blocks /// </summary> /// <param name="set">The amount of blocks wide the border is</param> /// <param name="time">The time it should take for the border to get there</param> public void Set(double set, NoneNegativeTime <int>?time = null) { ForFunction.AddCommand(new WorldborderSizeCommand(set, ID.AddSetModifier.set, time)); }
/// <summary> /// Adds blocks to the world border size /// </summary> /// <param name="add">The amount of blocks to add. /// Note: the blocks are spread out from the center, so adding 1 block adds a half block to all sides /// Note: if the number is negative blocks will be removed</param> /// <param name="time">The amount of time it should take to add the blocks</param> public void Add(double add, NoneNegativeTime <int>?time = null) { ForFunction.AddCommand(new WorldborderSizeCommand(add, ID.AddSetModifier.add, time)); }
/// <summary> /// Sets the time of day to the specified <see cref="Time"/> /// </summary> /// <param name="time">the <see cref="Time"/> to set it to</param> public void Set(NoneNegativeTime <int> time) { ForFunction.AddCommand(new TimeModifyCommand(time, ID.AddSetModifier.set)); }
/// <summary> /// Changes the weather to the specified type /// </summary> /// <param name="SetTo">The new type of weather</param> /// <param name="WeatherTime">The number of ticks the weather should be going. Null means the game chose</param> public void Weather(ID.WeatherType SetTo, NoneNegativeTime <int> WeatherTime) { ForFunction.AddCommand(new WeatherCommand(SetTo, WeatherTime)); }
/// <summary> /// Runs the given commands as a function (The function is made as a sibling function) /// </summary> /// <param name="name">The name of the sibling function</param> /// <param name="writer">the commands to run</param> /// <param name="delay">the amount of time to function execution should be delayed. null doesnt delay it. /// (If value is other than null the function will ignore the arguments send in the execute command which executed it)</param> /// <param name="append">If the function is being scheduled: if false replace the last time the function was scheduled</param> /// <returns>The function</returns> public Function Function(string name, Function.FunctionWriter writer, NoneNegativeTime <int>?delay = null, bool append = true) { return((Function)Function(ForFunction.NewSibling(name, writer), delay, append)); }
/// <summary> /// Intializes a new <see cref="TimeModifyCommand"/> /// </summary> /// <param name="time">The value to modify with</param> /// <param name="modifier">The way to use the modify value</param> public TimeModifyCommand(NoneNegativeTime <int> time, ID.AddSetModifier modifier) { Time = time; Modifier = modifier; }
/// <summary> /// Intializes a new <see cref="SmeltRecipe"/> /// </summary> /// <param name="packNamespace">The namespace the recipe is in</param> /// <param name="fileName">The name of the recipe file</param> /// <param name="writeSetting">The settings for how to write this file</param> /// <param name="group">The name of the recipe group the recipe is in. Leave null for no group.</param> /// <param name="recipeType">The type of smelting recipe</param> /// <param name="ingredient">The item to smelt</param> /// <param name="result">The result from the recipe</param> /// <param name="experience">The amount of experience to get for smelting the item</param> /// <param name="cookingTime">The amount of time in ticks it takes to cook the item</param> public SmeltRecipe(BasePackNamespace packNamespace, string?fileName, SmeltType recipeType, IItemType ingredient, ID.Item result, double experience, NoneNegativeTime <int>?cookingTime = null, string?group = null, WriteSetting writeSetting = WriteSetting.LockedAuto) : this(true, packNamespace, fileName, recipeType, new IItemType[] { ingredient }, result, experience, cookingTime, group, writeSetting) { FinishedConstructing(); }
/// <summary> /// Displays a whole title for the selected players /// </summary> /// <param name="player">the <see cref="BaseSelector"/> to use</param> /// <param name="topMessage">The main title message</param> /// <param name="bottomMessage">the bottom part of the title message</param> /// <param name="startFade">The amount of ticks it takes for the title to fade in</param> /// <param name="stay">The amount of ticks the title stays on screen</param> /// <param name="endFade">The amount of ticks it takes for the title to fade out</param> public void FullTitle(BaseSelector player, BaseJsonText topMessage, BaseJsonText bottomMessage, NoneNegativeTime <int> startFade, NoneNegativeTime <int> stay, NoneNegativeTime <int> endFade) { ForFunction.Custom.GroupCommands(f => { ForFunction.AddCommand(new TitleTimesCommand(player, startFade, stay, endFade)); if (!(bottomMessage is null)) { ForFunction.AddCommand(new TitleSubtitleCommand(player, bottomMessage)); } if (topMessage is null) { ForFunction.AddCommand(new TitleCommand(player, new JsonText.Text(""))); } else { ForFunction.AddCommand(new TitleCommand(player, topMessage)); } }); }
/// <summary> /// choses how long the titles should be shown for the selected players /// </summary> /// <param name="player">the <see cref="BaseSelector"/> to use</param> /// <param name="startFade">The amount of ticks it takes for the title to fade in</param> /// <param name="stay">The amount of ticks the title stays on screen</param> /// <param name="endFade">The amount of ticks it takes for the title to fade out</param> public void Time(BaseSelector player, NoneNegativeTime <int> startFade, NoneNegativeTime <int> stay, NoneNegativeTime <int> endFade) { ForFunction.AddCommand(new TitleTimesCommand(player, startFade, stay, endFade)); }
/// <summary> /// Intializes a new <see cref="WorldborderSizeCommand"/> /// </summary> /// <param name="size">The size to modify with</param> /// <param name="modifier">The way to modify the size</param> /// <param name="time">The amount of time to modification takes. Leave null to make it happen instant</param> public WorldborderSizeCommand(double size, ID.AddSetModifier modifier, NoneNegativeTime <int>?time) { Modifier = modifier; Size = size; Time = time; }