Java Code Examples for net.minecraft.client.renderer.RenderBlocks#renderStandardBlock()

The following examples show how to use net.minecraft.client.renderer.RenderBlocks#renderStandardBlock() . 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: BlockExtendedNodeJarRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    int bb = setBrightness(world, x, y, z, block);
    int metadata = world.getBlockMetadata(x, y, z);
    block.setBlockBounds(W3, 0.0F, W3, W13, W12, W13);
    renderer.setRenderBoundsFromBlock(block);
    renderer.renderStandardBlock(block, x, y, z);
    block.setBlockBounds(W5, W12, W5, W11, W14, W11);
    renderer.setRenderBoundsFromBlock(block);
    renderer.renderStandardBlock(block, x, y, z);

    renderer.clearOverrideBlockTexture();
    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    renderer.setRenderBoundsFromBlock(block);
    return true;
}
 
Example 2
Source File: BlockTexturedOreRenderer.java    From Chisel with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer)
{
    if(blck == null || !(blck instanceof BlockTexturedOre))
        return false;
    BlockTexturedOre block = (BlockTexturedOre) blck;

    if(block.currentPass == 0)
    {
        if(block.icon != null)
        {
            renderer.overrideBlockTexture = block.icon;
            renderer.renderStandardBlock(block, x, y, z);
            renderer.overrideBlockTexture = null;
        } else if(block.base != null)
        {
            renderer.renderBlockByRenderType(block.base, x, y, z);
        }
    } else
    {
        renderer.setRenderBounds(bot, bot, bot, top, top, top);
        renderer.renderStandardBlock(block, x, y, z);
    }

    return true;
}
 
Example 3
Source File: BlockChorusFlowerRender.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	renderer.renderAllFaces = true;

	renderer.setRenderBounds(2 / 16F, 14 / 16F, 2 / 16F, 14 / 16F, 1, 14 / 16F);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.setRenderBounds(0, 2 / 16F, 2 / 16F, 2 / 16F, 14 / 16F, 14 / 16F);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.setRenderBounds(2 / 16F, 2 / 16F, 0, 14 / 16F, 14 / 16F, 2 / 16F);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.setRenderBounds(2 / 16F, 2 / 16F, 14 / 16F, 14 / 16F, 14 / 16F, 1);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.setRenderBounds(14 / 16F, 2 / 16F, 2 / 16F, 1, 14 / 16F, 14 / 16F);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.setRenderBounds(2 / 16F, 0, 2 / 16F, 14 / 16F, 14 / 16F, 14 / 16F);
	renderer.renderStandardBlock(block, x, y, z);

	renderer.renderAllFaces = false;
	return true;
}
 
Example 4
Source File: RendererSimpleLayered.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	renderer.setOverrideBlockTexture(((BlockCarvableLayered) block).getBaseTex());
	renderer.renderStandardBlock(block, x, y, z);
	renderer.clearOverrideBlockTexture();
	renderer.renderStandardBlock(block, x, y, z);
	return true;
}
 
Example 5
Source File: FlowerLeafRenderer.java    From GardenCollection with MIT License 5 votes vote down vote up
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockFlowerLeaves block, int modelId, RenderBlocks renderer) {
    renderer.renderStandardBlock(block, x, y, z);

    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
    tessellator.setColorOpaque_F(1f, 1f, 1f);

    int meta = world.getBlockMetadata(x, y, z);
    float offset = .03125f;
    IIcon icon = block.getFlowerIcon(world, x, y, z, meta, 1);
    if (icon != null)
        renderer.renderFaceYPos(block, x, y + offset, z, icon);

    icon = block.getFlowerIcon(world, x, y, z, meta, 2);
    if (icon != null)
        renderer.renderFaceZNeg(block, x, y, z - offset, icon);

    icon = block.getFlowerIcon(world, x, y, z, meta, 3);
    if (icon != null)
        renderer.renderFaceZPos(block, x, y, z + offset, icon);

    icon = block.getFlowerIcon(world, x, y, z, meta, 4);
    if (icon != null)
        renderer.renderFaceXNeg(block, x - offset, y, z, icon);

    icon = block.getFlowerIcon(world, x, y, z, meta, 5);
    if (icon != null)
        renderer.renderFaceXPos(block, x + offset, y, z, icon);

    return true;
}
 
