
This allows us to cancel events when the subject is no longer around. For example, if a chunk is unloaded due to inactivity, the events within it are cancelled (growth of wheat, propegation of fluids, etc). When a client disconnects, events associated with it are cancelled. To use this for your own scheduled events, pick a subject. If your subject does not implement IEventSubject, implement it. Then, you can pass the subject into ScheduleEvent and that's it. When the subject dies, your events will die with it. So long as the subject remains alive, your events still fire. `null` is a valid subject for events that should happen regardless of any subject expiring. Closes #1
36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
using System;
|
|
using fNbt;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TrueCraft.API.World
|
|
{
|
|
public interface IChunk : IEventSubject, IDisposable
|
|
{
|
|
int X { get; }
|
|
int Z { get; }
|
|
Coordinates2D Coordinates { get; set; }
|
|
bool IsModified { get; set; }
|
|
bool LightPopulated { get; set; }
|
|
int[] HeightMap { get; }
|
|
byte[] Biomes { get; }
|
|
DateTime LastAccessed { get; set; }
|
|
byte[] Blocks { get; }
|
|
bool TerrainPopulated { get; set; }
|
|
Dictionary<Coordinates3D, NbtCompound> TileEntities { get; set; }
|
|
NibbleArray Metadata { get; }
|
|
NibbleArray BlockLight { get; }
|
|
NibbleArray SkyLight { get; }
|
|
int GetHeight(byte x, byte z);
|
|
void UpdateHeightMap();
|
|
byte GetBlockID(Coordinates3D coordinates);
|
|
byte GetMetadata(Coordinates3D coordinates);
|
|
byte GetSkyLight(Coordinates3D coordinates);
|
|
byte GetBlockLight(Coordinates3D coordinates);
|
|
void SetBlockID(Coordinates3D coordinates, byte value);
|
|
void SetMetadata(Coordinates3D coordinates, byte value);
|
|
void SetSkyLight(Coordinates3D coordinates, byte value);
|
|
void SetBlockLight(Coordinates3D coordinates, byte value);
|
|
NbtCompound GetTileEntity(Coordinates3D coordinates);
|
|
void SetTileEntity(Coordinates3D coordinates, NbtCompound value);
|
|
}
|
|
} |