Search in sources :

Example 1 with FloatRange

use of ivorius.ivtoolkit.gui.FloatRange 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)

Aggregations

Directions (ivorius.ivtoolkit.blocks.Directions)1 FloatRange (ivorius.ivtoolkit.gui.FloatRange)1 IvTranslations (ivorius.ivtoolkit.tools.IvTranslations)1 RCGuiTables (ivorius.reccomplex.gui.RCGuiTables)1 TableDataSourceBlockPos (ivorius.reccomplex.gui.TableDataSourceBlockPos)1 TableDataSourceExpression (ivorius.reccomplex.gui.TableDataSourceExpression)1 TableDirections (ivorius.reccomplex.gui.TableDirections)1 ivorius.reccomplex.gui.table (ivorius.reccomplex.gui.table)1 TableCell (ivorius.reccomplex.gui.table.cell.TableCell)1 TableCellEnum (ivorius.reccomplex.gui.table.cell.TableCellEnum)1 TableCellFloatRange (ivorius.reccomplex.gui.table.cell.TableCellFloatRange)1 TitledCell (ivorius.reccomplex.gui.table.cell.TitledCell)1 TableDataSourceSegmented (ivorius.reccomplex.gui.table.datasource.TableDataSourceSegmented)1 Scales (ivorius.reccomplex.utils.scale.Scales)1 VanillaGeneration (ivorius.reccomplex.world.gen.feature.structure.generic.generation.VanillaGeneration)1 EnumFacing (net.minecraft.util.EnumFacing)1