net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType Java Examples

The following examples show how to use net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType. 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: TacoCmd.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onRenderGUI(RenderGameOverlayEvent.Post event)
{
	if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo)
		return;
	
	if(wurst.getHax().rainbowUiHack.isEnabled())
	{
		float[] acColor = wurst.getGui().getAcColor();
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1);
	}else
		GL11.glColor4f(1, 1, 1, 1);
	
	int tacoId = WMinecraft.getPlayer().ticksExisted % 32 / 8;
	ResourceLocation tacoLocation = tacos[tacoId];
	mc.getTextureManager().bindTexture(tacoLocation);
	
	ScaledResolution sr = new ScaledResolution(mc);
	int x = sr.getScaledWidth() / 2 + 44;
	int y = sr.getScaledHeight() - 51;
	int w = 64;
	int h = 32;
	Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h);
}
 
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: VanillaWares.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post 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 #6
Source File: RenderEventHandler.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Post event)
{
    if (event.getType() != ElementType.ALL)
    {
        return;
    }

    if ((this.mc.currentScreen instanceof GuiChat) == false && this.mc.player != null)
    {
        this.buildersWandRenderer.renderHud(this.mc.player);
        this.rulerRenderer.renderHud();
        this.renderPlacementPropertiesHud(this.mc.player);
    }
}
 
Example #7
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 #8
Source File: TerminalManagerClient.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Post evt) {
	if (evt.type == ElementType.HELMET) {
		if (terminalGuid.isPresent()) {
			final long guid = terminalGuid.get();
			tryDrawSurface(guid, SurfaceType.PRIVATE, evt.partialTicks, evt.resolution);
			tryDrawSurface(guid, SurfaceType.GLOBAL, evt.partialTicks, evt.resolution);
		}
	}
}
 
Example #9
Source File: IngameHUD.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderGUI(RenderGameOverlayEvent.Post event)
{
	if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo)
		return;
	
	boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
	
	// color
	clickGui.updateColors();
	int textColor;
	if(hackList.rainbowUiHack.isEnabled())
	{
		float[] acColor = clickGui.getAcColor();
		textColor = (int)(acColor[0] * 256) << 16
			| (int)(acColor[1] * 256) << 8 | (int)(acColor[2] * 256);
	}else
		textColor = 0xffffff;
	
	// title
	GL11.glPushMatrix();
	GL11.glScaled(1.33333333, 1.33333333, 1);
	WMinecraft.getFontRenderer().drawStringWithShadow(
		"ForgeWurst v" + ForgeWurst.VERSION, 3, 3, textColor);
	GL11.glPopMatrix();
	
	// hack list
	int y = 19;
	ArrayList<Hack> hacks = new ArrayList<>();
	hacks.addAll(hackList.getValues());
	hacks.sort(Comparator.comparing(Hack::getName));
	
	for(Hack hack : hacks)
	{
		if(!hack.isEnabled())
			continue;
		
		WMinecraft.getFontRenderer()
			.drawStringWithShadow(hack.getRenderName(), 2, y, textColor);
		y += 9;
	}
	
	// pinned windows
	if(!(mc.currentScreen instanceof ClickGuiScreen))
		clickGui.renderPinnedWindows(event.getPartialTicks());
	
	if(blend)
		GL11.glEnable(GL11.GL_BLEND);
	else
		GL11.glDisable(GL11.GL_BLEND);
}
 
Example #10
Source File: HudRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public static void renderHud(Post event) {
	ScaledResolution resolution = event.getResolution();
	int width = resolution.getScaledWidth();
	int height = resolution.getScaledHeight();
	EntityPlayer player = Minecraft.getMinecraft().player;

	ItemStack stack = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
	if (stack.isEmpty()) return;

	if (event.getType() == ElementType.EXPERIENCE) {

		int barSide = Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.RIGHT ? 1 : -1;
		barSide *= Minecraft.getMinecraft().gameSettings.attackIndicator == 2 ? -1 : 1;

		int right = ((width / 2) - (100 / 2)) + 155 * barSide;
		int top = height - 17;

		HUD_TEXTURE.bind();

		GlStateManager.pushMatrix();
		GlStateManager.color(1.0F, 1.0F, 1.0F);
		emptyManaBar.draw(ClientTickHandler.getTicks(), right, top);
		emptyBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6);
		GlStateManager.popMatrix();

		try (ManaManager.CapManagerBuilder mgr = ManaManager.forObject(player)) {
			double mana = mgr.getMana();
			double burnout = mgr.getBurnout();
			double maxMana = mgr.getMaxMana();
			double maxBurnout = mgr.getMaxBurnout();

			GlStateManager.pushMatrix();
			GlStateManager.color(1.0F, 1.0F, 1.0F);
			int visualManaLength = 0;
			if (mana > 0)
				visualManaLength = (int) (((mana * 100) / maxMana) % 101);
			fullManaBar.draw(ClientTickHandler.getTicks(), right, top, visualManaLength, 5);

			GlStateManager.color(1.0F, 1.0F, 1.0F);

			int visualBurnoutLength = 0;
			if (burnout > 0)
				visualBurnoutLength = (int) (((burnout * 100) / maxBurnout) % 101);
			fullBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6, visualBurnoutLength, 5);

			GlStateManager.popMatrix();
		}
	}
}
 
Example #11
Source File: ItemLungsUpgrade.java    From Cyberware with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post event)
{
	if (event.getType() == ElementType.AIR)
	{
		EntityPlayer p = Minecraft.getMinecraft().thePlayer;
		if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(this, 1, 0)) && !p.isCreative())
		{
			GL11.glPushMatrix();
			ItemStack stack = CyberwareAPI.getCyberware(p, new ItemStack(this, 1, 0));
			int air = getAir(stack);
			
			Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.ICONS);
	
			ScaledResolution res = event.getResolution();
			GlStateManager.enableBlend();
			int left = res.getScaledWidth() / 2 + 91;
			int top = res.getScaledHeight() - 49 - 8;//- right_height;
			
			float r = 1F;
			float b = 1F;
			float g = 1F;

		
			if (p.isInsideOfMaterial(Material.WATER))
			{
				while (air > 0)
				{
					r += 1F;
					b -= .25F;
					g += .25F;
					GL11.glColor3f(r, g, b);
					int drawAir = Math.min(300, air);
					int full = MathHelper.ceiling_double_int((double)(drawAir - 2) * 10.0D / 300.0D);
					int partial = MathHelper.ceiling_double_int((double)drawAir * 10.0D / 300.0D) - full;
			
					for (int i = 0; i < full + partial; ++i)
					{
						ClientUtils.drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
					}
					
					
					air -= 300;
					top -= 8;
				}
			}
		
			GL11.glColor3f(1.0F, 1.0F, 1.0F);
			//GlStateManager.disableBlend();
			GL11.glPopMatrix();
		}
	}
}
 
Example #12
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);
		}
	}
}