• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java INEIGuiHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: JEIProxy

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
public JEIProxy() {
    MinecraftForge.EVENT_BUS.register(new EventHandler());
    API.registerNEIGuiHandler(new INEIGuiHandler() {
        @Override
        public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
            if (extraAreasCache == null) {
                extraAreasCache = getExtraAreas(gui);
            }
            for (Rectangle rectangle : extraAreasCache) {
                if (rectangle.intersects(x, y, w, h)) {
                    return true;
                }
            }
            return false;
        }
    });
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:18,代码来源:JEIProxy.java


示例2: layout

import codechicken.nei.api.INEIGuiHandler; //导入依赖的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: slotValid

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
private boolean slotValid(GuiContainer gui, int i) {
    Rectangle4i rect = getSlotRect(i);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers)
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h))
            return false;
    return true;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:8,代码来源:ItemPanel.java


示例4: handleClick

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
@Override
public boolean handleClick(int mousex, int mousey, int button) {
    if (handleDraggedClick(mousex, mousey, button))
        return true;

    if (NEIClientUtils.getHeldItem() != null) {
        for (INEIGuiHandler handler : GuiInfo.guiHandlers)
            if (handler.hideItemPanelSlot(NEIClientUtils.getGuiContainer(), mousex, mousey, 1, 1))
                return false;

        if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item"))
            if (button == 1)
                NEIClientUtils.decreaseSlotStack(-999);
            else
                NEIClientUtils.deleteHeldItem();
        else
            NEIClientUtils.dropHeldItem();

        return true;
    }

    ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
    if (hoverSlot != null) {
        if (button == 2) {
            ItemStack stack = hoverSlot.item;
            if (stack != null) {
                int amount = NEIClientConfig.getItemQuantity();
                if (amount == 0)
                    amount = stack.getMaxStackSize();

                draggedStack = NEIServerUtils.copyStack(stack, amount);
            }
        } else {
            mouseDownSlot = hoverSlot.slotIndex;
        }
        return true;
    }
    return false;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:40,代码来源:ItemPanel.java


示例5: contains

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
@Override
public boolean contains(int px, int py) {
    GuiContainer gui = NEIClientUtils.getGuiContainer();
    Rectangle4i rect = new Rectangle4i(px, py, 1, 1);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers)
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h))
            return false;

    return super.contains(px, py);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:11,代码来源:ItemPanel.java


示例6: load

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
public static void load(GuiContainer gui) {
    deleteMode = false;
    GuiInfo.clearGuiHandlers();
    fastTransferManager = null;
    if (!NEIClientConfig.isEnabled()) {
        return;
    }

    fastTransferManager = new FastTransferManager();
    if (gui instanceof INEIGuiHandler) {
        API.registerNEIGuiHandler((INEIGuiHandler) gui);
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:14,代码来源:NEIController.java


示例7: slotValid

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
private boolean slotValid(GuiContainer gui, int i) {
    Rectangle4i rect = getSlotRect(i);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:10,代码来源:ItemPanel.java


示例8: contains

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
@Override
public boolean contains(int px, int py) {
    GuiContainer gui = NEIClientUtils.getGuiContainer();
    Rectangle4i rect = new Rectangle4i(px, py, 1, 1);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h)) {
            return false;
        }
    }

    return super.contains(px, py);
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:13,代码来源:ItemPanel.java


示例9: handleDraggedClick

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
private boolean handleDraggedClick(int mousex, int mousey, int button) {
    if (draggedStack == null)
        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.stackSize == 0) {
                draggedStack = null;
                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().stackSize : 0;
            int add = button == 0 ? draggedStack.stackSize : 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) {
                NEIClientUtils.setSlotContents(overSlot.slotNumber, NEIServerUtils.copyStack(draggedStack, total), true);
                NEICPH.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false);
                draggedStack.stackSize -= total - contents;
            }
            if (draggedStack.stackSize == 0)
                draggedStack = null;
        } else {
            draggedStack = null;
        }
    } else if (mousex < gui.guiLeft || mousey < gui.guiTop || mousex >= gui.guiLeft + gui.xSize || mousey >= gui.guiTop + gui.ySize) {
        draggedStack = null;
    }

    return true;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:44,代码来源:ItemPanel.java


示例10: handleClick

import codechicken.nei.api.INEIGuiHandler; //导入依赖的package包/类
@Override
public boolean handleClick(int mousex, int mousey, int button) {
    if (handleDraggedClick(mousex, mousey, button)) {
        return true;
    }

    if (!NEIClientUtils.getHeldItem().isEmpty()) {
        for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
            if (handler.hideItemPanelSlot(NEIClientUtils.getGuiContainer(), mousex, mousey, 1, 1)) {
                return false;
            }
        }

        if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
            if (button == 1) {
                NEIClientUtils.decreaseSlotStack(-999);
            } else {
                NEIClientUtils.deleteHeldItem();
            }
        } else {
            NEIClientUtils.dropHeldItem();
        }

        return true;
    }

    ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
    if (hoverSlot != null) {
        if (button == 2) {
            ItemStack stack = hoverSlot.item;
            if (!stack.isEmpty()) {
                int amount = NEIClientConfig.getItemQuantity();
                if (amount == 0) {
                    amount = stack.getMaxStackSize();
                }

                draggedStack = NEIServerUtils.copyStack(stack, amount);
            }
        } else {
            mouseDownSlot = hoverSlot.slotIndex;
        }
        return true;
    }
    return false;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:46,代码来源:ItemPanel.java


示例11: handleDraggedClick

import codechicken.nei.api.INEIGuiHandler; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DERSequenceGenerator类代码示例发布时间:2022-05-23
下一篇:
Java SegmentReadState类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap