Search in sources :

Example 1 with VertexLighterFlat

use of net.minecraftforge.client.model.pipeline.VertexLighterFlat in project GregTech by GregTechCE.

the class FacadeRenderer method setupLighter.

private static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, IBlockAccess access, BlockPos pos, IBakedModel model) {
    boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && model.isAmbientOcclusion();
    VertexLighterFlat lighter = renderAO ? lighterSmooth.get() : lighterFlat.get();
    AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs);
    lighter.setParent(consumer);
    consumer.setTranslation(translation);
    return lighter;
}
Also used : VertexLighterFlat(net.minecraftforge.client.model.pipeline.VertexLighterFlat)

Example 2 with VertexLighterFlat

use of net.minecraftforge.client.model.pipeline.VertexLighterFlat in project GregTech by GregTechCE.

the class FacadeRenderer method renderBlockCover.

public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, int side, IBlockState state, Cuboid6 bounds) {
    EnumFacing face = EnumFacing.VALUES[side];
    IBlockAccess coverAccess = new FacadeBlockAccess(world, pos, face, state);
    BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    try {
        state = state.getActualState(coverAccess, pos);
    } catch (Exception ignored) {
    }
    IBakedModel model = dispatcher.getModelForState(state);
    try {
        state = state.getBlock().getExtendedState(state, coverAccess, pos);
    } catch (Exception ignored) {
    }
    long posRand = net.minecraft.util.math.MathHelper.getPositionRandom(pos);
    List<BakedQuad> bakedQuads = new LinkedList<>(model.getQuads(state, null, posRand));
    for (EnumFacing face2 : EnumFacing.VALUES) {
        bakedQuads.addAll(model.getQuads(state, face2, posRand));
    }
    List<CCQuad> quads = CCQuad.fromArray(bakedQuads);
    quads = sliceQuads(quads, side, bounds);
    if (!quads.isEmpty()) {
        VertexLighterFlat lighter = setupLighter(ccrs, translation, state, coverAccess, pos, model);
        return renderBlockQuads(lighter, coverAccess, state, quads, pos);
    }
    return false;
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) EnumFacing(net.minecraft.util.EnumFacing) IBlockAccess(net.minecraft.world.IBlockAccess) CCQuad(codechicken.lib.render.CCQuad) LinkedList(java.util.LinkedList) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) VertexLighterFlat(net.minecraftforge.client.model.pipeline.VertexLighterFlat) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Aggregations

VertexLighterFlat (net.minecraftforge.client.model.pipeline.VertexLighterFlat)2 CCQuad (codechicken.lib.render.CCQuad)1 LinkedList (java.util.LinkedList)1 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 EnumFacing (net.minecraft.util.EnumFacing)1 IBlockAccess (net.minecraft.world.IBlockAccess)1