getChestType

getChestType([number entity]) → integer type

Returns the type of the chest entity, as one of the constants CHEST_WOOD (1), CHEST_IRON (2) or CHEST_DIAMOND (3).

If entity is not given, the type of the current entity is returned. The function returns -1 if the entity exists but is not a chest, and null if no entity has that id.

Example:

var enemy = getNearestEnemy()
if (getChestType(enemy) == CHEST_DIAMOND) {
    debug("A diamond chest!")
}
const enemy = Fight.getNearestEnemy()
// `type` only exists on a Chest: check the entity kind first.
if (enemy instanceof Chest && enemy.type === Chest.Type.DIAMOND) {
	Debug.log("A diamond chest!")
}
enemy = Fight.getNearestEnemy()
# `type` only exists on a Chest: check the entity kind first.
if isinstance(enemy, Chest) and enemy.type == Chest.Type.DIAMOND:
	Debug.log("A diamond chest!")
Parameters
Return