Search in sources :

Example 1 with TableCellBoolean

use of ivorius.reccomplex.gui.table.cell.TableCellBoolean in project RecurrentComplex by Ivorforce.

the class TableDataSourceBlockPatternIngredient method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    if (segment == 0) {
        TableCellString cell = new TableCellString("", ingredient.identifier);
        cell.addPropertyConsumer(s -> ingredient.identifier = s);
        return new TitledCell(IvTranslations.get("reccomplex.blockpattern.ingredient.identifier"), cell);
    } else if (segment == 2) {
        TableCellBoolean cell = new TableCellBoolean("", ingredient.delete);
        cell.addPropertyConsumer(d -> ingredient.delete = d);
        return new TitledCell(IvTranslations.get("reccomplex.blockpattern.ingredient.delete"), cell);
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) ivorius.reccomplex.gui.table(ivorius.reccomplex.gui.table) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) TableCellBoolean(ivorius.reccomplex.gui.table.cell.TableCellBoolean) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) BlockPattern(ivorius.reccomplex.world.gen.feature.structure.generic.BlockPattern) TableCellString(ivorius.reccomplex.gui.table.cell.TableCellString) TableDataSourceExpression(ivorius.reccomplex.gui.TableDataSourceExpression) Nonnull(javax.annotation.Nonnull) TableCellBoolean(ivorius.reccomplex.gui.table.cell.TableCellBoolean) TableCellString(ivorius.reccomplex.gui.table.cell.TableCellString)

Example 2 with TableCellBoolean

use of ivorius.reccomplex.gui.table.cell.TableCellBoolean in project RecurrentComplex by Ivorforce.

the class TableDataSourceMazeRuleConnectAll method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    if (segment == 0) {
        TableCellBoolean preventCell = new TableCellBoolean("prevent", rule.preventConnection, TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connect.prevent"), TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connect.prevent"));
        preventCell.addListener(val -> rule.preventConnection = val);
        return new TitledCell(preventCell);
    } else if (segment == 2) {
        TableCellBoolean cell = new TableCellBoolean("additive", rule.additive, TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connectall.additive"), TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connectall.subtractive"));
        cell.addListener(val -> {
            rule.additive = val;
            tableDelegate.reloadData();
        });
        return new TitledCell(cell);
    } else if (segment == 4) {
        return new TitledCell(new TableCellTitle("", IvTranslations.get("reccomplex.mazerule.connectall.preview")));
    } else if (segment == 5) {
        ConnectorFactory factory = new ConnectorFactory();
        Set<Connector> blockedConnections = Collections.singleton(factory.get(ConnectorStrategy.DEFAULT_WALL));
        List<SavedMazePath> exitPaths = MazeRuleConnectAll.getPaths(rule.exits, expected, blockedConnections, factory).collect(Collectors.toList());
        return new TitledCell(new TableCellTitle("", exitPaths.get(index).toString()));
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) TableDataSourceMazePathList(ivorius.reccomplex.gui.worldscripts.mazegenerator.TableDataSourceMazePathList) TableCellTitle(ivorius.reccomplex.gui.table.cell.TableCellTitle) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) ivorius.reccomplex.world.gen.feature.structure.generic.maze(ivorius.reccomplex.world.gen.feature.structure.generic.maze) GuiTable(ivorius.reccomplex.gui.table.GuiTable) TableCellBoolean(ivorius.reccomplex.gui.table.cell.TableCellBoolean) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) TextFormatting(net.minecraft.util.text.TextFormatting) Set(java.util.Set) TableDataSourcePreloaded(ivorius.reccomplex.gui.table.datasource.TableDataSourcePreloaded) Selection(ivorius.reccomplex.world.gen.feature.structure.generic.Selection) Collectors(java.util.stream.Collectors) TableNavigator(ivorius.reccomplex.gui.table.TableNavigator) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) List(java.util.List) Side(net.minecraftforge.fml.relauncher.Side) TableDelegate(ivorius.reccomplex.gui.table.TableDelegate) MazeRuleConnectAll(ivorius.reccomplex.world.gen.feature.structure.generic.maze.rules.saved.MazeRuleConnectAll) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) Collections(java.util.Collections) TableCellBoolean(ivorius.reccomplex.gui.table.cell.TableCellBoolean) Set(java.util.Set) TableCellTitle(ivorius.reccomplex.gui.table.cell.TableCellTitle) TableDataSourceMazePathList(ivorius.reccomplex.gui.worldscripts.mazegenerator.TableDataSourceMazePathList) List(java.util.List)

Example 3 with TableCellBoolean

use of ivorius.reccomplex.gui.table.cell.TableCellBoolean in project RecurrentComplex by Ivorforce.

the class TableDataSourceMazeRuleConnect method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    if (segment == 0) {
        TableCellBoolean preventCell = new TableCellBoolean("prevent", rule.preventConnection, TextFormatting.GOLD + IvTranslations.get("reccomplex.mazerule.connect.prevent"), TextFormatting.GREEN + IvTranslations.get("reccomplex.mazerule.connect.ensure"));
        preventCell.addListener(val -> rule.preventConnection = val);
        return new TitledCell(preventCell);
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) TableCellBoolean(ivorius.reccomplex.gui.table.cell.TableCellBoolean)

Aggregations

TableCellBoolean (ivorius.reccomplex.gui.table.cell.TableCellBoolean)3 TitledCell (ivorius.reccomplex.gui.table.cell.TitledCell)3 IvTranslations (ivorius.ivtoolkit.tools.IvTranslations)2 TableCell (ivorius.reccomplex.gui.table.cell.TableCell)2 TableDataSourceSegmented (ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented)2 Nonnull (javax.annotation.Nonnull)2 TableDataSourceExpression (ivorius.reccomplex.gui.TableDataSourceExpression)1 ivorius.reccomplex.gui.table (ivorius.reccomplex.gui.table)1 GuiTable (ivorius.reccomplex.gui.table.GuiTable)1 TableDelegate (ivorius.reccomplex.gui.table.TableDelegate)1 TableNavigator (ivorius.reccomplex.gui.table.TableNavigator)1 TableCellString (ivorius.reccomplex.gui.table.cell.TableCellString)1 TableCellTitle (ivorius.reccomplex.gui.table.cell.TableCellTitle)1 TableDataSourcePreloaded (ivorius.reccomplex.gui.table.datasource.TableDataSourcePreloaded)1 TableDataSourceMazePathList (ivorius.reccomplex.gui.worldscripts.mazegenerator.TableDataSourceMazePathList)1 BlockPattern (ivorius.reccomplex.world.gen.feature.structure.generic.BlockPattern)1 Selection (ivorius.reccomplex.world.gen.feature.structure.generic.Selection)1 ivorius.reccomplex.world.gen.feature.structure.generic.maze (ivorius.reccomplex.world.gen.feature.structure.generic.maze)1 MazeRuleConnectAll (ivorius.reccomplex.world.gen.feature.structure.generic.maze.rules.saved.MazeRuleConnectAll)1 Collections (java.util.Collections)1