Example 6
Source File: BlockPIMRenderer.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, BlockPIM block, int modelId, RenderBlocks renderer) {
	renderer.setRenderBoundsFromBlock(block);
	renderer.renderStandardBlock(block, x, y, z);

	final boolean isBreaking = renderer.hasOverrideBlockTexture();
	if (!isBreaking) renderer.setOverrideBlockTexture(BlockPIM.Icons.black);

	final boolean hasPlayer = hasPlayer(world, x, y, z);
	setTopPartBounds(renderer, hasPlayer);
	renderer.renderStandardBlock(block, x, y, z);

	if (!isBreaking) renderer.clearOverrideBlockTexture();
	return true;
}
 
Example 7
Source File: RendererLayeredGlow.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	Tessellator.instance.setColorOpaque_I(Configurations.configColors[world.getBlockMetadata(x, y, z)]);
	Tessellator.instance.setBrightness(0xF000F0);
	Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableGlow) block).getGlowTexture());
	renderer.renderStandardBlock(block, x, y, z);
	return true;
}
 
Example 8
Source File: RendererGlasBlock.java    From bartworks with MIT License 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    //renderer.setRenderBounds(0.001,0.001,0.001,0.999,0.999,0.999);
    renderer.renderStandardBlock(ItemRegistry.bw_fake_glasses, x, y, z);
    //renderer.setRenderBounds(0,0,0,1,1,1);
    renderer.renderStandardBlockWithColorMultiplier(block, x, y, z, ((BW_GlasBlocks) block).getColor(world.getBlockMetadata(x, y, z))[0] / 255f, ((BW_GlasBlocks) block).getColor(world.getBlockMetadata(x, y, z))[1] / 255f, ((BW_GlasBlocks) block).getColor(world.getBlockMetadata(x, y, z))[2] / 255f);
    return true;
}
 
Example 9
Source File: ChunkLoaderSBRH.java    From ChickenChunks with MIT License 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
    if(block != ChickenChunks.blockChunkLoader)
        return false;
    
    ChickenChunks.blockChunkLoader.setBlockBoundsBasedOnState(world, x, y, z);
    renderer.renderStandardBlock(block, x, y, z);
    return true;
}
 
Example 10
Source File: BlockNoCTMRenderer.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
    int meta = world.getBlockMetadata(x, y, z);

    if(meta != 0) renderer.overrideBlockTexture = block.getIcon(0, meta);
    renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    renderer.renderStandardBlock(block, x, y, z);
    renderer.overrideBlockTexture = null;

    return false;
}
 
Example 11
Source File: BlockSlimeBlockRender.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	renderer.renderStandardBlock(ModBlocks.slime, x, y, z);
	float f = 0.0625F;
	renderer.setRenderBounds(f * 3, f * 3, f * 3, f * 13, f * 13, f * 13);
	renderer.renderAllFaces = true;
	boolean flag = renderer.renderStandardBlock(ModBlocks.slime, x, y, z);
	renderer.renderAllFaces = false;
	return flag;
}
 
