Jump to content

render block/item on side another block.


Kwasti

Recommended Posts

I created new block with renderer.

This block will get another block or an item, eq  the item frame. (click right button of mouse)

 

How i can to draw icon block/item on the  sides my block ?

public class TestBlockRenderer implements ISimpleBlockRenderingHandler {

....
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
		Block block, int modelId, RenderBlocks renderer) {
	// TODO Auto-generated method stub

        if(ClientProxy.renderPass == 0)
        {

        	drawMytestBlock(world, Blocks.diamond_block,x,y,z);   
        	
        }
        return false;
}

public void drawMytestBlock(IBlockAccess world, Block par1Block,int x,int y, int z)
{
	        Tessellator tessellator = Tessellator.instance;
	        IIcon iicon = Blocks.diamond_block.getBlockTextureFromSide(0);

	        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
	        double d0 = (double)iicon.getMinU();
	        double d1 = (double)iicon.getMinV();
	        double d2 = (double)iicon.getMaxU();
	        double d3 = (double)iicon.getMaxV();
	        double d4 = 0.0D;
	        double d5 = 0.05000000074505806D;
	        double offs=0.5-d5/2;
	        double dt=0.2D;
	        l= world.getBlockMetadata(x, y, z);
	        if (l == 5)
	        {
	            tessellator.addVertexWithUV((double)x + offs + d5, (double)(y + 1) + d4, (double)(z + 1) + d4, d0, d1);
	            tessellator.addVertexWithUV((double)x + offs+ d5, (double)(y + 0) - d4, (double)(z + 1) + d4, d0, d3);
	            tessellator.addVertexWithUV((double)x + offs + d5, (double)(y + 0) - d4, (double)(z + 0) - d4, d2, d3);
	            tessellator.addVertexWithUV((double)x + offs + d5, (double)(y + 1) + d4, (double)(z + 0) - d4, d2, d1);
                            ...
                         }
                         ....
}

 

what i need add in my code?

 

read tutorial from  this

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.