BuildCraft|Core

BuildCraft|Core

7M Downloads

Add support for Blocks that use a color multiplier for rendering

nulano opened this issue ยท 4 comments

commented

Both FacadeItemRenderer and FacadeRenderHelper (used by PipeWorldRenderer) ask for the color multiplier, but incorrectly.

FacadeRenderHelper stores the color multiplier in BlockGenericPipe.facadeRenderColor, which is not accessed during facade rendering, and then is replaced by -1 (no color - white). Instead, it should be stored in blockStateMachine.
There is no simple workaround for this.

FacadeItemRenderer uses this to get the color multiplier:
item.getItem().getColorFromItemStack(new ItemStack(block, 1, decodedMeta), 0);
The problem is, that item is always BuildcraftTransport.facadeItem, and that doesn't override getColorFromItemStack. Instead, it inherits it from Item, and that returns white no matter what. This could be solved by either asking Item.getItemFromBlock(block) for the color multiplier instead, or overriding getColorFromItemStack in ItemFacade to return the color returned by p_82790_1_.getColorFromItemStack.
A possible workaround would be making a custom version of ItemFacade.

commented

In the Item Renderer, before rendering the structure pipe, the color should be changed back to white, so that the "gravel" in the structure pipe doesn't render with this multiplier (in my case brown or red).

RenderUtils.setGLColorFromInt(0xFFFFFF);

Screenshot

commented

@nulano - Could you look at this implementation?

commented

Since I need this feature for my mod, that I would like to play with right now (It's almost in a playable state - I just need to fix the creative inventory and maybe in the future add more features, that I don' need right now), I made copies of these two renderers and implemented this feature in there. Then I placed them earlier in the classpath than BC. All I had to change was 4 lines of code. Here are the files:

https://bitbucket.org/nulano/mc-extratreesfacades/src/3e74ae4f5b1ee8a43e9fa229376d80af457201e5/src/buildcraft/transport/render/?at=master

Here's another suggestion: How about a completely custom facade renderer? (Maybe interface IFacadeRenderer with two methods: renderFacadeBlock and renderFacadeItem. Then there would be a default implementation that contains current facade render code.

commented

@nulano - Slow, slow... I'm working on all of this.