MrCrayfishGunMod
MrCrayfishGunMod copied to clipboard
[Bug or Feature?] Color difference between workbench preview window and real model, and suggestion on color rendering
Descripe Your Problem:
I like crafting guns with different colors, since it looks cool. However, I found that there's color difference between workbench preview window and real model. I have read your code, and it seems that you modify the alpha value for the real model, but not for the preview window. This make a few of the color renderings excellent, but more color renderings dull. (See Evidence)
Could you please fix this bug to meet "what you see is what you get" demand?
Note: I have installed TFC: TNG and a curseforge datapack (modified by myself), so the recipe is different from original mod.
Evidence:
Black (With no difference)
Blue (So light that hurt eyes)
Brown
Cyan (Real-model rendering that I like best)
Gray
Green (Why does a dark-green gun in preview window become light green? I can't stand it)
Light Blue (The color of real model seems faded. Where is the color?)
Gray
Light Green (That's good)
Magenta
Orange
Pink (Also good)
Purple (So light that hurt eyes)
Red (I need a dart-red gun, not a light-red gun)
White (With no difference)
Yellow
Summary
Probably something to do with lighting. If you have used MrCrayFish's Vehicle Mod, the car looks weird when put on the jack, due to lighting stuff. So the model and texture are still correct.
Probably something to do with lighting. If you have used MrCrayFish's Vehicle Mod, the car looks weird when put on the jack, due to lighting stuff. So the model and texture are still correct.
After checking the code concerning with rendering in CGM workbench and dyeing, I'm sure that this is not a feature, but a bug. In the "WorkbenchScreen.java", it wrote,
private void updateColor()
{
if(this.currentTab != null)
{
ItemStack item = this.displayStack;
if(IColored.isDyeable(item))
{
IColored colored = (IColored) item.getItem();
if(!this.workbench.getItem(0).isEmpty())
{
ItemStack dyeStack = this.workbench.getItem(0);
if(dyeStack.getItem() instanceof DyeItem)
{
DyeColor color = ((DyeItem) dyeStack.getItem()).getDyeColor();
float[] components = color.getTextureDiffuseColors();
int red = (int) (components[0] * 255F);
int green = (int) (components[1] * 255F);
int blue = (int) (components[2] * 255F);
colored.setColor(item, ((red & 0xFF) << 16) | ((green & 0xFF) << 8) | ((blue & 0xFF)));
}
else
{
colored.removeColor(item);
}
}
else
{
colored.removeColor(item);
}
}
}
}
Therefore, in the CGM workbench, the initial color of guns and accessories are replaced with the dye color, consistant with my thought. However, when the guns (or accessories) are crafted, their colors are changed, meaning that in the crafting procedure, the color is not replaced, but fused with original color! (Or overflow result? Since fusion result of 0xF9FFFE and dye color doesn't match the final gun color.)
I doubt that there may be connection between this bug and IColored.java (or other dyeing function). @MrCrayfish, could you please help me check out the color before and after the guns crafted?