net.minecraft.inventory.container.ClickType Java Examples

The following examples show how to use net.minecraft.inventory.container.ClickType. 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: AutoTotem.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void onUpdate() {
	if (this.isToggled()) {
		if (mc.player.getHeldItemOffhand().getItem() == Items.TOTEM_OF_UNDYING) return;
		
		/*Inventory*/
		for (int i = 9; i < 44; i++) {
			if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
				mc.playerController.windowClick(0, i, 0, ClickType.PICKUP, mc.player);
				mc.playerController.windowClick(0, 45, 0, ClickType.PICKUP, mc.player);
				return;
			}
		}
		
		/*Hotbar*/
		for (int i = 0; i < 8; i++) {
			if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
				//int oldSlot = mc.player.inventory.currentItem;
				mc.player.inventory.currentItem = i;
				mc.player.connection.sendPacket(new CPlayerDiggingPacket(
						Action.SWAP_HELD_ITEMS, BlockPos.ZERO, Direction.DOWN));
				//mc.player.inventory.currentItem = oldSlot;
				return;
			}
		}
	}
}
 
Example #2
Source File: SlotDummy.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public ItemStack slotClick(ContainerExtended container, PlayerEntity player, int button, ClickType clickType) {
    ItemStack held = player.inventory.getItemStack();
    boolean shift = clickType == ClickType.QUICK_MOVE;
    slotClick(held, button, shift);
    return ItemStack.EMPTY;
}
 
Example #3
Source File: SawmillScreen.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void handleMouseClick(Slot slotIn, int slotId, int mouseButton, ClickType type)
{
    super.handleMouseClick(slotIn, slotId, mouseButton, type);
    this.recipeGui.slotClicked(slotIn);
}
 
Example #4
Source File: SlotHandleClicks.java    From CodeChickenLib with GNU Lesser General Public License v2.1 votes vote down vote up
public abstract ItemStack slotClick(ContainerExtended container, PlayerEntity player, int button, ClickType clickType);