mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-28 02:13:51 +00:00
blockstate, more block events, command preprocess event.
This commit is contained in:
parent
21b5accc69
commit
18a673bd46
34 changed files with 1359 additions and 58 deletions
44
Minecraft.Server.FourKit/Event/Block/BlockGrowEvent.cs
Normal file
44
Minecraft.Server.FourKit/Event/Block/BlockGrowEvent.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
namespace Minecraft.Server.FourKit.Event.Block;
|
||||
|
||||
using Minecraft.Server.FourKit.Block;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a block grows naturally in the world.
|
||||
///
|
||||
/// <para>Examples:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>Wheat</description></item>
|
||||
/// <item><description>Sugar Cane</description></item>
|
||||
/// <item><description>Cactus</description></item>
|
||||
/// <item><description>Watermelon</description></item>
|
||||
/// <item><description>Pumpkin</description></item>
|
||||
/// </list>
|
||||
///
|
||||
/// <para>If a Block Grow event is cancelled, the block will not grow.</para>
|
||||
/// </summary>
|
||||
public class BlockGrowEvent : BlockEvent, Cancellable
|
||||
{
|
||||
private bool _cancel;
|
||||
private readonly BlockState _newState;
|
||||
|
||||
internal BlockGrowEvent(Block block, BlockState newState) : base(block)
|
||||
{
|
||||
_cancel = false;
|
||||
_newState = newState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the state of the block where it will form or spread to.
|
||||
/// </summary>
|
||||
/// <returns>The block state for this events block.</returns>
|
||||
public BlockState getNewState() => _newState;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool isCancelled() => _cancel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void setCancelled(bool cancel)
|
||||
{
|
||||
_cancel = cancel;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue