Search in sources :

Example 1 with TableCell

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

the class TableDataSourceItemCollectionComponent method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    if (segment == 0) {
        TableCellString cell = new TableCellString(null, key);
        cell.setShowsValidityState(true);
        cell.setValidityState(currentKeyState());
        cell.addPropertyConsumer(val -> {
            key = val;
            cell.setValidityState(currentKeyState());
        });
        return new TitledCell(IvTranslations.get("reccomplex.gui.inventorygen.componentid"), cell).withTitleTooltip(IvTranslations.formatLines("reccomplex.gui.inventorygen.componentid.tooltip"));
    } else if (segment == 2) {
        TableCellString cell = new TableCellString(null, component.inventoryGeneratorID);
        cell.setShowsValidityState(true);
        cell.setValidityState(currentGroupIDState());
        cell.addPropertyConsumer(val -> {
            component.inventoryGeneratorID = val;
            cell.setValidityState(currentGroupIDState());
        });
        return new TitledCell(IvTranslations.get("reccomplex.gui.inventorygen.groupid"), cell).withTitleTooltip(IvTranslations.formatLines("reccomplex.gui.inventorygen.groupid.tooltip"));
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) TableDataSourceSupplied(ivorius.reccomplex.gui.table.datasource.TableDataSourceSupplied) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) WeightedItemCollectionRegistry(ivorius.reccomplex.world.storage.loot.WeightedItemCollectionRegistry) GuiTable(ivorius.reccomplex.gui.table.GuiTable) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) RCGuiHandler(ivorius.reccomplex.gui.RCGuiHandler) GenericItemCollection(ivorius.reccomplex.world.storage.loot.GenericItemCollection) TableNavigator(ivorius.reccomplex.gui.table.TableNavigator) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) GuiValidityStateIndicator(ivorius.reccomplex.gui.GuiValidityStateIndicator) SaveDirectoryData(ivorius.reccomplex.utils.SaveDirectoryData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TableElementSaveDirectory(ivorius.reccomplex.gui.TableElementSaveDirectory) TableCellMultiBuilder(ivorius.reccomplex.gui.table.cell.TableCellMultiBuilder) TableCellString(ivorius.reccomplex.gui.table.cell.TableCellString) RecurrentComplex(ivorius.reccomplex.RecurrentComplex) TableDelegate(ivorius.reccomplex.gui.table.TableDelegate) GenericItemCollectionRegistry(ivorius.reccomplex.world.storage.loot.GenericItemCollectionRegistry) TableDataSourceExpression(ivorius.reccomplex.gui.TableDataSourceExpression) Nonnull(javax.annotation.Nonnull) TableCellString(ivorius.reccomplex.gui.table.cell.TableCellString)

Example 2 with TableCell

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

the class TableDataSourceVanillaStructureGeneration method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    switch(segment) {
        case 1:
            {
                TableCellEnum<String> cell = new TableCellEnum<>("type", "village", new TableCellEnum.Option<String>("village", IvTranslations.get("reccomplex.generationInfo.vanilla.type.village")));
                return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.type"), cell);
            }
        case 2:
            {
                switch(index) {
                    case 0:
                        return RCGuiTables.defaultWeightElement(val -> generationInfo.generationWeight = TableCells.toDouble(val), generationInfo.generationWeight);
                    case 1:
                        {
                            TableCellEnum<EnumFacing> cell = new TableCellEnum<>("front", generationInfo.front, TableDirections.getDirectionOptions(Directions.HORIZONTAL));
                            cell.addPropertyConsumer(val -> generationInfo.front = val);
                            return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.front"), cell);
                        }
                }
            }
        case 3:
            switch(index) {
                case 0:
                    {
                        TableCellFloatRange cell = new TableCellFloatRange("baseLimit", new FloatRange((float) generationInfo.minBaseLimit, (float) generationInfo.maxBaseLimit), 0, 1000, "%.2f");
                        cell.setScale(Scales.pow(5));
                        cell.addPropertyConsumer(val -> {
                            generationInfo.minBaseLimit = val.getMin();
                            generationInfo.maxBaseLimit = val.getMax();
                        });
                        return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.amount.pervillage"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.vanilla.amount.pervillage.tooltip"));
                    }
                case 1:
                    {
                        TableCellFloatRange cell = new TableCellFloatRange("scaledLimit", new FloatRange((float) generationInfo.minScaledLimit, (float) generationInfo.maxScaledLimit), 0, 1000, "%.2f");
                        cell.setScale(Scales.pow(5));
                        cell.addPropertyConsumer(val -> {
                            generationInfo.minScaledLimit = val.getMin();
                            generationInfo.maxScaledLimit = val.getMax();
                        });
                        return new TitledCell(IvTranslations.get("reccomplex.generationInfo.vanilla.amount.scaled"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.vanilla.amount.scaled.tooltip"));
                    }
            }
            break;
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) FloatRange(ivorius.ivtoolkit.gui.FloatRange) ivorius.reccomplex.gui.table(ivorius.reccomplex.gui.table) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) Directions(ivorius.ivtoolkit.blocks.Directions) EnumFacing(net.minecraft.util.EnumFacing) TableDataSourceBlockPos(ivorius.reccomplex.gui.TableDataSourceBlockPos) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) VanillaGeneration(ivorius.reccomplex.world.gen.feature.structure.generic.generation.VanillaGeneration) Scales(ivorius.reccomplex.utils.scale.Scales) RCGuiTables(ivorius.reccomplex.gui.RCGuiTables) TableDirections(ivorius.reccomplex.gui.TableDirections) TableDataSourceExpression(ivorius.reccomplex.gui.TableDataSourceExpression) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) EnumFacing(net.minecraft.util.EnumFacing) FloatRange(ivorius.ivtoolkit.gui.FloatRange) TableCellFloatRange(ivorius.reccomplex.gui.table.cell.TableCellFloatRange) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum)

Example 3 with TableCell

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

the class GuiTable method mouseClicked.

public void mouseClicked(int x, int y, int button) {
    for (TableCell cell : currentCells) cell.mouseClicked(button, x, y);
    if (scrollBarBounds().contains(x, y)) {
        dragsScrollBar = true;
        dragScrollBar(x, y);
    }
}
Also used : TableCell(ivorius.reccomplex.gui.table.cell.TableCell)

Example 4 with TableCell

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

the class TableDataSourceStaticPattern method cellForIndexInSegment.

@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
    switch(segment) {
        case 0:
            {
                if (index == 0) {
                    TableCellStringInt cell = new TableCellStringInt("repeatX", pattern.repeatX);
                    cell.addPropertyConsumer(val -> pattern.repeatX = val);
                    return new TitledCell(IvTranslations.get("reccomplex.generationInfo.static.pattern.repeat.x"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.static.pattern.repeat.tooltip"));
                } else if (index == 1) {
                    TableCellStringInt cell = new TableCellStringInt("repeatZ", pattern.repeatZ);
                    cell.addPropertyConsumer(val -> pattern.repeatZ = val);
                    return new TitledCell(IvTranslations.get("reccomplex.generationInfo.static.pattern.repeat.z"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.static.pattern.repeat.tooltip"));
                }
            }
        case 1:
            {
                if (index == 0) {
                    TableCellInteger cell = new TableCellInteger("shiftX", pattern.randomShiftX, 0, 10);
                    cell.addPropertyConsumer(val -> pattern.randomShiftX = val);
                    return new TitledCell(IvTranslations.get("reccomplex.generationInfo.static.pattern.rshift.x"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.static.pattern.rshift.tooltip"));
                } else if (index == 1) {
                    TableCellInteger cell = new TableCellInteger("shiftZ", pattern.randomShiftZ, 0, 10);
                    cell.addPropertyConsumer(val -> pattern.randomShiftZ = val);
                    return new TitledCell(IvTranslations.get("reccomplex.generationInfo.static.pattern.rshift.z"), cell).withTitleTooltip(IvTranslations.getLines("reccomplex.generationInfo.static.pattern.rshift.tooltip"));
                }
            }
    }
    return super.cellForIndexInSegment(table, index, segment);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) IvTranslations(ivorius.ivtoolkit.tools.IvTranslations) StaticGeneration(ivorius.reccomplex.world.gen.feature.structure.generic.generation.StaticGeneration) ivorius.reccomplex.gui.table(ivorius.reccomplex.gui.table) TableCell(ivorius.reccomplex.gui.table.cell.TableCell) TableCellInteger(ivorius.reccomplex.gui.table.cell.TableCellInteger) TableDataSourceSegmented(ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented) TableCellStringInt(ivorius.reccomplex.gui.table.cell.TableCellStringInt) Nonnull(javax.annotation.Nonnull) TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) TableCellInteger(ivorius.reccomplex.gui.table.cell.TableCellInteger) TableCellStringInt(ivorius.reccomplex.gui.table.cell.TableCellStringInt)

Example 5 with TableCell

use of ivorius.reccomplex.gui.table.cell.TableCell 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)

Aggregations

TableCell (ivorius.reccomplex.gui.table.cell.TableCell)7 IvTranslations (ivorius.ivtoolkit.tools.IvTranslations)5 TitledCell (ivorius.reccomplex.gui.table.cell.TitledCell)5 TableDataSourceSegmented (ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented)5 Nonnull (javax.annotation.Nonnull)4 TableDataSourceExpression (ivorius.reccomplex.gui.TableDataSourceExpression)3 ivorius.reccomplex.gui.table (ivorius.reccomplex.gui.table)3 GuiTable (ivorius.reccomplex.gui.table.GuiTable)2 TableDelegate (ivorius.reccomplex.gui.table.TableDelegate)2 TableNavigator (ivorius.reccomplex.gui.table.TableNavigator)2 TableCellBoolean (ivorius.reccomplex.gui.table.cell.TableCellBoolean)2 TableCellString (ivorius.reccomplex.gui.table.cell.TableCellString)2 Directions (ivorius.ivtoolkit.blocks.Directions)1 FloatRange (ivorius.ivtoolkit.gui.FloatRange)1 RecurrentComplex (ivorius.reccomplex.RecurrentComplex)1 GuiValidityStateIndicator (ivorius.reccomplex.gui.GuiValidityStateIndicator)1 RCGuiHandler (ivorius.reccomplex.gui.RCGuiHandler)1 RCGuiTables (ivorius.reccomplex.gui.RCGuiTables)1 TableDataSourceBlockPos (ivorius.reccomplex.gui.TableDataSourceBlockPos)1 TableDirections (ivorius.reccomplex.gui.TableDirections)1