public void onSetupFog(EntityViewRenderEvent.FogDensity event)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player != null && Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName()) != null)
{
MorphInfo info = Morph.proxy.tickHandlerClient.playerMorphInfo.get(player.getCommandSenderName());
if(!info.getMorphing() && info.morphProgress >= 80 || info.getMorphing() && info.morphProgress <= 80)
{
for(Ability ab: info.morphAbilities)
{
if(ab.getType().equalsIgnoreCase("swim"))
{
AbilitySwim abilitySwim = (AbilitySwim)ab;
if(!abilitySwim.canSurviveOutOfWater)
{
GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
if(player.isInWater())
{
event.density = 0.025F;
boolean hasSwim = false;
ArrayList<Ability> mobAbilities = AbilityHandler.getEntityAbilities(info.nextState.entInstance.getClass());
for(Ability ab1 : mobAbilities)
{
if(ab1.getType().equalsIgnoreCase("swim"))
{
hasSwim = true;
break;
}
}
boolean alsoHasSwim = false;
mobAbilities = AbilityHandler.getEntityAbilities(info.prevState.entInstance.getClass());
for(Ability ab1 : mobAbilities)
{
if(ab1.getType().equalsIgnoreCase("swim"))
{
alsoHasSwim = true;
break;
}
}
if(info.getMorphing())
{
if(!hasSwim)
{
event.density += 0.05F * MathHelper.clamp_float((float)info.morphProgress / 80F, 0.0F, 1.0F);
}
else if(!alsoHasSwim)
{
event.density += 0.05F * MathHelper.clamp_float((80F - (float)info.morphProgress) / 80F, 0.0F, 1.0F);
}
}
}
else
{
event.density = 0.075F;
boolean hasSwim = false;
ArrayList<Ability> mobAbilities = AbilityHandler.getEntityAbilities(info.nextState.entInstance.getClass());
for(Ability ab1 : mobAbilities)
{
if(ab1.getType().equalsIgnoreCase("swim"))
{
hasSwim = true;
break;
}
}
boolean alsoHasSwim = false;
mobAbilities = AbilityHandler.getEntityAbilities(info.prevState.entInstance.getClass());
for(Ability ab1 : mobAbilities)
{
if(ab1.getType().equalsIgnoreCase("swim"))
{
alsoHasSwim = true;
break;
}
}
if(info.getMorphing())
{
if(!hasSwim)
{
event.density -= 0.073F * MathHelper.clamp_float((float)info.morphProgress / 80F, 0.0F, 1.0F);
}