Search in sources :

Example 1 with SavedMazePathConnection

use of ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection 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);
}
Also used : TitledCell(ivorius.reccomplex.gui.table.cell.TitledCell) EnumFacing(net.minecraft.util.EnumFacing) SavedMazePathConnection(ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection) TableCellEnum(ivorius.reccomplex.gui.table.cell.TableCellEnum) TableCellButton(ivorius.reccomplex.gui.table.cell.TableCellButton)

Example 2 with SavedMazePathConnection

use of ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection in project RecurrentComplex by Ivorforce.

the class TableDataSourceMazePath method pathFromDirection.

public static SavedMazePathConnection pathFromDirection(EnumFacing side, int[] room) {
    int pathDim = side.getFrontOffsetX() != 0 ? 0 : side.getFrontOffsetY() != 0 ? 1 : side.getFrontOffsetZ() != 0 ? 2 : -1;
    int offset = side.getFrontOffsetX() + side.getFrontOffsetY() + side.getFrontOffsetZ();
    return new SavedMazePathConnection(pathDim, new MazeRoom(room[0], room[1], room[2]), offset > 0, ConnectorStrategy.DEFAULT_PATH, Collections.emptyList());
}
Also used : MazeRoom(ivorius.ivtoolkit.maze.components.MazeRoom) SavedMazePathConnection(ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection)

Aggregations

SavedMazePathConnection (ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection)2 MazeRoom (ivorius.ivtoolkit.maze.components.MazeRoom)1 TableCellButton (ivorius.reccomplex.gui.table.cell.TableCellButton)1 TableCellEnum (ivorius.reccomplex.gui.table.cell.TableCellEnum)1 TitledCell (ivorius.reccomplex.gui.table.cell.TitledCell)1 EnumFacing (net.minecraft.util.EnumFacing)1