smartcmd-MinecraftConsoles/Minecraft.Server.FourKit/Event/Block/BlockFadeEvent.cs
2026-04-19 08:41:54 -05:00

41 lines
1.2 KiB
C#

namespace Minecraft.Server.FourKit.Event.Block;
using Minecraft.Server.FourKit.Block;
/// <summary>
/// Called when a block fades, melts or disappears based on world conditions.
///
/// <para>Examples:</para>
/// <list type="bullet">
/// <item><description>Snow melting due to being near a light source.</description></item>
/// <item><description>Ice melting due to being near a light source.</description></item>
/// </list>
///
/// <para>If a Block Fade event is cancelled, the block will not fade, melt or disappear.</para>
/// </summary>
public class BlockFadeEvent : BlockEvent, Cancellable
{
private readonly BlockState _newState;
private bool _cancel;
internal BlockFadeEvent(Block block, BlockState newState) : base(block)
{
_newState = newState;
_cancel = false;
}
/// <summary>
/// Gets the state of the block that will be fading, melting or disappearing.
/// </summary>
/// <returns>The block state of the block that will be fading, melting or disappearing.</returns>
public BlockState getNewState() => _newState;
/// <inheritdoc/>
public bool isCancelled() => _cancel;
/// <inheritdoc/>
public void setCancelled(bool cancel)
{
_cancel = cancel;
}
}