Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 :)

worst case you can just make an animation that rotates it.

The Korecraft Mod

  • Author

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 :-/

  • Author

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

}

 

 

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);

}

 

 

  • Author

thx that helps alot :) i know my way around code just didn't find any good exemples this is just right :)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.