Search in sources :

Example 1 with WItemWithLabel

use of mathax.client.gui.widgets.WItemWithLabel in project Client by MatHax.

the class ItemSettingScreen method initTable.

public void initTable() {
    for (Item item : Registry.ITEM) {
        if (setting.filter != null && !setting.filter.test(item))
            continue;
        if (item == Items.AIR)
            continue;
        WItemWithLabel itemLabel = theme.itemWithLabel(item.getDefaultStack(), Names.get(item));
        if (!filterText.isEmpty() && !StringUtils.containsIgnoreCase(itemLabel.getLabelText(), filterText))
            continue;
        table.add(itemLabel);
        WButton select = table.add(theme.button("Select")).expandCellX().right().widget();
        select.action = () -> {
            setting.set(item);
            close();
        };
        table.row();
    }
}
Also used : Item(net.minecraft.item.Item) WItemWithLabel(mathax.client.gui.widgets.WItemWithLabel) WButton(mathax.client.gui.widgets.pressable.WButton)

Example 2 with WItemWithLabel

use of mathax.client.gui.widgets.WItemWithLabel in project Client by MatHax.

the class BlockSettingScreen method initTable.

private void initTable() {
    for (Block block : Registry.BLOCK) {
        if (setting.filter != null && !setting.filter.test(block))
            continue;
        if (skipValue(block))
            continue;
        WItemWithLabel item = theme.itemWithLabel(block.asItem().getDefaultStack(), Names.get(block));
        if (!filterText.isEmpty() && !StringUtils.containsIgnoreCase(item.getLabelText(), filterText))
            continue;
        table.add(item);
        WButton select = table.add(theme.button("Select")).expandCellX().right().widget();
        select.action = () -> {
            setting.set(block);
            close();
        };
        table.row();
    }
}
Also used : Block(net.minecraft.block.Block) WItemWithLabel(mathax.client.gui.widgets.WItemWithLabel) WButton(mathax.client.gui.widgets.pressable.WButton)

Aggregations

WItemWithLabel (mathax.client.gui.widgets.WItemWithLabel)2 WButton (mathax.client.gui.widgets.pressable.WButton)2 Block (net.minecraft.block.Block)1 Item (net.minecraft.item.Item)1