Search in sources :

Example 1 with ShapeMode

use of meteordevelopment.meteorclient.renderer.ShapeMode in project meteor-client by MeteorDevelopment.

the class SBlockDataScreen method initWidgets.

@Override
public void initWidgets() {
    Settings settings = new Settings();
    SettingGroup sgGeneral = settings.getDefaultGroup();
    SettingGroup sgTracer = settings.createGroup("Tracer");
    sgGeneral.add(new EnumSetting.Builder<ShapeMode>().name("shape-mode").description("How the shape is rendered.").defaultValue(ShapeMode.Lines).onModuleActivated(shapeModeSetting -> shapeModeSetting.set(blockData.shapeMode)).onChanged(shapeMode -> {
        blockData.shapeMode = shapeMode;
        changed(blockData, block, setting);
    }).build());
    sgGeneral.add(new ColorSetting.Builder().name("line-color").description("Color of lines.").defaultValue(new SettingColor(0, 255, 200)).onModuleActivated(settingColorSetting -> settingColorSetting.set(blockData.lineColor)).onChanged(settingColor -> {
        blockData.lineColor.set(settingColor);
        changed(blockData, block, setting);
    }).build());
    sgGeneral.add(new ColorSetting.Builder().name("side-color").description("Color of sides.").defaultValue(new SettingColor(0, 255, 200, 25)).onModuleActivated(settingColorSetting -> settingColorSetting.set(blockData.sideColor)).onChanged(settingColor -> {
        blockData.sideColor.set(settingColor);
        changed(blockData, block, setting);
    }).build());
    sgTracer.add(new BoolSetting.Builder().name("tracer").description("If tracer line is allowed to this block.").defaultValue(true).onModuleActivated(booleanSetting -> booleanSetting.set(blockData.tracer)).onChanged(aBoolean -> {
        blockData.tracer = aBoolean;
        changed(blockData, block, setting);
    }).build());
    sgTracer.add(new ColorSetting.Builder().name("tracer-color").description("Color of tracer line.").defaultValue(new SettingColor(0, 255, 200, 125)).onModuleActivated(settingColorSetting -> settingColorSetting.set(blockData.tracerColor)).onChanged(settingColor -> {
        blockData.tracerColor = settingColor;
        changed(blockData, block, setting);
    }).build());
    settings.onActivated();
    add(theme.settings(settings)).expandX();
}
Also used : GuiTheme(meteordevelopment.meteorclient.gui.GuiTheme) WindowScreen(meteordevelopment.meteorclient.gui.WindowScreen) Block(net.minecraft.block.Block) ShapeMode(meteordevelopment.meteorclient.renderer.ShapeMode) meteordevelopment.meteorclient.settings(meteordevelopment.meteorclient.settings) SettingColor(meteordevelopment.meteorclient.utils.render.color.SettingColor) ShapeMode(meteordevelopment.meteorclient.renderer.ShapeMode) SettingColor(meteordevelopment.meteorclient.utils.render.color.SettingColor)

Example 2 with ShapeMode

use of meteordevelopment.meteorclient.renderer.ShapeMode in project meteor-client by MeteorDevelopment.

the class SBlock method render.

