Add block material database

Taken from Bukkit's Material class, with credits.
Allows to know types and properties of blocks.
+ Use database for "is solid" checks
+ Add "can harm players" method
+ Faster movements, falling seems natural now
+ Shorter error message when ping failed
This commit is contained in:
ORelio 2015-12-09 23:04:00 +01:00
parent 5d8d42e3d1
commit 49702e30b8
6 changed files with 367 additions and 30 deletions

View file

@ -46,13 +46,13 @@ namespace MinecraftClient.Mapping
}
/// <summary>
/// Check if the block can be passed through or not
/// Material of the block
/// </summary>
public bool Solid
public Material Type
{
get
{
return BlockId != 0;
return (Material)BlockId;
}
}
@ -71,22 +71,18 @@ namespace MinecraftClient.Mapping
/// <summary>
/// Get a block of the specified type and metadata
/// </summary>
/// <param name="typeAndMeta"></param>
/// <param name="typeAndMeta">Type and metadata packed in the same value</param>
public Block(ushort typeAndMeta)
{
this.blockIdAndMeta = typeAndMeta;
}
/// <summary>
/// Represents an empty block
/// Get a block of the specified type and metadata
/// </summary>
public static Block Air
{
get
{
return new Block(0);
}
}
/// <param name="type">Block type</param>
public Block(Material type, byte metadata = 0)
: this((short)type, metadata) { }
/// <summary>
/// String representation of the block