Java Code Examples for net.minecraft.client.renderer.BufferBuilder#State

The following examples show how to use net.minecraft.client.renderer.BufferBuilder#State . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastBlockModelRenderer.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
private static void renderBlockModelHighQuality(Tessellator tessellator, World world,
    IBlockState blockstateToRender, int brightness) {
    BufferBuilder.State vertexData = blockstateToVertexData.get(blockstateToRender);

    if (vertexData == null) {
        generateRenderDataFor(world, blockstateToRender);
        vertexData = blockstateToVertexData.get(blockstateToRender);
    }
    renderVertexState(vertexData, tessellator, brightness);
}
 
Example 2
Source File: FastBlockModelRenderer.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
private static void renderVertexState(BufferBuilder.State data, Tessellator tessellator,
    int brightness) {
    GL11.glPushMatrix();
    tessellator.getBuffer().begin(7, DefaultVertexFormats.BLOCK);

    tessellator.getBuffer().setVertexState(data);
    int j = tessellator.getBuffer().vertexFormat.getSize() >> 2;
    int cont = tessellator.getBuffer().getVertexCount();
    int offsetUV = tessellator.getBuffer().vertexFormat.getUvOffsetById(1) / 4;
    int bufferNextSize = tessellator.getBuffer().vertexFormat.getIntegerSize();

    for (int contont = 0; contont < cont; contont += 4) {
        try {
            int i = (contont) * bufferNextSize + offsetUV;

            tessellator.getBuffer().rawIntBuffer.put(i, brightness);
            tessellator.getBuffer().rawIntBuffer.put(i + j, brightness);
            tessellator.getBuffer().rawIntBuffer.put(i + j * 2, brightness);
            tessellator.getBuffer().rawIntBuffer.put(i + j * 3, brightness);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    tessellator.draw();

    GL11.glPopMatrix();
}
 
Example 3
Source File: FastBlockModelRenderer.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
private static void generateRenderDataFor(World world, IBlockState state) {
    VERTEX_BUILDER.begin(7, DefaultVertexFormats.BLOCK);
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft()
        .getBlockRendererDispatcher();
    IBakedModel modelFromState = blockrendererdispatcher.getModelForState(state);
    blockrendererdispatcher.getBlockModelRenderer()
        .renderModel(Minecraft.getMinecraft().world, modelFromState,
            Blocks.AIR.getDefaultState(), offsetPos, VERTEX_BUILDER, false, 0);
    BufferBuilder.State toReturn = VERTEX_BUILDER.getVertexState();
    VERTEX_BUILDER.finishDrawing();
    VERTEX_BUILDER.reset();
    blockstateToVertexData.put(state, toReturn);
}
 
Example 4
Source File: CompiledChunkSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BufferBuilder.State getBlockBufferState(BlockRenderLayer layer)
{
    return this.blockBufferStates[layer.ordinal()];
}
 
Example 5
Source File: CompiledChunkSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void setBlockBufferState(BlockRenderLayer layer, BufferBuilder.State state)
{
    this.blockBufferStates[layer.ordinal()] = state;
}
 
Example 6
Source File: CompiledChunkSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BufferBuilder.State getOverlayBufferState(OverlayRenderType type)
{
    return this.overlayBufferStates[type.ordinal()];
}
 
Example 7
Source File: CompiledChunkSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void setOverlayBufferState(OverlayRenderType type, BufferBuilder.State state)
{
    this.overlayBufferStates[type.ordinal()] = state;
}