use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class PotionSettingScreen method initWidgets.
@Override
public void initWidgets() {
WTable table = add(theme.table()).expandX().widget();
for (MyPotion potion : MyPotion.values()) {
table.add(theme.itemWithLabel(potion.potion, potion.potion.getName().getString()));
WButton select = table.add(theme.button("Select")).widget();
select.action = () -> {
setting.set(potion);
close();
};
table.row();
}
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class ServerManagerScreen method addButton.
private void addButton(WContainer c, String text, IGetter<Screen> action) {
WButton button = c.add(theme.button(text)).expandX().widget();
button.action = () -> client.setScreen(action.get());
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class BlockDataSettingScreen method initTable.
public <T extends ICopyable<T> & ISerializable<T> & IChangeable & IBlockData<T>> void initTable() {
for (Block block : Registry.BLOCK) {
T blockData = (T) setting.get().get(block);
if (blockData != null && blockData.isChanged())
BLOCKS.add(0, block);
else
BLOCKS.add(block);
}
for (Block block : BLOCKS) {
String name = Names.get(block);
if (!StringUtils.containsIgnoreCase(name, filterText))
continue;
T blockData = (T) setting.get().get(block);
table.add(theme.itemWithLabel(block.asItem().getDefaultStack(), Names.get(block))).expandCellX();
table.add(theme.label((blockData != null && blockData.isChanged()) ? "*" : " "));
WButton edit = table.add(theme.button(GuiRenderer.EDIT)).widget();
edit.action = () -> {
T data = blockData;
if (data == null)
data = (T) setting.defaultData.get().copy();
mc.setScreen(data.createScreen(theme, block, (BlockDataSetting<T>) setting));
};
WButton reset = table.add(theme.button(GuiRenderer.RESET)).widget();
reset.action = () -> {
setting.get().remove(block);
setting.onChanged();
if (blockData != null && blockData.isChanged()) {
table.clear();
initTable();
}
};
table.row();
}
BLOCKS.clear();
}
use of mathax.client.gui.widgets.pressable.WButton 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();
}
}
use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.
the class AccountsScreen method addButton.
private void addButton(WContainer c, String text, Runnable action) {
WButton button = c.add(theme.button(text)).expandX().widget();
button.action = action;
}
Aggregations