protected function getSlotIndex($index) { foreach ($this->namedtag->Items as $i => $slot) { if ((int) $slot["Slot"] === (int) $index) { return (int) $i; } } return -1; }