// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
using System;
namespace ClassicalSharp.Events {
public class UserEvents {
/// Raised when the user changes a block in the world.
public event EventHandler BlockChanged;
internal void RaiseBlockChanged( Vector3I coords, byte old, byte block ) {
blockArgs.Coords = coords; blockArgs.OldBlock = old; blockArgs.Block = block;
Raise( BlockChanged, blockArgs );
}
BlockChangedEventArgs blockArgs = new BlockChangedEventArgs();
protected void Raise( EventHandler handler ) {
if( handler != null )
handler( this, EventArgs.Empty );
}
protected void Raise( EventHandler handler, T args ) where T : EventArgs {
if( handler != null )
handler( this, args );
}
}
public sealed class BlockChangedEventArgs : EventArgs {
/// Location within the world the block was updated at.
public Vector3I Coords;
/// Block ID that was at the given location before.
public byte OldBlock;
/// Block ID that is now at the given location.
public byte Block;
}
}