BlockFadeEvent

This commit is contained in:
sylvessa 2026-04-19 08:41:54 -05:00
parent 29eeeb8d86
commit e91e5be732
12 changed files with 162 additions and 1 deletions

View file

@ -0,0 +1,41 @@
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;
}
}