drop static method

Slot drop(
  1. int row, [
  2. int? col
])

Slot.drop takes in numbers, like 1,3 This calculates the rows and columns for a 3x3 Container like a Dropper or a Dispenser. Therefore just values from 1 to 3 are allowed.

Implementation

static Slot drop(int row, [int? col]) {
  var res = 0;

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

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