Search in sources :

Example 6 with RenderLayer

use of net.minecraft.client.render.RenderLayer in project Biome-Makeover by Lemonszz.

the class StoneGolemEntityRender method render.

@Override
public void render(StoneGolemEntity entity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    matrixStack.push();
    boolean visible = this.isVisible(entity);
    boolean isInvis = !visible && !entity.isInvisibleTo(MinecraftClient.getInstance().player);
    boolean outline = MinecraftClient.getInstance().hasOutline(entity);
    matrixStack.scale(-1.0F, -1.0F, 1.0F);
    // ????
    matrixStack.translate(0.0D, -1.5010000467300415D, 0.0D);
    RenderLayer renderLayer = this.getRenderLayer(entity, visible, isInvis, outline);
    if (renderLayer != null) {
        VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(renderLayer);
        int overlay = getOverlay(entity, this.getAnimationCounter(entity, g));
        getModel().renderBase(matrixStack, vertexConsumer, i, overlay, 1F, 1F, 1F, isInvis ? 0.15F : 1.0F);
    }
    matrixStack.pop();
    super.render(entity, f, g, matrixStack, vertexConsumerProvider, i);
}
Also used : RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 7 with RenderLayer

use of net.minecraft.client.render.RenderLayer in project Client by MatHax.

the class BannerBlockEntityRendererMixin method renderCrossbar.

private void renderCrossbar(BannerBlockEntity bannerBlockEntity, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
    matrixStack.push();
    BlockState blockState = bannerBlockEntity.getCachedState();
    matrixStack.translate(0.5D, -0.1666666716337204D, 0.5D);
    float h = -(blockState.get(WallBannerBlock.FACING)).asRotation();
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(h));
    matrixStack.translate(0.0D, -0.3125D, -0.4375D);
    matrixStack.push();
    matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);
    VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);
    this.crossbar.render(matrixStack, vertexConsumer, i, j);
    matrixStack.pop();
    matrixStack.pop();
}
Also used : BlockState(net.minecraft.block.BlockState) RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 8 with RenderLayer

use of net.minecraft.client.render.RenderLayer in project Client by MatHax.

the class BannerBlockEntityRendererMixin method renderPillar.

private void renderPillar(BannerBlockEntity bannerBlockEntity, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {
    matrixStack.push();
    BlockState blockState = bannerBlockEntity.getCachedState();
    matrixStack.translate(0.5D, 0.5D, 0.5D);
    float h = -blockState.get(WallBannerBlock.FACING).asRotation();
    matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(h));
    matrixStack.push();
    matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);
    VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);
    this.pillar.render(matrixStack, vertexConsumer, i, j);
    matrixStack.pop();
    matrixStack.pop();
}
Also used : BlockState(net.minecraft.block.BlockState) RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 9 with RenderLayer

use of net.minecraft.client.render.RenderLayer in project dark-enchanting by frqnny.

the class DarkEnchanterBlockEntityRenderer method render.

@Override
public void render(DarkEnchanterBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
    matrices.push();
    matrices.translate(0.5D, 0.75D, 0.5D);
    float g = (float) blockEntity.ticks + tickDelta;
    matrices.translate(0.0D, (0.1F + MathHelper.sin(g * 0.1F) * 0.01F), 0.0D);
    float h = blockEntity.bookRotation - blockEntity.bookRotationPrev;
    while (h >= 3.1415927F) {
        h -= 6.2831855F;
    }
    while (h < -3.1415927F) {
        h += 6.2831855F;
    }
    float k = blockEntity.bookRotationPrev + h * tickDelta;
    matrices.multiply(Vec3f.POSITIVE_Y.getRadialQuaternion(-k));
    matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(80.0F));
    float l = MathHelper.lerp(tickDelta, blockEntity.pageAngle, blockEntity.nextPageAngle);
    float m = MathHelper.fractionalPart(l + 0.25F) * 1.6F - 0.3F;
    float n = MathHelper.fractionalPart(l + 0.75F) * 1.6F - 0.3F;
    float o = MathHelper.lerp(tickDelta, blockEntity.pageTurningSpeed, blockEntity.nextPageTurningSpeed);
    this.book.setPageAngles(g, MathHelper.clamp(m, 0.0F, 1.0F), MathHelper.clamp(n, 0.0F, 1.0F), o);
    VertexConsumer vertexConsumer = BOOK_TEX.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid);
    this.book.render(matrices, vertexConsumer, light, overlay, 1.0F, 1.0F, 1.0F, 1.0F);
    matrices.pop();
}
Also used : RenderLayer(net.minecraft.client.render.RenderLayer) VertexConsumer(net.minecraft.client.render.VertexConsumer)

Example 10 with RenderLayer

use of net.minecraft.client.render.RenderLayer in project Indium by comp500.

the class AbstractMeshConsumer method tesselateQuad.

/**
 * Determines color index and render layer, then routes to appropriate
 * tesselate routine based on material properties.
 */
private void tesselateQuad(MutableQuadViewImpl quad, RenderMaterialImpl.Value mat, int textureIndex) {
    final int colorIndex = mat.disableColorIndex(textureIndex) ? -1 : quad.colorIndex();
    final RenderLayer renderLayer = blockInfo.effectiveRenderLayer(mat.blendMode(textureIndex));
    if (blockInfo.defaultAo && !mat.disableAo(textureIndex)) {
        if (mat.emissive(textureIndex)) {
            tesselateSmoothEmissive(quad, renderLayer, colorIndex);
        } else {
            tesselateSmooth(quad, renderLayer, colorIndex);
        }
    } else {
        if (mat.emissive(textureIndex)) {
            tesselateFlatEmissive(quad, renderLayer, colorIndex);
        } else {
            tesselateFlat(quad, renderLayer, colorIndex);
        }
    }
}
Also used : RenderLayer(net.minecraft.client.render.RenderLayer)

Aggregations

RenderLayer (net.minecraft.client.render.RenderLayer)16 BlockState (net.minecraft.block.BlockState)9 VertexConsumer (net.minecraft.client.render.VertexConsumer)8 BufferBuilder (net.minecraft.client.render.BufferBuilder)5 BlockPos (net.minecraft.util.math.BlockPos)5 BlockEntity (net.minecraft.block.entity.BlockEntity)4 ChunkOcclusionDataBuilder (net.minecraft.client.render.chunk.ChunkOcclusionDataBuilder)4 FluidState (net.minecraft.fluid.FluidState)4 BlockRenderManager (net.minecraft.client.render.block.BlockRenderManager)3 ChunkRendererRegion (net.minecraft.client.render.chunk.ChunkRendererRegion)3 HashSet (java.util.HashSet)2 Random (java.util.Random)2 CloneableBufferBuilder (me.jellysquid.mods.sodium.client.render.chunk.CloneableBufferBuilder)2 ChunkMeshBuilder (me.jellysquid.mods.sodium.client.render.mesh.ChunkMeshBuilder)2 BufferUploadData (me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData)2 Block (net.minecraft.block.Block)2 MatrixStack (net.minecraft.client.util.math.MatrixStack)2 Vector3f (net.minecraft.client.util.math.Vector3f)2 RenderBlockEvent (com.tangykiwi.kiwiclient.event.RenderBlockEvent)1 RenderFluidEvent (com.tangykiwi.kiwiclient.event.RenderFluidEvent)1