mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-24 03:23:51 +00:00
BlockFadeEvent
This commit is contained in:
parent
29eeeb8d86
commit
e91e5be732
12 changed files with 162 additions and 1 deletions
|
|
@ -896,6 +896,42 @@ public void onSpread(BlockSpreadEvent e)
|
|||
|
||||
---
|
||||
|
||||
@subsection blockfadeevent BlockFadeEvent
|
||||
|
||||
\ref Minecraft.Server.FourKit.Event.Block.BlockFadeEvent "BlockFadeEvent" is fired when a block fades, melts or disappears based on world conditions. Examples include snow melting near a light source and ice melting near a light source. If cancelled, the block will not fade, melt or disappear.
|
||||
|
||||
```csharp
|
||||
[EventHandler]
|
||||
public void onFade(BlockFadeEvent e)
|
||||
{
|
||||
// prevent ice from melting
|
||||
if (e.getBlock().getType() == Material.ICE)
|
||||
{
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```csharp
|
||||
[EventHandler]
|
||||
public void onFade(BlockFadeEvent e)
|
||||
{
|
||||
// log what a block will become when it fades
|
||||
Console.WriteLine($"{e.getBlock().getType()} at {e.getBlock().getX()},{e.getBlock().getY()},{e.getBlock().getZ()} is fading into {e.getNewState().getType()}");
|
||||
}
|
||||
```
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
| `getBlock()` | The `Block` that is fading, melting or disappearing. |
|
||||
| `getNewState()` | The `BlockState` representing what the block will become after fading. |
|
||||
| `isCancelled()` | Whether the fade is cancelled. |
|
||||
| `setCancelled(bool)` | Cancel or allow the fade. |
|
||||
|
||||
> **Cancellable:** Yes
|
||||
|
||||
---
|
||||
|
||||
@subsection blockburnevent BlockBurnEvent
|
||||
|
||||
\ref Minecraft.Server.FourKit.Event.Block.BlockBurnEvent "BlockBurnEvent" is fired when a block is destroyed as a result of being burnt by fire.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue