using System.Collections.Generic;
namespace MinecraftClient.Mapping.BlockPalettes
{
public abstract class BlockPalette
{
///
/// Get mapping dictionary. Must be overriden with proper implementation.
///
/// Palette dictionary
protected abstract Dictionary GetDict();
///
/// Get material from block ID or block state ID
///
/// Block ID (up to MC 1.12) or block state (MC 1.13+)
/// Material corresponding to the specified ID
public Material FromId(int id)
{
Dictionary materials = GetDict();
if (materials.ContainsKey(id))
return materials[id];
return Material.Air;
}
///
/// Returns TRUE if block ID uses old metadata encoding with ID and Meta inside one ushort
/// Only Palette112 should override this.
///
public virtual bool IdHasMetadata
{
get
{
return false;
}
}
}
}