Java Code Examples for net.minecraftforge.client.event.RenderGameOverlayEvent#Pre

The following examples show how to use net.minecraftforge.client.event.RenderGameOverlayEvent#Pre . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
@SubscribeEvent()
public void onRenderRemoveBars(RenderGameOverlayEvent.Pre e) {
    if (e.type == RenderGameOverlayEvent.ElementType.ALL) {
        if (main.getUtils().isOnSkyblock()) {
            if (main.getConfigValues().isEnabled(Feature.HIDE_FOOD_ARMOR_BAR)) {
                GuiIngameForge.renderFood = false;
                GuiIngameForge.renderArmor = false;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_HEALTH_BAR)) {
                GuiIngameForge.renderHealth = false;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_PET_HEALTH_BAR)) {
                GuiIngameForge.renderHealthMount = false;
            }
        } else {
            if (main.getConfigValues().isEnabled(Feature.HIDE_HEALTH_BAR)) {
                GuiIngameForge.renderHealth = true;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_FOOD_ARMOR_BAR)) {
                GuiIngameForge.renderArmor = true;
            }
        }
    }
}
 
Example 2
Source File: ItemCybereyes.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void overlayPre(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.ALL)
	{
		EntityPlayer e = Minecraft.getMinecraft().thePlayer;
		
		if (isBlind && !e.isCreative())
		{
			GlStateManager.pushMatrix();
			GlStateManager.enableBlend();
			GlStateManager.color(1F, 1F, 1F, .9F);
			Minecraft.getMinecraft().getTextureManager().bindTexture(EssentialsMissingHandler.BLACK_PX);
			ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
			GlStateManager.popMatrix();
		}
	}
}
 
Example 3
Source File: CivilizationClientHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onPostRenderOverlay(RenderGameOverlayEvent.Pre event) {
	if (event.getType() != ElementType.HOTBAR) {
		return;
	}
	ScaledResolution resolution = event.getResolution();

	if (hud == null) {
		hud = new CivilizationOverlayHandler(Minecraft.getMinecraft());
	}

	hud.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
 
Example 4
Source File: VanillaWares.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.CROSSHAIRS)
	{
		EntityPlayer p = Minecraft.getMinecraft().thePlayer;
		if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(Items.SPIDER_EYE)))
		{
			GlStateManager.translate(0, event.getResolution().getScaledHeight() / 5, 0);
		}
	}
}
 
Example 5
Source File: TerminalManagerClient.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Pre evt) {
	if (evt.type == ElementType.ALL) {
		GuiScreen gui = FMLClientHandler.instance().getClient().currentScreen;

		if (gui instanceof GuiCapture) {
			final GuiCapture capture = (GuiCapture)gui;
			// this must be here, since there are some elements (like food bar) that are overriden every tick
			capture.forceGuiElementsState();
		}
	}
}
 
Example 6
Source File: EssentialsMissingHandler.java    From Cyberware with MIT License 4 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void overlayPre(RenderGameOverlayEvent.Pre event)
{

	if (event.getType() == ElementType.ALL)
	{
		EntityPlayer e = Minecraft.getMinecraft().thePlayer;
		
		HashMultimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
		multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(speedId, "Missing leg speed", -100F, 0));
		//e.getAttributeMap().removeAttributeModifiers(multimap);
		
		
		if (CyberwareAPI.hasCapability(e))
		{
			ICyberwareUserData cyberware = CyberwareAPI.getCapability(e);
			
			if (!cyberware.hasEssential(EnumSlot.EYES) && !e.isCreative())
			{
				GlStateManager.pushMatrix();
				GlStateManager.enableBlend();
				GlStateManager.color(1F, 1F, 1F, .9F);
				Minecraft.getMinecraft().getTextureManager().bindTexture(BLACK_PX);
				ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
				GlStateManager.popMatrix();
			}
		}
		
		if (TileEntitySurgery.workingOnPlayer)
		{
			float trans = 1.0F;
			float ticks = TileEntitySurgery.playerProgressTicks + event.getPartialTicks();
			if (ticks < 20F)
			{
				trans = ticks / 20F;
			}
			else if (ticks > 60F)
			{
				trans = (80F - ticks) / 20F;
			}
			GL11.glEnable(GL11.GL_BLEND);
			GL11.glColor4f(1.0F, 1.0F, 1.0F, trans);
			Minecraft.getMinecraft().getTextureManager().bindTexture(BLACK_PX);
			ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
			GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
			GL11.glDisable(GL11.GL_BLEND);
		}
	}
}