本文整理汇总了Java中codechicken.nei.NEIClientConfig.canCheatItem方法的典型用法代码示例。如果您正苦于以下问题:Java NEIClientConfig.canCheatItem方法的具体用法?Java NEIClientConfig.canCheatItem怎么用?Java NEIClientConfig.canCheatItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类codechicken.nei.NEIClientConfig
的用法示例。
在下文中一共展示了NEIClientConfig.canCheatItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseUp
import codechicken.nei.NEIClientConfig; //导入方法依赖的package包/类
@Override
public void mouseUp(int mousex, int mousey, int button) {
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && draggedStack.isEmpty()) {
ItemStack item = hoverSlot.item;
if (!NEIClientConfig.canCheatItem(item)) {
if (button == 0) {
JEIIntegrationManager.openRecipeGui(item);
} else if (button == 1) {
JEIIntegrationManager.openUsageGui(item);
}
draggedStack = ItemStack.EMPTY;
mouseDownSlot = -1;
return;
}
NEIClientUtils.cheatItem(item, button, -1);
}
mouseDownSlot = -1;
}
示例2: handleDraggedClick
import codechicken.nei.NEIClientConfig; //导入方法依赖的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;
}