Example 12
Source File: BlockAdvancedMarbleRenderer.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld)
{
    int meta = world.getBlockMetadata(x, y, z);

    CarvableVariation var = ((ICarvable) block).getVariation(meta);

    switch(var == null ? 0 : var.kind)
    {
        case CarvableHelper.CTMX:
            rendererCTM.blockAccess = world;
            rendererCTM.renderMaxX = 1.0;
            rendererCTM.renderMaxY = 1.0;
            rendererCTM.renderMaxZ = 1.0;

            rendererCTM.submap = var.submap;
            rendererCTM.submapSmall = var.submapSmall;

            rendererCTM.rendererOld = rendererOld;

            return rendererCTM.renderStandardBlock(block, x, y, z);
        case CarvableHelper.CTMV:
            rendererColumn.blockAccess = world;
            rendererColumn.renderMaxX = 1.0;
            rendererColumn.renderMaxY = 1.0;
            rendererColumn.renderMaxZ = 1.0;

            rendererColumn.submap = var.seamsCtmVert;
            rendererColumn.iconTop = var.iconTop;

            return rendererColumn.renderStandardBlock(block, x, y, z);
        default:
            return rendererOld.renderStandardBlock(block, x, y, z);
    }
}
 
Example 13
Source File: QCraftProxyClient.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public boolean renderWorldBlock( IBlockAccess world, int i, int j, int k, Block block, int modelID, RenderBlocks renderblocks )
{
    if( modelID == QCraft.Blocks.quantumLogic.blockRenderID )
    {
        int metadata = world.getBlockMetadata( i, j, k );
        int direction = BlockDirectional.getDirection( metadata );
        int subType = ( (BlockQuantumLogic) block ).getSubType( metadata );

        // Draw Base
        switch( direction )
        {
            case 0:
                renderblocks.uvRotateTop = 0;
                break;
            case 1:
                renderblocks.uvRotateTop = 1;
                break;
            case 2:
                renderblocks.uvRotateTop = 3;
                break;
            case 3:
                renderblocks.uvRotateTop = 2;
                break;
        }
        renderblocks.setRenderBoundsFromBlock( block );
        renderblocks.renderStandardBlock( block, i, j, k );
        renderblocks.uvRotateTop = 0;

        return true;
    }
    return false;
}
 
Example 14
Source File: BlockRoadLineRenderer.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer)
{
    int meta = world.getBlockMetadata(x, y, z);
    BlockRoadLine block = (BlockRoadLine) b;
    Tessellator tessellator = Tessellator.instance;

    tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

    float f = 1.0F;
    int i1 = block.colorMultiplier(world, x, y, z);
    float f1 = (i1 >> 16 & 255) / 255.0F;
    float f2 = (i1 >> 8 & 255) / 255.0F;
    float f3 = (i1 & 255) / 255.0F;

    if(EntityRenderer.anaglyphEnable)
    {
        float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f4;
        f2 = f5;
        f3 = f6;
    }
    tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);

    boolean N = world.getBlock(x, y, z - 1).equals(block);
    boolean S = world.getBlock(x, y, z + 1).equals(block);
    boolean W = world.getBlock(x - 1, y, z).equals(block);
    boolean E = world.getBlock(x + 1, y, z).equals(block);

    if(!N && !S && !W && !E)
    {
        renderer.renderStandardBlock(block, x, y, z);
        return true;
    }

    if(N && S)
    {
        renderer.uvRotateTop = 0;
        renderer.overrideBlockTexture = block.fullLineIcon;
        renderer.renderStandardBlock(block, x, y, z);

    } else
    {
        if(N)
        {
            renderer.uvRotateTop = 0;
            renderer.overrideBlockTexture = block.halfLineIcon;
            renderer.renderStandardBlock(block, x, y, z);
        }
        if(S)
        {
            renderer.uvRotateTop = 3;
            renderer.overrideBlockTexture = block.halfLineIcon;
            renderer.renderStandardBlock(block, x, y, z);
        }

    }

    if(E && W)
    {
        renderer.uvRotateTop = 1;
        renderer.overrideBlockTexture = block.fullLineIcon;
        renderer.renderStandardBlock(block, x, y, z);
    } else
    {
        if(E)
        {
            renderer.uvRotateTop = 1;
            renderer.overrideBlockTexture = block.halfLineIcon;
            renderer.renderStandardBlock(block, x, y, z);
        }
        if(W)
        {
            renderer.uvRotateTop = 2;
            renderer.overrideBlockTexture = block.halfLineIcon;
            renderer.renderStandardBlock(block, x, y, z);
        }
    }

    renderer.uvRotateTop = 0;
    renderer.overrideBlockTexture = null;
    return true;
}
 
