Java Code Examples for codechicken.lib.texture.TextureUtils#getBlockTexture()

The following examples show how to use codechicken.lib.texture.TextureUtils#getBlockTexture() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StoneRenderer.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: MetaTileEntityPrimitiveBlastFurnace.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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.getFrontOffsetX(), -0.3, back.getFrontOffsetZ());
        TextureAtlasSprite sprite = TextureUtils.getBlockTexture("lava_still");
        renderState.brightness = 0xF000F0;
        renderState.colour = 0xFFFFFFFF;
        Textures.renderFace(renderState, offset, new IVertexOperation[0], EnumFacing.UP, Cuboid6.full, sprite);
    }
}
 
Example 3
Source File: InvPipeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Pair<TextureAtlasSprite, Integer> getParticleTexture(IPipeTile<InventoryPipeType, EmptyNodeData> tileEntity) {
    if (tileEntity == null) {
        return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF);
    }
    TextureAtlasSprite atlasSprite = TextureUtils.getBlockTexture("stone");
    int particleColor = tileEntity.getInsulationColor();
    return Pair.of(atlasSprite, particleColor);
}
 
Example 4
Source File: TileEntityCrusherBladeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void draw(TileEntityCrusherBlade tileEntity, CCRenderState renderState, Matrix4 translation, float partialTicks) {
    translation.translate(0.5, 0.5, 0.5);

    IBlockState blockState = tileEntity.getBlockState();
    switch (blockState.getValue(BlockCrusherBlade.AXIS)) {
        case Y:
            break;
        case X:
            translation.rotate(Math.toRadians(90.0), Rotation.axes[3]);
            break;
        case Z:
            translation.rotate(Math.toRadians(90.0), Rotation.axes[5]);
            break;
    }

    if (blockState.getValue(BlockCrusherBlade.ACTIVE)) {
        long currentWorldTime = tileEntity.hasWorld() ? tileEntity.getWorld().getTotalWorldTime() : 0;
        translation.rotate(Math.toRadians(currentWorldTime * 12.0 % 180), Rotation.axes[1]);
    }

    translation.translate(-0.5, -0.5, -0.5);

    TextureAtlasSprite ironBlockTexture = TextureUtils.getBlockTexture("iron_block");
    IVertexOperation[] operations = {};

    for (Cuboid6 cuboid6 : BlockCrusherBlade.basicModel) {
        for (EnumFacing renderSide : EnumFacing.VALUES) {
            Textures.renderFace(renderState, translation, operations, renderSide, cuboid6, ironBlockTexture);
        }
    }
}
 
Example 5
Source File: BakedModelHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TextureAtlasSprite getParticleTexture() {
    return TextureUtils.getBlockTexture(particleTexture);
}