net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent Java Examples

The following examples show how to use net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent. 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: CreativeMenuHandler.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
public void handleTooltips(DrawScreenEvent.Post event)
{
	if (isCorrectGui(event.getGui()))
	{
		int mouseX = event.getMouseX();
		int mouseY = event.getMouseY();
		GuiContainerCreative gui = (GuiContainerCreative) event.getGui();
		int i = (gui.width - 136) / 2;
		int j = (gui.height - 195) / 2;
		if (isPointInRegion(i, j, salvaged.xPosition - i, 29 + 8, 18, 18, mouseX, mouseY))
		{
			ClientUtils.drawHoveringText(gui, Arrays.asList(new String[] { I18n.format(CyberwareAPI.QUALITY_SCAVENGED.getUnlocalizedName()) } ), mouseX, mouseY, mc.getRenderManager().getFontRenderer());
		}
		
		if (isPointInRegion(i, j, manufactured.xPosition - i, 29 + 8 + 23, 18, 18, mouseX, mouseY))
		{
			ClientUtils.drawHoveringText(gui, Arrays.asList(new String[] { I18n.format(CyberwareAPI.QUALITY_MANUFACTURED.getUnlocalizedName()) } ), mouseX, mouseY, mc.getRenderManager().getFontRenderer());
		}
	}
}
 
Example #2
Source File: NEIClientEventHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@SubscribeEvent
public void drawScreenPost(DrawScreenEvent.Post event) {
    GuiScreen screen = event.getGui();

    Point mousePos = GuiDraw.getMousePosition();
    List<String> tooltip = new LinkedList<>();
    ItemStack stack = ItemStack.EMPTY;
    if (instanceTooltipHandlers != null) {
        instanceTooltipHandlers.forEach(handler -> handler.handleTooltip(screen, mousePos.x, mousePos.y, tooltip));
    }

    if (screen instanceof GuiContainer) {
        if (tooltip.isEmpty() && GuiHelper.shouldShowTooltip(screen)) {
            GuiContainer container = (GuiContainer) screen;
            stack = GuiHelper.getStackMouseOver(container, false);

            if (!stack.isEmpty()) {
                tooltip.clear();
                tooltip.addAll(GuiHelper.itemDisplayNameMultiline(stack, container, false));
            }
        }
    }

    GuiDraw.drawMultiLineTip(stack, mousePos.x + 10, mousePos.y - 12, tooltip);
}
 
Example #3
Source File: CMMEventHandler.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void renderScreenPost(DrawScreenEvent.Post event)
{
	if (displayMs != -1)
	{
		if (System.currentTimeMillis() - displayMs < 5000)
		{
			Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("Error loading config file, see console for more information", 0, 80, 16711680);
		}
		else
		{
			displayMs = -1;
		}
	}
}
 
Example #4
Source File: MenuEventHandler.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SubscribeEvent
public static void turnMenus(DrawScreenEvent e) {
	if(e.getGui() instanceof GuiRepair)
	e.getGui().drawString(e.getGui().mc.fontRenderer, "Think before you smith", Paranoia.rand.nextInt(e.getGui().width), Paranoia.rand.nextInt(e.getGui().width), Paranoia.rand.nextInt());
}