MineMaarten / AdvancedMod

A repository that holds the Advanced Mod. This is a tutorial mod which progresses further than the basic modding tutorials out there. You can follow the series here: https://www.youtube.com/playlist?list=PL5oCR-MRH-12rXI0USklAz6rQagXr4nl5
GNU General Public License v3.0
23 stars 8 forks source link

[Suggestion] Overlay Rendering #7

Closed TheJulianJES closed 9 years ago

TheJulianJES commented 9 years ago

This is a suggestion, maybe do a tutorial on overlay rendering. I know this for items, but not for blocks. If this is in PneumaticCraft, can you please send me a link to where is it. Thank's! Also sorry for my bad English, I'm German :)

MineMaarten commented 9 years ago

Hmm it's interesting. I haven't got any overlay rendering for blocks in PneumaticCraft. However, it's pretty similar to how item overlays are done. Simply return a different icon for a different render pass in the Block#getIcon. The same can be done for Block#colorMultiplier. The only problem with this is that the render pass isn't accessible in these methods. A solution for this is:

private static int renderPass;

public boolean canRenderInPass(int pass){
    renderPass = pass;
    return true;
}

With this you also have enabled the block to be rendered in two passes. Let me know if that helped you, else I might look at doing a tut on it.

TheJulianJES commented 9 years ago

Okay, it work's, I had to add:

    @Override
    public int getRenderBlockPass() {
        return 1;
    }

But it's not rendering in the inventory :C

TheJulianJES commented 9 years ago

Okay, I did an IItemRenderer and now it's work's! Thank you!

MineMaarten commented 9 years ago

Ah, yeah, that makes sense. If you look at the 'call hierarchy' of the canRenderInPass() you'll see it's only called in the block in world rendering.

As a solution I would have recommended to use IItemRenderer, which is exactly what you did, so good job :)