Java tutorial
/* * This class belongs to the source code of Advanced Chemistry. * It might depend on other Advanced Chemistry classes to work * properly. * * For the full license, please see the licence.txt in the source * directory. */ package rheel.ac.common.handler; import java.util.EnumSet; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import org.lwjgl.opengl.GL11; import rheel.ac.common.potion.Potions; import rheel.ac.common.util.TextureLoader; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; /** * @author Rheel */ public class TickHandlerRadiationOverlay implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if (type.contains(TickType.RENDER) && FMLCommonHandler.instance().getEffectiveSide().isClient()) { final Minecraft mc = Minecraft.getMinecraft(); if (mc.thePlayer != null && mc.thePlayer.isPotionActive(Potions.potionRadioActive.id) && mc.currentScreen == null) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.294F); GL11.glDisable(GL11.GL_ALPHA_TEST); mc.getTextureManager().bindTexture(TextureLoader.getGUITexture("RadioActiveBlur.png")); final Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, mc.displayHeight, -90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(mc.displayWidth, mc.displayHeight, -90.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(mc.displayWidth, 0.0D, -90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glPopMatrix(); } } } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.RENDER); } @Override public String getLabel() { return "RadioActive"; } }