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


Java GuiDraw.getMousePosition方法代码示例

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


在下文中一共展示了GuiDraw.getMousePosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGuiMouseEventpre

import codechicken.lib.gui.GuiDraw; //导入方法依赖的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

示例2: drawScreenPost

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@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);
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:26,代码来源:NEIClientEventHandler.java

示例3: foregroundRenderEvent

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@SubscribeEvent
public void foregroundRenderEvent(GuiContainerEvent.DrawForeground event) {
    GuiContainer container = event.getGuiContainer();
    GlStateTracker.pushState();
    Point mousePos = GuiDraw.getMousePosition();

    GlStateManager.translate(-container.getGuiLeft(), -container.getGuiTop(), 100F);
    drawHandlers.forEach(handler -> handler.renderObjects(container, mousePos.x, mousePos.y));

    drawHandlers.forEach(handler -> handler.postRenderObjects(container, mousePos.x, mousePos.y));

    GlStateManager.translate(container.getGuiLeft(), container.getGuiTop(), -100F);
    GuiHelper.enable3DRender();

    GlStateManager.pushMatrix();
    for (Slot slot : container.inventorySlots.inventorySlots) {
        GlStateTracker.pushState();
        drawHandlers.forEach(handler -> handler.renderSlotOverlay(container, slot));
        GlStateTracker.popState();
    }
    GlStateManager.popMatrix();

    GlStateTracker.popState();
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:25,代码来源:NEIClientEventHandler.java

示例4: itemTooltipEvent

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@SubscribeEvent
public void itemTooltipEvent(ItemTooltipEvent event) {

    if (instanceTooltipHandlers != null && Minecraft.getMinecraft().currentScreen != null) {
        GuiScreen screen = Minecraft.getMinecraft().currentScreen;

        Point mousePos = GuiDraw.getMousePosition();

        instanceTooltipHandlers.forEach(handler -> handler.handleTooltip(screen, mousePos.x, mousePos.y, event.getToolTip()));

        if (screen instanceof GuiContainer) {
            GuiContainer container = ((GuiContainer) screen);
            instanceTooltipHandlers.forEach(handler -> handler.handleItemDisplayName(screen, GuiHelper.getStackMouseOver(container, true), event.getToolTip()));
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:17,代码来源:NEIClientEventHandler.java

示例5: handleKeyPress

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public boolean handleKeyPress(int keyID, char keyChar) {
    if (KeyBindings.get("nei.options.keys.gui.next").isActiveAndMatches(keyID)) {
        scroll(1);
        return true;
    }
    if (KeyBindings.get("nei.options.keys.gui.prev").isActiveAndMatches(keyID)) {
        scroll(-1);
        return true;
    }

    Point mouse = GuiDraw.getMousePosition();
    ItemPanelSlot hoverSlot = getSlotMouseOver(mouse.x, mouse.y);
    if (hoverSlot != null && draggedStack.isEmpty()) {
        ItemStack item = hoverSlot.item;
        if (KeyBindings.get("nei.options.keys.gui.recipe").isActiveAndMatches(keyID)) {
            JEIIntegrationManager.openRecipeGui(item);
            return true;
        } else if (KeyBindings.get("nei.options.keys.gui.usage").isActiveAndMatches(keyID)) {
            JEIIntegrationManager.openUsageGui(item);
            return true;
        }
    }

    return false;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:27,代码来源:ItemPanel.java

示例6: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);

	if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7)
	{
		currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient));
	}
	else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7)
	{
		currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas.getGas().getLocalizedName());
	}
	else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7)
	{
		currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas.getGas().getLocalizedName());
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:ElectrolyticSeparatorRecipeHandler.java

示例7: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();
	Point offset = gui.getRecipePosition(recipe);

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x;
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y;

	if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45)
	{
		currenttip.add(((CachedIORecipe)arecipes.get(recipe)).input.gasType.getLocalizedName());
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:17,代码来源:AdvancedMachineRecipeHandler.java

示例8: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);

	if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas));
	}
	else if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
	}
	else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas));
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:ChemicalInfuserRecipeHandler.java

示例9: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);

	if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13)
	{
		currenttip.add(FluidRegistry.WATER.getLocalizedName(null));
	}
	else if(xAxis >= 27 && xAxis <= 43 && yAxis >= 14+13 && yAxis <= 72+13)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack));
	}
	else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack));
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:24,代码来源:ChemicalWasherRecipeHandler.java

示例10: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);

	if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4)
	{
		currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).gasStack));
	}
	else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4)
	{
		currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidStack));
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:20,代码来源:RotaryCondensentratorRecipeHandler.java

示例11: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
{
	Point point = GuiDraw.getMousePosition();

	int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
	int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);

	if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14+4 && yAxis <= 72+4)
	{
		currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe) arecipes.get(recipe)).fluidInput));
	}
	else if(xAxis >= 153 && xAxis <= 169 && yAxis >= 14+4 && yAxis <= 72+4)
	{
		currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe) arecipes.get(recipe)).fluidOutput));
	}

	return super.handleTooltip(gui, currenttip, recipe);
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:20,代码来源:SolarEvaporationRecipeHandler.java

示例12: transferFluidTank

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage) {
    CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point offset = guiRecipe.getRecipePosition(recipe);
    Point relMouse = new Point(mousepos.x - (guiRecipe.width - 176) / 2 - offset.x, mousepos.y - (guiRecipe.height - 166) / 2 - offset.y);
    
    if (crecipe.getFluidTanks() != null) {
        for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
            if (tank.position.contains(relMouse)) {
                return tank.transfer(usage);
            }
        }
    }
    
    return false;
}
 
开发者ID:Tonius,项目名称:NEI-Integration,代码行数:17,代码来源:RecipeHandlerBase.java

示例13: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe){
    //  super.handleTooltip(guiRecipe, currenttip, recipe);
    MultipleInputOutputRecipe r = (MultipleInputOutputRecipe)arecipes.get(recipe);
    if(GuiContainerManager.shouldShowTooltip(guiRecipe)) {
        Point mouse = GuiDraw.getMousePosition();
        Point offset = guiRecipe.getRecipePosition(recipe);
        Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y);

        for(IGuiWidget widget : r.tooltipWidgets) {
            if(widget.getBounds().contains(relMouse)) {
                widget.addTooltip(mouse.x, mouse.y, currenttip, false);
            }
        }
        if(r.tempWidget != null) {
            if(r.tempWidget.getBounds().contains(relMouse)) {
                r.heatExchanger.setTemperature(r.tempWidget.getScales()[0]);
                r.tempWidget.addTooltip(mouse.x, mouse.y, currenttip, false);
            }
        }
    }
    return currenttip;
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:24,代码来源:PneumaticCraftPlugins.java

示例14: isMouseOver

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
public boolean isMouseOver(PositionedStack stack, int recipe) {
    Slot stackSlot = slotcontainer.getSlotWithStack(stack, getRecipePosition(recipe).x, getRecipePosition(recipe).y);
    Point mousepos = GuiDraw.getMousePosition();
    Slot mouseoverSlot = getSlotAtPosition(mousepos.x, mousepos.y);

    return stackSlot == mouseoverSlot;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:8,代码来源:GuiRecipe.java

示例15: handleTooltip

import codechicken.lib.gui.GuiDraw; //导入方法依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    currenttip = super.handleTooltip(gui, currenttip, recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point relMouse = new Point(mousepos.x - gui.guiLeft, mousepos.y - gui.guiTop);
    Point recipepos = gui.getRecipePosition(recipe);
    if (currenttip.isEmpty() && GuiContainerManager.getStackMouseOver(gui) == null &&
            new Rectangle(recipepos.x, recipepos.y, 166, 55).contains(relMouse))
        currenttip.add(NEIClientUtils.translate(
                "recipe.firework.tooltip" + ((CachedFireworkRecipe) arecipes.get(recipe)).recipeType));
    return currenttip;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:13,代码来源:FireworkRecipeHandler.java


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