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;
}
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;
}
Aggregations