use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceMazePath method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
if (segment == 1) {
TableCellEnum.Option<EnumFacing>[] optionList = TableDirections.getDirectionOptions(EnumFacing.VALUES);
TableCellEnum<EnumFacing> cell = new TableCellEnum<>("side", directionFromPath(mazePath), optionList);
cell.addPropertyConsumer(val -> {
SavedMazePathConnection path = pathFromDirection(val, mazePath.sourceRoom.getCoordinates());
mazePath.pathDimension = path.path.pathDimension;
mazePath.pathGoesUp = path.path.pathGoesUp;
tableDelegate.reloadData();
});
return new TitledCell(IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.side"), cell);
} else if (segment == 2) {
invertableButton = new TableCellButton("actions", "inverse", IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.invert"), isInvertable());
invertableButton.addAction(() -> {
mazePath.set(mazePath.inverse());
source.room = mazePath.sourceRoom;
tableDelegate.reloadData();
});
return new TitledCell(invertableButton);
}
return super.cellForIndexInSegment(table, index, segment);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell 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);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceInvGenSingleTag method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
if (segment == 0) {
if (index == 0) {
TableCellFloat cell = new TableCellFloat("itemCount", item.getItemChance(stack), 0, 1);
cell.setScale(Scales.pow(5));
cell.addPropertyConsumer(range -> item.setItemChance(stack, range));
return new TitledCell(IvTranslations.get("reccomplex.gui.inventorygen.single.chance"), cell);
}
}
return null;
}
use of ivorius.reccomplex.gui.table.cell.TitledCell 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);
}
use of ivorius.reccomplex.gui.table.cell.TitledCell in project RecurrentComplex by Ivorforce.
the class TableDataSourceBlockPos method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
IntegerRange range;
int val;
String title;
switch(index) {
case 0:
range = rangeX;
val = coord.getX();
title = titleX;
break;
case 1:
range = rangeY;
val = coord.getY();
title = titleY;
break;
default:
range = rangeZ;
val = coord.getZ();
title = titleZ;
break;
}
if (range != null) {
TableCellInteger cell = new TableCellInteger(null, val, range.min, range.max);
cell.addPropertyConsumer(createConsumer(index));
return new TitledCell(title, cell);
} else {
TableCellStringInt cell = new TableCellStringInt(null, val);
cell.addPropertyConsumer(createConsumer(index));
return new TitledCell(title, cell);
}
}
Aggregations