MinecraftConsoles/Minecraft.Server.FourKit/Event/World/StructureGrowEvent.cs
DrPerkyLegit ebc1d4c640
Events, minor apis, stubs for future pr (#9)
* StructureGrowEvent, expose internal dimension id

* Update StructureGrowEvent.cs

* PlayerLoginEvent, ability to change xuids, get xuids, stub for experimental player connection api

* add docs, fix up to use cmake

---------

Co-authored-by: sylvessa <225480449+sylvessa@users.noreply.github.com>
2026-04-02 17:22:07 -05:00

61 lines
1.9 KiB
C#

using Minecraft.Server.FourKit.Enums;
using System;
using System.Collections.Generic;
using System.Text;
namespace Minecraft.Server.FourKit.Event.World;
/// <summary>
/// Event that is called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
/// </summary>
public class StructureGrowEvent : WorldEvent, Cancellable
{
internal Location _location;
internal TreeType _treeType;
internal bool _wasBonemeal;
internal Minecraft.Server.FourKit.Entity.Player? _player;
internal bool _cancelled;
internal StructureGrowEvent(Location location, TreeType treeType, bool wasBonemeal, Minecraft.Server.FourKit.Entity.Player? player) : base(location.getWorld())
{
_location = location;
_treeType = treeType;
_wasBonemeal = wasBonemeal;
_player = player;
}
/// <summary>
/// Gets the species type (birch, normal, pine, red mushroom, brown mushroom).
/// </summary>
/// <returns>Structure species</returns>
public TreeType getSpecies() => _treeType;
/// <summary>
/// Gets the location of the structure.
/// </summary>
/// <returns>Location of the structure</returns>
public Location getLocation() => _location;
/// <summary>
/// Checks if structure was grown using bonemeal.
/// </summary>
/// <returns>True if the structure was grown using bonemeal.</returns>
public bool isFromBonemeal() => _wasBonemeal;
/// <summary>
/// Gets the player that created the structure.
/// </summary>
/// <returns>Player that created the structure, null if was not created manually</returns>
public Minecraft.Server.FourKit.Entity.Player? getPlayer() => _player;
/// <inheritdoc/>
public bool isCancelled() => _cancelled;
/// <inheritdoc/>
public void setCancelled(bool cancel) => _cancelled = cancel;
}