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


Java MouseInputEvent.Pre方法代码示例

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


在下文中一共展示了MouseInputEvent.Pre方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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.Pre方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。