Jump to content

[1.4.6] Custom Rendering in Inventory


FreshDumb

Recommended Posts

Hi,

 

I made a custom renderer for one block and just can't figure out how to render it in 3d in my inventory...

 

 

public void renderInventoryBlock(Block block, int metadata, int modelID,

RenderBlocks renderer) {

 

}

 

 

 

what do i put in there??

Thanks :)

Link to comment
Share on other sites

RenderInventoryBlock, in the ISimpleBlockRenderingHandler...

 

yeah i know i goes in there but i cant figure out how... because where do i get my x y z then?

this is my code for the custom rendering:

 

 

 

        float var1 = 0.7F;

        float var2 = var1 / 2.0F;

        renderer.setCustomBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 0.5F, 0.5F + var2);

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

       

        renderer.setCustomBlockBounds(0.1F, 0.5F, 0.1F, 0.9F, 0.8F, 0.9F);

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

       

        renderer.overrideBlockTexture = 0;

        renderer.setCustomBlockBounds(0.5F - var2 + 0.08F, 0.8F, 0.5F - var2 + 0.08F, 0.5F + var2 - 0.08F, 0.85F, 0.5F + var2 - 0.08F);

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

       

        renderer.setCustomBlockBounds(0.5F - var2 + 0.1F, 0.85F, 0.5F - var2 + 0.1F, 0.5F + var2 - 0.1F, 0.9F, 0.5F + var2 - 0.1F);

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

       

        renderer.setCustomBlockBounds(0.5F - var2 + 0.14F, 0.9F, 0.5F - var2 + 0.14F, 0.5F + var2 - 0.14F, 0.95F, 0.5F + var2 - 0.14F);

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

       

        renderer.setCustomBlockBounds(0.5F - var2 + 0.2F, 0.95F, 0.5F - var2 + 0.2F, 0.5F + var2 - 0.2F, 1.0F, 0.5F + var2 - 0.2F);

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

       

        renderer.setCustomBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);

        renderer.setOverrideBlockTexture(-1);

        renderer.resetCustomBlockBounds();

 

 

        return true;

 

 

 

now how can i put that into renderinventoryblock? I dont get it :-/

Link to comment
Share on other sites

RenderingRegistry.registerBlockHandler(new MYBLOCKRENDERINGHANDLER()); //in the client proxy

 

yeah i have all of that :D

and my custm model works when i place it... just in my inventory its the flat texture

 

what do i need in the method below

 

 

@Override

public void renderInventoryBlock(Block block, int metadata, int modelID,

RenderBlocks renderer) {

// TODO

}

 

 

Link to comment
Share on other sites

thats what i use for my block

 

 

public void renderInventoryBlock(Block block, int metadata, int modelID,

        RenderBlocks renderblocks) {

 

Tessellator tessellator = Tessellator.instance;

 

if(modelID == yourblockrendertype)

{

block.setBlockBoundsForItemRender();

GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

float f2 = 0.0625F;

tessellator.startDrawingQuads();

tessellator.setNormal(0.0F, -1F, 0.0F);

renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(0));

tessellator.draw();

tessellator.startDrawingQuads();

tessellator.setNormal(0.0F, 1.0F, 0.0F);

renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(1));

tessellator.draw();

tessellator.startDrawingQuads();

tessellator.setNormal(0.0F, 0.0F, -1F);

tessellator.setTranslationF(0.0F, 0.0F, f2);

renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(2));

tessellator.setTranslationF(0.0F, 0.0F, -f2);

tessellator.draw();

tessellator.startDrawingQuads();

tessellator.setNormal(0.0F, 0.0F, 1.0F);

tessellator.setTranslationF(0.0F, 0.0F, -f2);

renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(3));

tessellator.setTranslationF(0.0F, 0.0F, f2);

tessellator.draw();

tessellator.startDrawingQuads();

tessellator.setNormal(-1F, 0.0F, 0.0F);

tessellator.setTranslationF(f2, 0.0F, 0.0F);

renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(4));

tessellator.setTranslationF(-f2, 0.0F, 0.0F);

tessellator.draw();

tessellator.startDrawingQuads();

tessellator.setNormal(1.0F, 0.0F, 0.0F);

tessellator.setTranslationF(-f2, 0.0F, 0.0F);

renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(5));

tessellator.setTranslationF(f2, 0.0F, 0.0F);

tessellator.draw();

GL11.glTranslatef(0.5F, 0.5F, 0.5F);

}

 

super.RenderInventoryBlock(renderblocks, block, metadata, modelID);

}

 

 

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.