当前位置: 首页>>代码示例>>Java>>正文


Java MouseInputEvent类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent的典型用法代码示例。如果您正苦于以下问题:Java MouseInputEvent类的具体用法?Java MouseInputEvent怎么用?Java MouseInputEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MouseInputEvent类属于net.minecraftforge.client.event.GuiScreenEvent包,在下文中一共展示了MouseInputEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMouseInputEvent

import net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onMouseInputEvent(MouseInputEvent.Pre event)
{
    // Only accepts clicks - 0 = left, 1 = right, 2 = middle
    if (Mouse.getEventButton() < 0) { return; }
    if (!this.shouldDisplayGuiOverlay(event.getGui())) { return; }


    final boolean shouldCancelEvent = this.getGuiOverlay().handleMouseInput();

    if (shouldCancelEvent) {
        // Prevents clicks on the gui overlay dropping items on the world
        event.setCanceled(true);
    }

}
 
开发者ID:sidben,项目名称:VisibleArmorSlots,代码行数:18,代码来源:EventDelegatorGuiOverlay.java

示例2: onMouseClicked

import net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onMouseClicked(MouseInputEvent.Post event)
{
	if (event.getGui() instanceof GuiContainerCreative)
	{
		GuiContainerCreative guiScreen = (GuiContainerCreative) event.getGui();
		List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 7);

		if (previousSelectedTabIndex != guiScreen.getSelectedTabIndex())
		{
			if (guiScreen.getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON))
			{
				int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
				int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");

				buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
			}
			else if (previousSelectedTabIndex == CreativeTabs.INVENTORY.getTabIndex())
			{
				buttonList.remove(ACCESSORY_BUTTON);
			}

			previousSelectedTabIndex = guiScreen.getSelectedTabIndex();
		}
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:27,代码来源:AetherClientEvents.java

示例3: onGuiMouseEventpre

import net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent; //导入依赖的package包/类
@SubscribeEvent (priority = EventPriority.LOWEST, receiveCanceled = true)//We need to be called before JEI.
public void onGuiMouseEventpre(MouseInputEvent.Pre event) {
    if (Mouse.getEventButton() == -1 || event.getGui() == null || !Mouse.getEventButtonState()) {
        return;
    }
    Point mouse = GuiDraw.getMousePosition();
    int eventButton = Mouse.getEventButton();
    if (JEIIntegrationManager.searchBoxOwner == EnumItemBrowser.JEI) {
        GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter();
        if (fieldFilter != null && fieldFilter.isMouseOver(mouse.x, mouse.y)) {
            if (eventButton == 0) {
                if (fieldFilter.isFocused() && (System.currentTimeMillis() - lastSearchBoxClickTime < 500)) {//double click
                    NEIClientConfig.world.nbt.setBoolean("searchinventories", !SearchField.searchInventories());
                    NEIClientConfig.world.saveNBT();
                    lastSearchBoxClickTime = 0L;
                } else {
                    lastSearchBoxClickTime = System.currentTimeMillis();
                }
            } else if (eventButton == 1) {
                NEIClientConfig.setSearchExpression("", false);
                LayoutManager.searchField.setText("", false);
            }
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:26,代码来源:ContainerEventHandler.java

示例4: onMouseInputEventPre

import net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public static void onMouseInputEventPre(MouseInputEvent.Pre event)
{
    // Handle the mouse input inside all of the mod's GUIs via the event and then cancel the event,
    // so that some mods like Inventory Sorter don't try to sort the Ender Utilities inventories.
    // Using priority LOW should still allow even older versions of Item Scroller to work,
    // since it uses normal priority.
    if (event.getGui() instanceof GuiEnderUtilities)
    {
        try
        {
            event.getGui().handleMouseInput();
            event.setCanceled(true);
        }
        catch (IOException e)
        {
            EnderUtilities.logger.warn("Exception while executing handleMouseInput() on {}", event.getGui().getClass().getName());
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:21,代码来源:GuiEnderUtilities.java


注:本文中的net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。