Example 15
Source File: BlockChorusPlantRender.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	renderer.renderAllFaces = true;

	long seed = x * 3129871L ^ y * 116129781L ^ z;
	seed = seed * seed * 42317861L + seed * 11L;
	rand.setSeed(seed);

	int noConUp = rand.nextInt(5);
	int noConDown = rand.nextInt(5);
	int noConWest = rand.nextInt(5);
	int noConEast = rand.nextInt(5);
	int noConNorth = rand.nextInt(5);
	int noConSouth = rand.nextInt(5);

	Block neighbourUp = world.getBlock(x + ForgeDirection.UP.offsetX, y + ForgeDirection.UP.offsetY, z + ForgeDirection.UP.offsetZ);
	Block neighbourDown = world.getBlock(x + ForgeDirection.DOWN.offsetX, y + ForgeDirection.DOWN.offsetY, z + ForgeDirection.DOWN.offsetZ);
	Block neighbourWest = world.getBlock(x + ForgeDirection.WEST.offsetX, y + ForgeDirection.WEST.offsetY, z + ForgeDirection.WEST.offsetZ);
	Block neighbourEast = world.getBlock(x + ForgeDirection.EAST.offsetX, y + ForgeDirection.EAST.offsetY, z + ForgeDirection.EAST.offsetZ);
	Block neighbourNorth = world.getBlock(x + ForgeDirection.NORTH.offsetX, y + ForgeDirection.NORTH.offsetY, z + ForgeDirection.NORTH.offsetZ);
	Block neighbourSouth = world.getBlock(x + ForgeDirection.SOUTH.offsetX, y + ForgeDirection.SOUTH.offsetY, z + ForgeDirection.SOUTH.offsetZ);
	float conWidth = 4 / 16F;

	if (neighbourUp == ModBlocks.chorus_flower || neighbourUp == Blocks.end_stone || neighbourUp == block) {
		renderer.setRenderBounds(conWidth, 1 - conWidth, conWidth, 1 - conWidth, 1, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConUp == 2 || noConUp == 3) {
		renderer.setRenderBounds(conWidth, 1 - conWidth, conWidth, 1 - conWidth, 13 / 16F, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConUp == 4) {
		renderer.setRenderBounds(5 / 16F, 1 - conWidth, 5 / 16F, 11 / 16F, 1 - 2 / 16F, 11 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	}

	if (neighbourDown == ModBlocks.chorus_flower || neighbourDown == Blocks.end_stone || neighbourDown == block) {
		renderer.setRenderBounds(conWidth, 0, conWidth, 1 - conWidth, conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConDown == 2 || noConDown == 3) {
		renderer.setRenderBounds(conWidth, 3 / 16F, conWidth, 1 - conWidth, conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConDown == 4) {
		renderer.setRenderBounds(5 / 16F, 2 / 16F, 5 / 16F, 11 / 16F, conWidth, 11 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	}

	if (neighbourWest == ModBlocks.chorus_flower || neighbourWest == Blocks.end_stone || neighbourWest == block) {
		renderer.setRenderBounds(0, conWidth, conWidth, conWidth, 1 - conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConWest == 2 || noConWest == 3) {
		renderer.setRenderBounds(3 / 16F, conWidth, conWidth, conWidth, 1 - conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConWest == 4) {
		renderer.setRenderBounds(2 / 16F, 5 / 16F, 5 / 16F, conWidth, 11 / 16F, 11 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	}

	if (neighbourEast == ModBlocks.chorus_flower || neighbourEast == Blocks.end_stone || neighbourEast == block) {
		renderer.setRenderBounds(1 - conWidth, conWidth, conWidth, 1, 1 - conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConEast == 2 || noConEast == 3) {
		renderer.setRenderBounds(1 - conWidth, conWidth, conWidth, 13 / 16F, 1 - conWidth, 1 - conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConEast == 4) {
		renderer.setRenderBounds(1 - conWidth, 5 / 16F, 5 / 16F, 1 - 2 / 16F, 11 / 16F, 11 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	}

	if (neighbourNorth == ModBlocks.chorus_flower || neighbourNorth == Blocks.end_stone || neighbourNorth == block) {
		renderer.setRenderBounds(conWidth, conWidth, 0, 1 - conWidth, 1 - conWidth, conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConNorth == 2 || noConNorth == 3) {
		renderer.setRenderBounds(conWidth, conWidth, 3 / 16F, 1 - conWidth, 1 - conWidth, conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConNorth == 4) {
		renderer.setRenderBounds(5 / 16F, 5 / 16F, 2 / 16F, 11 / 16F, 11 / 16F, conWidth);
		renderer.renderStandardBlock(block, x, y, z);
	}

	if (neighbourSouth == ModBlocks.chorus_flower || neighbourSouth == Blocks.end_stone || neighbourSouth == block) {
		renderer.setRenderBounds(conWidth, conWidth, 1 - conWidth, 1 - conWidth, 1 - conWidth, 1);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConSouth == 2 || noConSouth == 3) {
		renderer.setRenderBounds(conWidth, conWidth, 1 - conWidth, 1 - conWidth, 1 - conWidth, 13 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	} else if (noConSouth == 4) {
		renderer.setRenderBounds(5 / 16F, 5 / 16F, 1 - conWidth, 11 / 16F, 11 / 16F, 1 - 2 / 16F);
		renderer.renderStandardBlock(block, x, y, z);
	}

	renderer.setRenderBounds(conWidth, conWidth, conWidth, 1 - conWidth, 1 - conWidth, 1 - conWidth);
	renderer.renderStandardBlock(block, x, y, z);

	return true;
}
 
Example 16
Source File: RendererRoadLine.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
	int meta = world.getBlockMetadata(x, y, z);
	BlockRoadLine block = (BlockRoadLine) b;
	Tessellator tessellator = Tessellator.instance;

	tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

	float f = 1.0F;
	int i1 = block.colorMultiplier(world, x, y, z);
	float f1 = (i1 >> 16 & 255) / 255.0F;
	float f2 = (i1 >> 8 & 255) / 255.0F;
	float f3 = (i1 & 255) / 255.0F;

	if (EntityRenderer.anaglyphEnable) {
		float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
		float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
		float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
		f1 = f4;
		f2 = f5;
		f3 = f6;
	}
	tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);

	boolean N = world.getBlock(x, y, z - 1).equals(block) && world.getBlockMetadata(x, y, z - 1) == meta;
	boolean S = world.getBlock(x, y, z + 1).equals(block) && world.getBlockMetadata(x, y, z + 1) == meta;
	boolean W = world.getBlock(x - 1, y, z).equals(block) && world.getBlockMetadata(x - 1, y, z) == meta;
	boolean E = world.getBlock(x + 1, y, z).equals(block) && world.getBlockMetadata(x + 1, y, z) == meta;

	if (!N && !S && !W && !E) {
		renderer.renderStandardBlock(block, x, y, z);
		return true;
	}

	if (N && S) {
		renderer.uvRotateTop = 0;
		renderer.overrideBlockTexture = block.fullLineIcon[meta];
		renderer.renderStandardBlock(block, x, y, z);

	} else {
		if (N) {
			renderer.uvRotateTop = 0;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
		if (S) {
			renderer.uvRotateTop = 3;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}

	}

	if (E && W) {
		renderer.uvRotateTop = 1;
		renderer.overrideBlockTexture = block.fullLineIcon[meta];
		renderer.renderStandardBlock(block, x, y, z);
	} else {
		if (E) {
			renderer.uvRotateTop = 1;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
		if (W) {
			renderer.uvRotateTop = 2;
			renderer.overrideBlockTexture = block.halfLineIcon[meta];
			renderer.renderStandardBlock(block, x, y, z);
		}
	}

	renderer.uvRotateTop = 0;
	renderer.overrideBlockTexture = null;
	return true;
}
 
Example 17
Source File: ThinLogRenderer.java    From GardenCollection with MIT License 4 votes vote down vote up
private boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, BlockThinLog block, int modelId, RenderBlocks renderer) {
        float margin = block.getMargin();
        int connectFlags = block.calcConnectionFlags(world, x, y, z);

        boolean connectYNeg = (connectFlags & 1) != 0;
        boolean connectYPos = (connectFlags & 2) != 0;
        boolean connectZNeg = (connectFlags & 4) != 0;
        boolean connectZPos = (connectFlags & 8) != 0;
        boolean connectXNeg = (connectFlags & 16) != 0;
        boolean connectXPos = (connectFlags & 32) != 0;

        boolean connectY = connectYNeg | connectYPos;
        boolean connectZ = connectZNeg | connectZPos;
        boolean connectX = connectXNeg | connectXPos;

        if (!(connectYNeg && connectYPos) && !(connectZNeg && connectZPos) && !(connectXNeg && connectXPos)) {
            if (connectY && !connectX && !connectZ)
                block.setOrientation(0);
            else if (connectZ && !connectY && !connectX)
                block.setOrientation(1);
            else if (connectX && !connectY && !connectZ)
                block.setOrientation(2);
            else
                block.setOrientation(3);

            renderer.setRenderBounds(margin, margin, margin, 1 - margin, 1 - margin, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectY) {
            block.setOrientation(0);
            if (connectYNeg && connectYPos)
                renderer.setRenderBounds(margin, 0, margin, 1 - margin, 1, 1 - margin);
            else if (connectYNeg)
                renderer.setRenderBounds(margin, 0, margin, 1 - margin, margin, 1 - margin);
            else if (connectYPos)
                renderer.setRenderBounds(margin, 1 - margin, margin, 1 - margin, 1, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectZ) {
            block.setOrientation(1);
            if (connectZNeg && connectZPos)
                renderer.setRenderBounds(margin, margin, 0, 1 - margin, 1 - margin, 1);
            else if (connectZNeg)
                renderer.setRenderBounds(margin, margin, 0, 1 - margin, 1 - margin, margin);
            else if (connectZPos)
                renderer.setRenderBounds(margin, margin, 1 - margin, 1 - margin, 1 - margin, 1);
            renderer.renderStandardBlock(block, x, y, z);
        }

        if (connectX) {
            block.setOrientation(2);
            if (connectXNeg && connectXPos)
                renderer.setRenderBounds(0, margin, margin, 1, 1 - margin, 1 - margin);
            else if (connectXNeg)
                renderer.setRenderBounds(0, margin, margin, margin, 1 - margin, 1 - margin);
            else if (connectXPos)
                renderer.setRenderBounds(1 - margin, margin, margin, 1, 1 - margin, 1 - margin);
            renderer.renderStandardBlock(block, x, y, z);
        }

        block.setOrientation(0);

        //renderer.renderStandardBlock(block, x, y, z);

        Block blockUnder = world.getBlock(x, y - 1, z);
        if (blockUnder instanceof BlockGarden) {
            float yDiff = ((BlockGarden) blockUnder).getSlotProfile().getPlantOffsetY(world, x, y, z, 0);
            if (yDiff >= (1 - .0625f) * 2) {
                //Tessellator tessellator = Tessellator.instance;
                //tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
                //tessellator.setColorOpaque_F(1f, 1f, 1f);

//            block.setBlockBounds(margin, -.0625f, margin, 1 - margin, 0, 1 - margin);
                renderer.setRenderBounds(margin, yDiff, margin, 1 - margin, 1, 1 - margin);
                renderer.renderStandardBlock(block, x, y - 1, z);

                //IIcon sideIcon = block.getIcon(2, world.getBlockMetadata(x, y, z));
                //renderer.renderFaceXNeg(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceXPos(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceZNeg(block, x, y - 1, z, sideIcon);
                //renderer.renderFaceZPos(block, x, y - 1, z, sideIcon);
//            block.setBlockBoundsForItemRender();
                renderer.setRenderBoundsFromBlock(block);
            }
        }

        return true;
    }
 
Example 18
Source File: BlockSpikesRenderer.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
    {
        int meta = world.getBlockMetadata(x, y, z);

        renderer.renderStandardBlock(block, x, y, z);

        Tessellator tessellator = Tessellator.instance;
        IIcon icon = ChiselBlocks.blockSpiketrap.iconSpike;
//		Icon icon=Chisel.blockSpiketrap.iconBase;

        double h = 0.85;
        double d = 1.5 / 16;
        double r = d / 2;


        double tx = x + 0.25;
        double ty = y + h;
        double tz = z + 0.25;
        double skew = 0.5;

        //       tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
        tessellator.addTranslation(0, 1.0f / 16, 0);

        Random rand = new Random();
        for(int xx = 0; xx < 4; xx++)
        {
            for(int yy = 0; yy < 4; yy++)
            {
//				float sx=1.0f/16+rand.nextFloat()*13.0f/16;
//				float sz=1.0f/16+rand.nextFloat()*13.0f/16;
                float sx = (2.0f + (12.0f - (float) d) * xx / 3) / 16;
                float sz = (2.0f + (12.0f - (float) d) * yy / 3) / 16;


                tessellator.addTranslation(sx, 0, sz);
                drawSpike(icon, r, 0.5 + rand.nextDouble() * 0.35, x, y, z, rand.nextDouble() * skew - skew / 2, rand.nextDouble() * skew - skew / 2);
                tessellator.addTranslation(-sx, 0, -sz);
            }
        }

        tessellator.addTranslation(0, -1.0f / 16, 0);


        return true;
    }
 
Example 19
Source File: VanillaLanternSource.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void render (RenderBlocks renderer, int x, int y, int z, int meta, int pass) {
    renderer.setRenderBounds(.3, 0, .3, .7, .4, .7);
    renderer.renderStandardBlock(Blocks.glowstone, x, y, z);
}
 
Example 20
Source File: RenderHelperMonitorStorageFluid.java    From ExtraCells1 with MIT License 4 votes vote down vote up
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
	Tessellator ts = Tessellator.instance;
	ts.setColorOpaque_I(0xFFFFFF);
	ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	renderer.renderStandardBlock(block, x, y, z);
	BlockMonitorStorageFluid monitorBlock = (BlockMonitorStorageFluid) block;
	int[] color =
	{ 0, 0, 0 };
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityMonitorStorageFluid)
	{
		TileEntityMonitorStorageFluid monitorTE = (TileEntityMonitorStorageFluid) blockTE;
		switch (monitorTE.getColor())
		{
		case -1:
			color = fluix.clone();
			break;
		case 0:
			color = blue.clone();
			break;
		case 1:
			color = black.clone();
			break;
		case 2:
			color = white.clone();
			break;
		case 3:
			color = brown.clone();
			break;
		case 4:
			color = red.clone();
			break;
		case 5:
			color = yellow.clone();
			break;
		case 6:
			color = green.clone();
			break;
		}

		boolean active = monitorTE.isMachineActive();
		ts.setBrightness(15 << 2 | 15 << 0);
		if (active)
			ts.setBrightness(15 << 20 | 15 << 4);

		for (int i = 0; i < 3; i++)
		{
			ts.setColorOpaque_I(color[i]);
			drawFace(face, block, x, y, z, monitorBlock.colorLayers[i], renderer);
		}
	}
	return true;
}