public void render(Render3DEvent event) {
    double x1 = x;
    double y1 = y;
    double z1 = z;
    double x2 = x + 1;
    double y2 = y + 1;
    double z2 = z + 1;
    VoxelShape shape = state.getOutlineShape(mc.world, blockPos);
    if (!shape.isEmpty()) {
        x1 = x + shape.getMin(Direction.Axis.X);
        y1 = y + shape.getMin(Direction.Axis.Y);
        z1 = z + shape.getMin(Direction.Axis.Z);
        x2 = x + shape.getMax(Direction.Axis.X);
        y2 = y + shape.getMax(Direction.Axis.Y);
        z2 = z + shape.getMax(Direction.Axis.Z);
    }
    SBlockData blockData = search.getBlockData(state.getBlock());
    ShapeMode shapeMode = blockData.shapeMode;
    Color lineColor = blockData.lineColor;
    Color sideColor = blockData.sideColor;
    if (neighbours == 0) {
        event.renderer.box(x1, y1, z1, x2, y2, z2, sideColor, lineColor, shapeMode, 0);
    } else {
        // Lines
        if (shapeMode.lines()) {
            // Vertical, BA_LE
            if (((neighbours & LE) != LE && (neighbours & BA) != BA) || ((neighbours & LE) == LE && (neighbours & BA) == BA && (neighbours & BA_LE) != BA_LE)) {
                event.renderer.line(x1, y1, z1, x1, y2, z1, lineColor);
            }
            // Vertical, FO_LE
            if (((neighbours & LE) != LE && (neighbours & FO) != FO) || ((neighbours & LE) == LE && (neighbours & FO) == FO && (neighbours & FO_LE) != FO_LE)) {
                event.renderer.line(x1, y1, z2, x1, y2, z2, lineColor);
            }
            // Vertical, BA_RI
            if (((neighbours & RI) != RI && (neighbours & BA) != BA) || ((neighbours & RI) == RI && (neighbours & BA) == BA && (neighbours & BA_RI) != BA_RI)) {
                event.renderer.line(x2, y1, z1, x2, y2, z1, lineColor);
            }
            // Vertical, FO_RI
            if (((neighbours & RI) != RI && (neighbours & FO) != FO) || ((neighbours & RI) == RI && (neighbours & FO) == FO && (neighbours & FO_RI) != FO_RI)) {
                event.renderer.line(x2, y1, z2, x2, y2, z2, lineColor);
            }
            // Horizontal bottom, BA_LE - BA_RI
            if (((neighbours & BA) != BA && (neighbours & BO) != BO) || ((neighbours & BA) != BA && (neighbours & BO_BA) == BO_BA)) {
                event.renderer.line(x1, y1, z1, x2, y1, z1, lineColor);
            }
            // Horizontal bottom, FO_LE - FO_RI
            if (((neighbours & FO) != FO && (neighbours & BO) != BO) || ((neighbours & FO) != FO && (neighbours & BO_FO) == BO_FO)) {
                event.renderer.line(x1, y1, z2, x2, y1, z2, lineColor);
            }
            // Horizontal top, BA_LE - BA_RI
            if (((neighbours & BA) != BA && (neighbours & TO) != TO) || ((neighbours & BA) != BA && (neighbours & TO_BA) == TO_BA)) {
                event.renderer.line(x1, y2, z1, x2, y2, z1, lineColor);
            }
            // Horizontal top, FO_LE - FO_RI
            if (((neighbours & FO) != FO && (neighbours & TO) != TO) || ((neighbours & FO) != FO && (neighbours & TO_FO) == TO_FO)) {
                event.renderer.line(x1, y2, z2, x2, y2, z2, lineColor);
            }
            // Horizontal bottom, BA_LE - FO_LE
            if (((neighbours & LE) != LE && (neighbours & BO) != BO) || ((neighbours & LE) != LE && (neighbours & BO_LE) == BO_LE)) {
                event.renderer.line(x1, y1, z1, x1, y1, z2, lineColor);
            }
            // Horizontal bottom, BA_RI - FO_RI
            if (((neighbours & RI) != RI && (neighbours & BO) != BO) || ((neighbours & RI) != RI && (neighbours & BO_RI) == BO_RI)) {
                event.renderer.line(x2, y1, z1, x2, y1, z2, lineColor);
            }
            // Horizontal top, BA_LE - FO_LE
            if (((neighbours & LE) != LE && (neighbours & TO) != TO) || ((neighbours & LE) != LE && (neighbours & TO_LE) == TO_LE)) {
                event.renderer.line(x1, y2, z1, x1, y2, z2, lineColor);
            }
            // Horizontal top, BA_RI - FO_RI
            if (((neighbours & RI) != RI && (neighbours & TO) != TO) || ((neighbours & RI) != RI && (neighbours & TO_RI) == TO_RI)) {
                event.renderer.line(x2, y2, z1, x2, y2, z2, lineColor);
            }
        }
        // Sides
        if (shapeMode.sides()) {
            // Bottom
            if ((neighbours & BO) != BO) {
                event.renderer.quadHorizontal(x1, y1, z1, x2, z2, sideColor);
            }
            // Top
            if ((neighbours & TO) != TO) {
                event.renderer.quadHorizontal(x1, y2, z1, x2, z2, sideColor);
            }
            // Front
            if ((neighbours & FO) != FO) {
                event.renderer.quadVertical(x1, y1, z2, x2, y2, z2, sideColor);
            }
            // Back
            if ((neighbours & BA) != BA) {
                event.renderer.quadVertical(x1, y1, z1, x2, y2, z1, sideColor);
            }
            // Right
            if ((neighbours & RI) != RI) {
                event.renderer.quadVertical(x2, y1, z1, x2, y2, z2, sideColor);
            }
            // Left
            if ((neighbours & LE) != LE) {
                event.renderer.quadVertical(x1, y1, z1, x1, y2, z2, sideColor);
            }
        }
    }
}
Also used : VoxelShape(net.minecraft.util.shape.VoxelShape) Color(meteordevelopment.meteorclient.utils.render.color.Color) ShapeMode(meteordevelopment.meteorclient.renderer.ShapeMode)

Aggregations

ShapeMode (meteordevelopment.meteorclient.renderer.ShapeMode)2 GuiTheme (meteordevelopment.meteorclient.gui.GuiTheme)1 WindowScreen (meteordevelopment.meteorclient.gui.WindowScreen)1 meteordevelopment.meteorclient.settings (meteordevelopment.meteorclient.settings)1 Color (meteordevelopment.meteorclient.utils.render.color.Color)1 SettingColor (meteordevelopment.meteorclient.utils.render.color.SettingColor)1 Block (net.minecraft.block.Block)1 VoxelShape (net.minecraft.util.shape.VoxelShape)1