use of codechicken.lib.vec.Matrix4 in project GregTech by GregTechCE.
the class FluidPipeRenderer method renderBlock.
@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setBrightness(world, pos);
BlockFluidPipe blockPipe = ((BlockFluidPipe) state.getBlock());
TileEntityFluidPipe tileEntityPipe = (TileEntityFluidPipe) blockPipe.getPipeTileEntity(world, pos);
if (tileEntityPipe == null) {
return false;
}
FluidPipeType fluidPipeType = tileEntityPipe.getPipeType();
Material pipeMaterial = tileEntityPipe.getPipeMaterial();
int paintingColor = tileEntityPipe.getInsulationColor();
if (fluidPipeType != null && pipeMaterial != null) {
BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
if (renderLayer == BlockRenderLayer.CUTOUT) {
int connectedSidesMask = blockPipe.getActualConnections(tileEntityPipe, world);
IVertexOperation[] pipeline = new IVertexOperation[] { new Translation(pos) };
renderPipeBlock(pipeMaterial, fluidPipeType, paintingColor, renderState, pipeline, connectedSidesMask);
}
ICoverable coverable = tileEntityPipe.getCoverableImplementation();
coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer);
}
return true;
}
use of codechicken.lib.vec.Matrix4 in project GregTech by GregTechCE.
the class StoneRenderer method renderBlock.
@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
// otherwise, we are in solid rendering layer and render primary stone
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
Matrix4 translation = new Matrix4();
translation.translate(pos.getX(), pos.getY(), pos.getZ());
TextureAtlasSprite stoneSprite = TextureUtils.getBlockTexture("stone");
Material material = ((BlockSurfaceRock) state.getBlock()).getStoneMaterial(world, pos, state);
int renderingColor = GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB);
IVertexOperation[] operations = new IVertexOperation[] { new IconTransformation(stoneSprite), new ColourMultiplier(renderingColor), new TransformationList(translation) };
if (world != null) {
renderState.setBrightness(world, pos);
}
renderState.setPipeline(operations);
CCModel actualModel = getActualModel(world, pos);
renderState.setModel(actualModel);
renderState.render();
return true;
}
use of codechicken.lib.vec.Matrix4 in project GregTech by GregTechCE.
the class MetaTileEntityPrimitiveBlastFurnace method renderMetaTileEntity.
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
Textures.PRIMITIVE_BLAST_FURNACE_OVERLAY.render(renderState, translation, pipeline, getFrontFacing(), isActive());
if (isActive() && isStructureFormed()) {
EnumFacing back = getFrontFacing().getOpposite();
Matrix4 offset = translation.copy().translate(back.getXOffset(), -0.3, back.getZOffset());
TextureAtlasSprite sprite = TextureUtils.getBlockTexture("lava_still");
renderState.brightness = 0xF000F0;
renderState.colour = 0xFFFFFFFF;
Textures.renderFace(renderState, offset, new IVertexOperation[0], EnumFacing.UP, Cuboid6.full, sprite);
}
}
use of codechicken.lib.vec.Matrix4 in project GregTech by GregTechCE.
the class FacadeRenderer method renderItemCover.
public static void renderItemCover(CCRenderState ccrs, int side, ItemStack renderStack, Cuboid6 bounds) {
Minecraft minecraft = Minecraft.getMinecraft();
RenderItem renderItem = minecraft.getRenderItem();
IBakedModel model = renderItem.getItemModelWithOverrides(renderStack, null, null);
IBlockState state = FacadeHelper.lookupBlockForItem(renderStack);
String cacheKey = state.getBlock().getRegistryName() + "|" + state.getBlock().getMetaFromState(state);
List<CCQuad> renderQuads = itemQuadCache.getIfPresent(cacheKey);
if (renderQuads == null) {
List<BakedQuad> quads = new ArrayList<>(model.getQuads(null, null, 0));
for (EnumFacing face : EnumFacing.VALUES) {
quads.addAll(model.getQuads(null, face, 0));
}
renderQuads = applyItemTint(sliceQuads(CCQuad.fromArray(quads), side, bounds), renderStack);
itemQuadCache.put(cacheKey, renderQuads);
}
AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs);
consumer.setTranslation(new Matrix4().translate(Vector3.center.copy().subtract(bounds.center())).scale(1.05, 1.05, 1.05));
for (CCQuad quad : renderQuads) {
quad.pipe(consumer);
}
}
use of codechicken.lib.vec.Matrix4 in project GregTech by GregTechCE.
the class MetaTileEntityRenderer method renderItem.
@Override
public void renderItem(ItemStack rawStack, TransformType transformType) {
ItemStack stack = ModCompatibility.getRealItemStack(rawStack);
if (!(stack.getItem() instanceof MachineItemBlock)) {
return;
}
MetaTileEntity metaTileEntity = MachineItemBlock.getMetaTileEntity(stack);
if (metaTileEntity == null) {
return;
}
GlStateManager.enableBlend();
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
metaTileEntity.setRenderContextStack(stack);
metaTileEntity.renderMetaTileEntity(renderState, new Matrix4(), new IVertexOperation[0]);
if (metaTileEntity instanceof IFastRenderMetaTileEntity) {
((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4(), 0.0f);
}
metaTileEntity.setRenderContextStack(null);
renderState.draw();
if (metaTileEntity instanceof IRenderMetaTileEntity) {
((IRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityDynamic(0.0, 0.0, 0.0, 0.0f);
}
GlStateManager.disableBlend();
}
Aggregations