2014-08-25 11:58:39 +00:00
package WayofTime.alchemicalWizardry.client ;
2015-01-14 02:02:11 +00:00
import net.minecraft.client.Minecraft ;
import net.minecraft.entity.player.EntityPlayer ;
import net.minecraftforge.client.event.RenderBlockOverlayEvent ;
import net.minecraftforge.client.event.sound.SoundEvent ;
2014-09-14 22:21:45 +00:00
import WayofTime.alchemicalWizardry.AlchemicalWizardry ;
2015-01-14 02:02:11 +00:00
import WayofTime.alchemicalWizardry.ModBlocks ;
2014-08-25 11:58:39 +00:00
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper ;
import cpw.mods.fml.client.FMLClientHandler ;
2014-09-14 22:21:45 +00:00
import cpw.mods.fml.common.eventhandler.Event.Result ;
2014-08-25 11:58:39 +00:00
import cpw.mods.fml.common.eventhandler.SubscribeEvent ;
2015-01-14 02:02:11 +00:00
import cpw.mods.fml.common.gameevent.InputEvent ;
2014-08-25 11:58:39 +00:00
import cpw.mods.fml.common.gameevent.TickEvent.Phase ;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent ;
2014-10-13 20:33:20 +00:00
public class ClientEventHandler
2014-08-25 11:58:39 +00:00
{
2014-10-13 20:33:20 +00:00
private Minecraft mcClient = FMLClientHandler . instance ( ) . getClient ( ) ;
2014-08-25 11:58:39 +00:00
2015-01-14 02:02:11 +00:00
@SubscribeEvent
public void onKeyInput ( InputEvent . KeyInputEvent event )
{
2015-04-11 19:43:06 +00:00
// if(KeyBindings.omegaTest.isPressed())
// {
// System.out.println("ping");
//// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
// ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
// }
2015-01-14 02:02:11 +00:00
}
2014-09-14 22:21:45 +00:00
@SubscribeEvent
public void onPlayerSoundEvent ( SoundEvent event )
{
2014-10-13 20:33:20 +00:00
if ( Minecraft . getMinecraft ( ) ! = null )
{
EntityPlayer player = Minecraft . getMinecraft ( ) . thePlayer ;
if ( player ! = null & & player . isPotionActive ( AlchemicalWizardry . customPotionDeaf ) )
{
event . setResult ( Result . DENY ) ;
2015-01-14 02:02:11 +00:00
if ( event . isCancelable ( ) )
event . setCanceled ( true ) ;
2014-10-13 20:33:20 +00:00
}
}
2014-09-14 22:21:45 +00:00
}
2015-01-14 02:02:11 +00:00
@SubscribeEvent
public void onOverlayEvent ( RenderBlockOverlayEvent event )
{
if ( event . overlayType = = RenderBlockOverlayEvent . OverlayType . WATER & & event . player . isPotionActive ( AlchemicalWizardry . customPotionAmphibian . id ) ) //TODO Placeholder for new potion effect
if ( event . isCancelable ( ) )
{
event . setCanceled ( true ) ;
}
if ( event . blockForOverlay = = ModBlocks . blockMimic & & event . isCancelable ( ) )
{
event . setCanceled ( true ) ;
}
}
2014-10-13 20:33:20 +00:00
2014-08-25 11:58:39 +00:00
@SubscribeEvent
public void onTick ( RenderTickEvent event )
{
if ( event . phase . equals ( Phase . START ) )
return ;
2014-10-13 20:33:20 +00:00
2014-08-25 11:58:39 +00:00
if ( ! RenderHelper . onTickInGame ( mcClient ) )
{
}
}
2014-10-13 20:33:20 +00:00
2015-01-14 02:02:11 +00:00
// @SubscribeEvent
// public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event)
// {
// GL11.glDisable(2929);
// }
//
// @SubscribeEvent
// public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
// {
// GL11.glEnable(2929);
// }
2014-08-25 11:58:39 +00:00
}