chest static method

Slot chest(
  1. int row, [
  2. int? col,
  3. bool enderchest = false
])

Slot.chest takes in numbers, like 5,6 and an optional boolean for using an enderchest And does exactly the same as slot.inv but with a container, like a chest.

Implementation

static Slot chest(int row, [int? col, bool enderchest = false]) {
  var res = 0;

  if (col != null) {
    if (col > 0) res = col - 1;
    if (row > 0) res += (row - 1) * 9;
  } else {
    res = row - 1;
  }

  if (enderchest) {
    return Slot(slot: 'enderchest.$res', id: res);
  }

  return Slot(slot: 'container.$res', id: res);
}