Add support for Blocks that use a color multiplier for rendering
nulano opened this issue ยท 4 comments
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.
@nulano - Could you look at this implementation?
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:
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.
@nulano - Slow, slow... I'm working on all of this.