Search in sources :

Example 1 with AllSpecialTextures

use of com.simibubi.create.AllSpecialTextures in project Create by Creators-of-Create.

the class BlockClusterOutline method render.

@Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) {
    cluster.visibleEdges.forEach(edge -> {
        Vec3 start = Vec3.atLowerCornerOf(edge.pos);
        Direction direction = Direction.get(AxisDirection.POSITIVE, edge.axis);
        renderAACuboidLine(ms, buffer, start, Vec3.atLowerCornerOf(edge.pos.relative(direction)));
    });
    Optional<AllSpecialTextures> faceTexture = params.faceTexture;
    if (!faceTexture.isPresent())
        return;
    RenderType translucentType = RenderTypes.getOutlineTranslucent(faceTexture.get().getLocation(), true);
    VertexConsumer builder = buffer.getLateBuffer(translucentType);
    cluster.visibleFaces.forEach((face, axisDirection) -> {
        Direction direction = Direction.get(axisDirection, face.axis);
        BlockPos pos = face.pos;
        if (axisDirection == AxisDirection.POSITIVE)
            pos = pos.relative(direction.getOpposite());
        renderBlockFace(ms, builder, pos, direction);
    });
}
Also used : AllSpecialTextures(com.simibubi.create.AllSpecialTextures) Vec3(net.minecraft.world.phys.Vec3) VertexConsumer(com.mojang.blaze3d.vertex.VertexConsumer) BlockPos(net.minecraft.core.BlockPos) Direction(net.minecraft.core.Direction) AxisDirection(net.minecraft.core.Direction.AxisDirection) RenderType(net.minecraft.client.renderer.RenderType)

Example 2 with AllSpecialTextures

use of com.simibubi.create.AllSpecialTextures in project Create by Creators-of-Create.

the class FlipTool method renderOnSchematic.

@Override
public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer) {
    if (!schematicSelected || !selectedFace.getAxis().isHorizontal()) {
        super.renderOnSchematic(ms, buffer);
        return;
    }
    Direction facing = selectedFace.getClockWise();
    AABB bounds = schematicHandler.getBounds();
    Vec3 directionVec = Vec3.atLowerCornerOf(Direction.get(AxisDirection.POSITIVE, facing.getAxis()).getNormal());
    Vec3 boundsSize = new Vec3(bounds.getXsize(), bounds.getYsize(), bounds.getZsize());
    Vec3 vec = boundsSize.multiply(directionVec);
    bounds = bounds.contract(vec.x, vec.y, vec.z).inflate(1 - directionVec.x, 1 - directionVec.y, 1 - directionVec.z);
    bounds = bounds.move(directionVec.scale(.5f).multiply(boundsSize));
    outline.setBounds(bounds);
    AllSpecialTextures tex = AllSpecialTextures.CHECKERED;
    outline.getParams().lineWidth(1 / 16f).disableNormals().colored(0xdddddd).withFaceTextures(tex, tex);
    outline.render(ms, buffer, AnimationTickHolder.getPartialTicks());
    super.renderOnSchematic(ms, buffer);
}
Also used : AllSpecialTextures(com.simibubi.create.AllSpecialTextures) Vec3(net.minecraft.world.phys.Vec3) AxisDirection(net.minecraft.core.Direction.AxisDirection) Direction(net.minecraft.core.Direction) AABB(net.minecraft.world.phys.AABB)

Aggregations

AllSpecialTextures (com.simibubi.create.AllSpecialTextures)2 Direction (net.minecraft.core.Direction)2 AxisDirection (net.minecraft.core.Direction.AxisDirection)2 Vec3 (net.minecraft.world.phys.Vec3)2 VertexConsumer (com.mojang.blaze3d.vertex.VertexConsumer)1 RenderType (net.minecraft.client.renderer.RenderType)1 BlockPos (net.minecraft.core.BlockPos)1 AABB (net.minecraft.world.phys.AABB)1