Search in sources :

Example 1 with BlockGreenHouseAir

use of com.infinityraider.agricraft.content.world.BlockGreenHouseAir in project AgriCraft by AgriCraft.

the class BlockGreenHouseAirRenderer method highlightGreenHouseAirBlocks.

protected void highlightGreenHouseAirBlocks(World world, BlockPos origin, MatrixStack transforms) {
    IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
    IVertexBuilder builder = buffer.getBuffer(this.getRenderType());
    transforms.push();
    Vector3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
    transforms.translate(-projectedView.x, -projectedView.y, -projectedView.z);
    Matrix4f matrix4f = transforms.getLast().getMatrix();
    BlockPos.Mutable pos = origin.toMutable();
    for (int x = -RANGE; x <= RANGE; x++) {
        for (int y = -RANGE; y <= RANGE; y++) {
            for (int z = -RANGE; z <= RANGE; z++) {
                pos.setPos(origin.getX() + x, origin.getY() + y, origin.getZ() + z);
                if (world.getBlockState(pos).getBlock() instanceof BlockGreenHouseAir) {
                    this.renderWireFrameCube(builder, matrix4f, pos);
                }
            }
        }
    }
    transforms.pop();
    buffer.finish(this.getRenderType());
}
Also used : Matrix4f(net.minecraft.util.math.vector.Matrix4f) BlockGreenHouseAir(com.infinityraider.agricraft.content.world.BlockGreenHouseAir) Vector3d(net.minecraft.util.math.vector.Vector3d) IRenderTypeBuffer(net.minecraft.client.renderer.IRenderTypeBuffer) BlockPos(net.minecraft.util.math.BlockPos) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Aggregations

BlockGreenHouseAir (com.infinityraider.agricraft.content.world.BlockGreenHouseAir)1 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)1 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)1 BlockPos (net.minecraft.util.math.BlockPos)1 Matrix4f (net.minecraft.util.math.vector.Matrix4f)1 Vector3d (net.minecraft.util.math.vector.Vector3d)1