Posted December 19, 20222 yr Is there a way to change the color of an entity like with the Item and block color handler events?
December 22, 20222 yr Change the entity texture. You could attempt to change it using RenderSystem#setShaderColor, though you will have to be careful and make sure you set and then unset it after rendering for the specific entity is done in the RenderLivingEvent$Pre and $Post.
December 30, 20222 yr Author That would be relatively simple, but there is a little twist. 1. It is a projectile, not a living entity. 2. The projectile holds any one of several custom fluids, the color of which is impossible to determine until runtime. Being a projectile that is removed from the game within a few ticks of impact, I don't have to be concerned with unsetting the color change. I do have a minimal custom renderer that extends ArrowRenderer. Perhaps I could override the render method in EntityRenderer. One concern is that, due to the singleton nature of items, blocks, entities, it may cause every one of these currently in the game to be tinted the same way. It would seem to be a bit of overkill to make a custom capability just for this minor effect. But, if that is what it takes, I'm up for it. Reality check: am I even approaching it correctly?
January 1, 20232 yr On 12/30/2022 at 2:29 PM, DirtEngineer said: It is a projectile, not a living entity. Why would this matter? Textures get applied the same way, same as the color. On 12/30/2022 at 2:29 PM, DirtEngineer said: The projectile holds any one of several custom fluids, the color of which is impossible to determine until runtime. Ok? So you can pass the color into the texture shader and tint it instead. On 12/30/2022 at 2:29 PM, DirtEngineer said: I do have a minimal custom renderer that extends ArrowRenderer. Perhaps I could override the render method in EntityRenderer. One concern is that, due to the singleton nature of items, blocks, entities, it may cause every one of these currently in the game to be tinted the same way. It would seem to be a bit of overkill to make a custom capability just for this minor effect. But, if that is what it takes, I'm up for it. This is not going to do that? The only way that would happen is if you're replacing every single render call to have your color tinting it, which since you have control over what you render, is completely unnecessary.
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.