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


Java GuiContainer.getYSize方法代码示例

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


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

示例1: canShiftDropItems

import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
private boolean canShiftDropItems(GuiContainer gui)
{
    if (GuiScreen.isShiftKeyDown() == false || Mouse.getEventButton() != 0 ||
        InventoryUtils.isStackEmpty(gui.mc.player.inventory.getItemStack()))
    {
        return false;
    }

    int left = gui.getGuiLeft();
    int top = gui.getGuiTop();
    int xSize = gui.getXSize();
    int ySize = gui.getYSize();
    int mouseAbsX = Mouse.getEventX() * gui.width / gui.mc.displayWidth;
    int mouseAbsY = gui.height - Mouse.getEventY() * gui.height / gui.mc.displayHeight - 1;
    boolean isOutsideGui = mouseAbsX < left || mouseAbsY < top || mouseAbsX >= left + xSize || mouseAbsY >= top + ySize;

    return isOutsideGui && this.getSlotAtPosition(gui, mouseAbsX - left, mouseAbsY - top) == null;
}
 
开发者ID:maruohon,项目名称:itemscroller,代码行数:19,代码来源:InputEventHandler.java

示例2: layout

import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
public static void layout(GuiContainer gui) {
    VisibilityData visiblity = new VisibilityData();
    if (isHidden()) {
        //showItemPanel = false;
        visiblity.showNEI = false;
    }
    if (gui.height - gui.getYSize() <= 40) {
        visiblity.showSearchSection = false;
    }
    if (gui.getGuiLeft() - 4 < 76) {
        visiblity.showWidgets = false;
    }

    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        handler.modifyVisibility(gui, visiblity);
    }

    visiblity.translateDependancies();

    getLayoutStyle().layout(gui, visiblity);

    updateWidgetVisiblities(gui, visiblity);
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:24,代码来源:LayoutManager.java

示例3: create

import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
public static InfoGuiOverlayDisplayParams create(GuiContainer gui, String guiClassName)
{
    if (gui == null) { return InfoGuiOverlayDisplayParams.EMPTY; }


    // Check for blacklisted gui's
    if (isBlacklisted(gui)) { return InfoGuiOverlayDisplayParams.EMPTY; }


    int overlayX = 0;
    int overlayY = 0;

    if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_LEFT)) {
        overlayX = gui.getGuiLeft() - GuiExtraSlotsOverlay.GUI_WIDTH - ModConfig.extraSlotsMargin();
    } else if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_RIGHT)) {
        overlayX = gui.getGuiLeft() + gui.getXSize() + ModConfig.extraSlotsMargin();
    }
    overlayY = gui.getGuiTop() + gui.getYSize() - GuiExtraSlotsOverlay.GUI_HEIGHT - 4;


    // HOTFIX: Chest containers have their height (YSize) wrong
    if (gui instanceof GuiChest || gui instanceof GuiShulkerBox) {
        overlayY -= 1;
    }


    final InfoGuiOverlayDisplayParams displayParams = new InfoGuiOverlayDisplayParams(overlayX, overlayY, true);
    return displayParams;
}
 
开发者ID:sidben,项目名称:VisibleArmorSlots,代码行数:30,代码来源:InfoGuiOverlayDisplayParams.java

示例4: mouseClicked

