Fix erratic colorization of bursts and flashes

closes #198
This commit is contained in:
yrsegal committed 2016-04-03 21:38:42 -04:00
1 parent af19c7cece
commit 7536ebe4c6
2 files changed
+19 -7

No files matched your search

@@ -37,9 +37,17 @@ public class TileManaFlame extends TileMod {
if(worldObj.isRemote && Math.random() < c) {
float v = 0.1F;
float r = (float) (color >> 16 & 0xFF) / 0xFF + (float) (Math.random() - 0.5) * v;
float g = (float) (color >> 8 & 0xFF) / 0xFF + (float) (Math.random() - 0.5) * v;
float b = (float) (color & 0xFF) / 0xFF + (float) (Math.random() - 0.5) * v;
float r = (float) (color >> 16 & 0xFF) / 0xFF;
float g = (float) (color >> 8 & 0xFF) / 0xFF;
float b = (float) (color & 0xFF) / 0xFF;
double luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b; // Standard relative luminance calculation
if (luminance < v) {
r += (float) (Math.random() - 0.5) * 0.25;
g += (float) (Math.random() - 0.5) * 0.25;
b += (float) (Math.random() - 0.5) * 0.25;
}
float w = 0.15F;
float h = 0.05F;
@@ -545,6 +545,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
float og = g;
float ob = b;
double luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b; // Standard relative luminance calculation
double savedPosX = posX;
double savedPosY = posY;
double savedPosZ = posZ;
@@ -557,9 +559,11 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
double distance = 0.095;
do {
r = or + ((float) Math.random() - 0.5F) * 0.25F;
g = og + ((float) Math.random() - 0.5F) * 0.25F;
b = ob + ((float) Math.random() - 0.5F) * 0.25F;
if (luminance < 0.1) {
r = or + ((float) Math.random() - 0.5F) * 0.25F;
g = og + ((float) Math.random() - 0.5F) * 0.25F;
b = ob + ((float) Math.random() - 0.5F) * 0.25F;
}
size = osize + ((float) Math.random() - 0.5F) * 0.065F + (float) Math.sin(new Random(entityUniqueID.getMostSignificantBits()).nextInt(9001)) * 0.4F;
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F);
@@ -573,7 +577,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
break;
} while(Math.abs(diffVec.mag()) > distance);
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
Botania.proxy.wispFX(worldObj, posX, posY, posZ, or, og, ob, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
posX = savedPosX;
posY = savedPosY;