本文整理汇总了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);
}
}
示例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();
}
}
}
示例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);
}
}
}
}
示例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());
}
}
}