Miner Arcana - Astral

Miner Arcana - Astral

737k Downloads

[1.15.2 - 1.2.11] Going astral in a biome with custom grass colors causes crash

TelepathicGrunt opened this issue ยท 3 comments

commented

I was using the latest Astral version with a mod called World Blender which imports other mod's features and structures into its dimension. When i tried going astral in this dimension, I get this crash:

java.lang.IllegalArgumentException: Color parameter outside of expected range: Green
	at java.awt.Color.testColorValueRange(Color.java:310) ~[?:1.8.0_51] {}
	at java.awt.Color.<init>(Color.java:395) ~[?:1.8.0_51] {}
	at java.awt.Color.<init>(Color.java:369) ~[?:1.8.0_51] {}
	at com.alan199921.astral.blocks.BlockRenderHandler.addEtherealTint(BlockRenderHandler.java:75) ~[?:1.2.11] {re:classloading,pl:runtimedistcleaner:A}
	at com.alan199921.astral.blocks.BlockRenderHandler.lambda$registerBiomeBasedBlockColors$0(BlockRenderHandler.java:50) ~[?:1.2.11] {re:classloading,pl:runtimedistcleaner:A}
	at com.alan199921.astral.blocks.BlockRenderHandler$$Lambda$2950/788871227.getColor(Unknown Source) ~[?:?] {}

Full crashlog here: https://hatebin.com/jizvwuarpn

It seem this method is causing the crash when an rgb value goes beyond 255 or below 0 as World Blender has a biome with extremely green grass color. Adding some Math.min and Math.max in to limit the range in rgb should solve this issue.

public static int addEtherealTint(int colorInt) {
Color color = new Color(colorInt);
int adjustedBlue = color.getBlue() + 50;
int adjustedRed = color.getRed() - 10;
int adjustedGreen = color.getGreen() + 40;
return new Color(adjustedRed, adjustedGreen, adjustedBlue).getRGB();
}

commented
commented

I'm planning to replace the current textures with custom textures in the future, without any tinting.

commented

Yep! That resolved the problem!