import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
@Override
public boolean mouseClicked(GuiScreen screen, int mouseX, int mouseY, int button) {

    if (!(screen instanceof GuiContainer) || !NEIClientConfig.isEnabled() || isSpreading(((GuiContainer) screen))) {
        return false;
    }
    GuiContainer gui = ((GuiContainer) screen);
    Slot slot = GuiHelper.getSlotMouseOver(gui);
    int slotID = -1;

    boolean outsideGui = (mouseX < gui.getGuiLeft() || mouseY < gui.getGuiTop() || mouseX >= gui.getGuiLeft() + gui.getXSize() || mouseY >= gui.getGuiTop() + gui.getYSize()) && slot == null;

    if (slot != null) {
        slotID = slot.slotNumber;
    }

    if (outsideGui) {
        slotID = -999;
    }


    //Shift / Click delete.
    if (deleteMode && slot != null && slot.slotNumber >= 0) {
        if (NEIClientUtils.shiftKey() && button == 0) {
            ItemStack itemstack1 = slot.getStack();
            if (!itemstack1.isEmpty()) {
                NEIClientUtils.deleteItemsOfType(itemstack1);
            }

        } else if (button == 1) {
            NEIClientUtils.decreaseSlotStack(slot.slotNumber);
        } else {
            NEIClientUtils.deleteSlotStack(slot.slotNumber);
        }
        return true;
    }

    //Creative click the slot 64 times because mojang.
    //Seems to already be a thing.. Gonna leave this here and wipe it in a cleanup pass.
    //if (button == 1 && slot instanceof SlotCrafting)//right click
    //{
    //    for (int i1 = 0; i1 < 64; i1++)//click this slot 64 times
    //    {
    //        manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP);
    //    }
    //    return true;
    //}

    //Control click slot = give me an item.
    if (NEIClientUtils.controlKey() && slot != null && !slot.getStack().isEmpty() && slot.isItemValid(slot.getStack())) {
        NEIClientUtils.cheatItem(slot.getStack(), button, 1);
        return true;
    }

    //Custom slots or container? No thanx, bia!
    if (GuiInfo.hasCustomSlots(gui) || ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) {
        return false;
    }
    //Disabled for now.
    //if (slotID >= 0 && NEIClientUtils.shiftKey() && !NEIClientUtils.getHeldItem().isEmpty() && !slot.getHasStack()) {
    //    ItemStack held = NEIClientUtils.getHeldItem();
    //    GuiHelper.clickSlot(container, slot.slotNumber, button, ClickType.PICKUP);
    //    if (slot.isItemValid(held)) {
    //        fastTransferManager.performMassTransfer(container, pickedUpFromSlot, slot.slotNumber, held);
    //    }
    //
    //    return true;
    //}

    if (slotID == -999 && NEIClientUtils.shiftKey() && button == 0 && !NEIClientUtils.getHeldItem().isEmpty()) {
        fastTransferManager.throwAll(gui, pickedUpFromSlot);
        return true;
    }

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

示例5: handleDraggedClick

import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
private boolean handleDraggedClick(int mousex, int mousey, int button) {
    if (draggedStack.isEmpty()) {
        return false;
    }

    GuiContainer gui = NEIClientUtils.getGuiContainer();
    boolean handled = false;
    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        if (handler.handleDragNDrop(gui, mousex, mousey, draggedStack, button)) {
            handled = true;
            if (draggedStack.getCount() == 0) {
                draggedStack = ItemStack.EMPTY;
                return true;
            }
        }
    }

    if (handled) {
        return true;
    }

    Slot overSlot = gui.getSlotAtPosition(mousex, mousey);
    if (overSlot != null && overSlot.isItemValid(draggedStack)) {
        if (NEIClientConfig.canCheatItem(draggedStack)) {
            int contents = overSlot.getHasStack() ? overSlot.getStack().getCount() : 0;
            int add = button == 0 ? draggedStack.getCount() : 1;
            if (overSlot.getHasStack() && !NEIServerUtils.areStacksSameType(draggedStack, overSlot.getStack())) {
                contents = 0;
            }
            int total = Math.min(contents + add, Math.min(overSlot.getSlotStackLimit(), draggedStack.getMaxStackSize()));

            if (total > contents) {
                int slotNumber = overSlot.slotNumber;
                if (gui instanceof GuiContainerCreative) {
                    //Because Mojang..
                    slotNumber = slotNumber - gui.inventorySlots.inventorySlots.size() + 9 + 36;
                }
                NEIClientUtils.setSlotContents(slotNumber, NEIServerUtils.copyStack(draggedStack, total), true);
                NEIClientPacketHandler.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false);
                draggedStack.shrink(total - contents);
            }
            if (draggedStack.getCount() == 0) {
                draggedStack = ItemStack.EMPTY;
            }
        } else {
            draggedStack = ItemStack.EMPTY;
        }
    } else if (mousex < gui.getGuiLeft() || mousey < gui.getGuiTop() || mousex >= gui.getGuiLeft() + gui.getXSize() || mousey >= gui.getGuiTop() + gui.getYSize()) {
        draggedStack = ItemStack.EMPTY;
    }

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


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