public void apply(Gui gui) {
        // the index of the item slot in the inventory
        int invIndex = 0;

        // iterate all of the loaded masks
        for (int i = 0; i < this.maskRows.size(); i++) {
            boolean[] mask = this.maskRows.get(i);
            int[] scheme = this.schemeRows.get(i);

            int schemeIndex = 0;

            // iterate the values in the mask (0 --> 8)
            for (boolean b : mask) {

                // increment the index in the gui. we're handling a new item.
                int index = invIndex++;

                // if this index is masked.
                if (b) {

                    // this is the value from the scheme map for this slot.
                    int schemeMappingId = scheme[schemeIndex++];

                    // lookup the value for this location, and apply it to the gui
                    this.mapping.get(schemeMappingId).ifPresent(item -> gui.setItem(index, item));
                }
            }
        }
    }
Helps to populate a menu with border items
helper/src/main/java/me/lucko/helper/menu/scheme/MenuScheme.java