Search in sources :

Example 1 with BlockScarecrow

use of com.minecolonies.coremod.blocks.BlockScarecrow in project minecolonies by Minecolonies.

the class TileEntityScarecrowRenderer method render.

@Override
public void render(final AbstractScarecrowTileEntity te, final float partialTicks, final MatrixStack matrixStack, @NotNull final IRenderTypeBuffer iRenderTypeBuffer, final int lightA, final int lightB) {
    // Store the transformation
    matrixStack.pushPose();
    // Set viewport to tile entity position to render it
    matrixStack.translate(BLOCK_MIDDLE, YOFFSET, BLOCK_MIDDLE);
    matrixStack.mulPose(Vector3f.ZP.rotationDegrees(ROTATION));
    // In the case of worldLags tileEntities may sometimes disappear.
    if (te.getLevel().getBlockState(te.getBlockPos()).getBlock() instanceof BlockScarecrow) {
        final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(AbstractBlockMinecoloniesDefault.FACING);
        switch(facing) {
            case EAST:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_EAST));
                break;
            case SOUTH:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_SOUTH));
                break;
            case WEST:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_WEST));
                break;
            default:
        }
    }
    final IVertexBuilder vertexConsumer = getMaterial(te).buffer(iRenderTypeBuffer, RenderType::entitySolid);
    this.model.renderToBuffer(matrixStack, vertexConsumer, lightA, lightB, 1.0F, 1.0F, 1.0F, 1.0F);
    matrixStack.popPose();
}
Also used : BlockScarecrow(com.minecolonies.coremod.blocks.BlockScarecrow) Direction(net.minecraft.util.Direction) RenderType(net.minecraft.client.renderer.RenderType) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Example 2 with BlockScarecrow

use of com.minecolonies.coremod.blocks.BlockScarecrow in project minecolonies by ldtteam.

the class TileEntityScarecrowRenderer method render.

@Override
public void render(final AbstractScarecrowTileEntity te, final float partialTicks, final MatrixStack matrixStack, @NotNull final IRenderTypeBuffer iRenderTypeBuffer, final int lightA, final int lightB) {
    // Store the transformation
    matrixStack.pushPose();
    // Set viewport to tile entity position to render it
    matrixStack.translate(BLOCK_MIDDLE, YOFFSET, BLOCK_MIDDLE);
    matrixStack.mulPose(Vector3f.ZP.rotationDegrees(ROTATION));
    // In the case of worldLags tileEntities may sometimes disappear.
    if (te.getLevel().getBlockState(te.getBlockPos()).getBlock() instanceof BlockScarecrow) {
        final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(AbstractBlockMinecoloniesDefault.FACING);
        switch(facing) {
            case EAST:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_EAST));
                break;
            case SOUTH:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_SOUTH));
                break;
            case WEST:
                matrixStack.mulPose(Vector3f.YP.rotationDegrees(BASIC_ROTATION * ROTATE_WEST));
                break;
            default:
        }
    }
    final IVertexBuilder vertexConsumer = getMaterial(te).buffer(iRenderTypeBuffer, RenderType::entitySolid);
    this.model.renderToBuffer(matrixStack, vertexConsumer, lightA, lightB, 1.0F, 1.0F, 1.0F, 1.0F);
    matrixStack.popPose();
}
Also used : BlockScarecrow(com.minecolonies.coremod.blocks.BlockScarecrow) Direction(net.minecraft.util.Direction) RenderType(net.minecraft.client.renderer.RenderType) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Aggregations

BlockScarecrow (com.minecolonies.coremod.blocks.BlockScarecrow)2 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)2 RenderType (net.minecraft.client.renderer.RenderType)2 Direction (net.minecraft.util.Direction)2