Java Code Examples for net.minecraft.inventory.ClickType#PICKUP
The following examples show how to use
net.minecraft.inventory.ClickType#PICKUP .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhantomSlotWidget.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void handleClientAction(int id, PacketBuffer buffer) { if (id == 1) { ItemStack stackHeld; try { stackHeld = buffer.readItemStack(); } catch (IOException e) { throw new RuntimeException(e); } int mouseButton = buffer.readVarInt(); boolean shiftKeyDown = buffer.readBoolean(); ClickType clickType = shiftKeyDown ? ClickType.QUICK_MOVE : ClickType.PICKUP; SlotUtil.slotClickPhantom(slotReference, mouseButton, clickType, stackHeld); } }
Example 2
Source File: MemorizedRecipeWidget.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ItemStack slotClick(int dragType, ClickType clickTypeIn, EntityPlayer player) { if (!player.world.isRemote) { MemorizedRecipe recipe = recipeMemory.getRecipeAtIndex(recipeIndex); if (recipe != null && !recipe.getRecipeResult().isEmpty()) { if (clickTypeIn == ClickType.PICKUP) { recipeMemory.loadRecipe(recipeIndex, craftingGrid); player.openContainer.detectAndSendChanges(); } else if (clickTypeIn == ClickType.QUICK_MOVE) { recipe.setRecipeLocked(!recipe.isRecipeLocked()); } } } return ItemStack.EMPTY; }
Example 3
Source File: GuiContainer.java From NotEnoughItems with MIT License | 4 votes |
/** * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { if (manager.mouseClicked(mouseX, mouseY, mouseButton)) { return; } super.mouseClicked(mouseX, mouseY, mouseButton); boolean flag = this.mc.gameSettings.keyBindPickBlock.isActiveAndMatches(mouseButton - 100); Slot slot = this.getSlotAtPosition(mouseX, mouseY); long i = Minecraft.getSystemTime(); this.doubleClick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouseButton; this.ignoreMouseUp = false; if (mouseButton == 0 || mouseButton == 1 || flag) { int j = this.guiLeft; int k = this.guiTop; boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize; if (slot != null) { flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries } int l = -1; if (slot != null) { l = slot.slotNumber; } if (flag1) { l = -999; } if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null) { this.mc.displayGuiScreen(null); return; } if (l != -1) { if (this.mc.gameSettings.touchscreen) { if (slot != null && slot.getHasStack()) { this.clickedSlot = slot; this.draggedStack = null; this.isRightMouseClick = mouseButton == 1; } else { this.clickedSlot = null; } } else if (!this.dragSplitting) { if (this.mc.thePlayer.inventory.getItemStack() == null) { if (this.mc.gameSettings.keyBindPickBlock.isActiveAndMatches(mouseButton - 100)) { managerHandleMouseClick(slot, l, mouseButton, ClickType.CLONE); } else { boolean flag2 = l != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)); ClickType clicktype = ClickType.PICKUP; if (flag2) { this.shiftClickedSlot = slot != null && slot.getHasStack() ? slot.getStack() : null; clicktype = ClickType.QUICK_MOVE; } else if (l == -999) { clicktype = ClickType.THROW; } managerHandleMouseClick(slot, l, mouseButton, clicktype); } this.ignoreMouseUp = true; } else { this.dragSplitting = true; this.dragSplittingButton = mouseButton; this.dragSplittingSlots.clear(); if (mouseButton == 0) { this.dragSplittingLimit = 0; } else if (mouseButton == 1) { this.dragSplittingLimit = 1; } else if (this.mc.gameSettings.keyBindPickBlock.isActiveAndMatches(mouseButton - 100)) { this.dragSplittingLimit = 2; } } } } } this.lastClickSlot = slot; this.lastClickTime = i; this.lastClickButton = mouseButton; }