/*
 * Copyright  2014 - 2017 | Wurst-Imperium | All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package net.wurstclient.features.mods;

import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.wurstclient.compatibility.WPlayer;
import net.wurstclient.events.listeners.UpdateListener;

@Mod.Info(description = "Thousands of colors!", name = "LSD", help = "Mods/LSD")
@Mod.Bypasses
@Mod.DontSaveState
public final class LsdMod extends Mod implements UpdateListener
{
	@Override
	public void onToggle()
	{
		if(!OpenGlHelper.shadersSupported)
			mc.renderGlobal.loadRenderers();
	}
	
	@Override
	public void onEnable()
	{
		if(OpenGlHelper.shadersSupported)
			if(mc.getRenderViewEntity() instanceof EntityPlayer)
			{
				if(mc.entityRenderer.theShaderGroup != null)
					mc.entityRenderer.theShaderGroup.deleteShaderGroup();
				
				mc.entityRenderer.shaderIndex = 19;
				
				if(mc.entityRenderer.shaderIndex != EntityRenderer.SHADER_COUNT)
					mc.entityRenderer
						.loadShader(EntityRenderer.SHADERS_TEXTURES[19]);
				else
					mc.entityRenderer.theShaderGroup = null;
			}
		wurst.events.add(UpdateListener.class, this);
	}
	
	@Override
	public void onUpdate()
	{
		if(!OpenGlHelper.shadersSupported)
			WPlayer.addPotionEffect(MobEffects.NAUSEA);
		mc.gameSettings.smoothCamera = isEnabled();
	}
	
	@Override
	public void onDisable()
	{
		wurst.events.remove(UpdateListener.class, this);
		WPlayer.removePotionEffect(MobEffects.NAUSEA);
		if(mc.entityRenderer.theShaderGroup != null)
		{
			mc.entityRenderer.theShaderGroup.deleteShaderGroup();
			mc.entityRenderer.theShaderGroup = null;
		}
		mc.gameSettings.smoothCamera = false;
	}
}

@@ -1470,181 +1470,8 @@
 ide%0A
-%09public void onUpdate()%0A%09%7B%0A%09%09if(!OpenGlHelper.shadersSupported)%0A%09%09%09WPlayer.addPotionEffect(MobEffects.NAUSEA);%0A%09%09mc.gameSettings.smoothCamera = isEnabled();%0A%09%7D%0A%09%0A%09@Override%0A
 %09pub
@@ -1487,24 +1487,24 @@
 onDisable()%0A
+
 %09%7B%0A%09%09wurst.e
@@ -1545,16 +1545,19 @@
  this);%0A
+%09%09%0A
 %09%09WPlaye
@@ -1597,16 +1597,19 @@
 AUSEA);%0A
+%09%09%0A
 %09%09if(mc.
@@ -1756,16 +1756,19 @@
 ll;%0A%09%09%7D%0A
+%09%09%0A
 %09%09mc.gam
@@ -1802,10 +1802,186 @@
 lse;%0A%09%7D%0A
+%09%0A%09@Override%0A%09public void onUpdate()%0A%09%7B%0A%09%09if(!OpenGlHelper.shadersSupported)%0A%09%09%09WPlayer.addPotionEffect(MobEffects.NAUSEA);%0A%09%09%0A%09%09mc.gameSettings.smoothCamera = isEnabled();%0A%09%7D%0A
 %7D%0A

Update LsdMod