ItemStack stack; if (player.inventory.hasItemStack(variant)) { stack = player.inventory.getStackInSlot(player.inventory.getSlotFor(variant)); } else { stack = craftItemFromInventory(player, variant);
itemstack.setCount(itemStackSize - 1); if (itemstack.getCount() <= 0) { int index = player.inventory.getSlotFor(itemstack); player.inventory.setInventorySlotContents(index, ItemStack.EMPTY); itemstack.setCount(itemStackSize - 1); if (itemstack.getCount() <= 0) { int index = player.inventory.getSlotFor(itemstack); player.inventory.setInventorySlotContents(index, null);
default void onRightClick(World world, EntityPlayer player, EnumHand hand) { if (world.isRemote) return; ItemStack belt = player.getHeldItem(hand); if (!shouldUse(belt)) return; if (player.isSneaking()) { boolean changed = false; for (ItemStack stack : player.inventory.mainInventory) if (stack.getItem() == ModItems.PEARL_NACRE) if (ItemNBTHelper.getBoolean(stack, "infused", false)) if (addPearl(belt, stack.copy())) { stack.shrink(1); changed = true; } if (changed) { ItemNBTHelper.setInt(belt, "scroll_slot", -1); player.playSound(ModSounds.BELL_TING, 1f, 1f); } } else if (ModKeybinds.pearlSwapping.isKeyDown()) { int scrollSlot = ItemNBTHelper.getInt(belt, "scroll_slot", -1); if (scrollSlot == -1) return; ItemStack output = removePearl(belt, scrollSlot); if (output.isEmpty()) return; player.addItemStackToInventory(output); ItemNBTHelper.setInt(belt, "scroll_slot", Math.max(scrollSlot - 1, 0)); } if (player instanceof EntityPlayerMP) PacketHandler.NETWORK.sendTo(new PacketSetScrollSlotClient(player.inventory.getSlotFor(belt), -1), (EntityPlayerMP) player); }
boolean isWater = destBlock == Blocks.WATER || destBlock == Blocks.FLOWING_WATER; if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) { if (!InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().provider.isNether()) { return state.setStatus(MovementStatus.UNREACHABLE); ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER); if (InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY))) { ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY); if (ctx.player().motionY >= 0) { return state.setInput(Input.CLICK_RIGHT, true);
PacketHandler.NETWORK.sendToServer(new PacketSetScrollSlotServer(player.inventory.getSlotFor(heldItem), scrollSlot));
this.toolSet = new ToolSet(player); this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(baritone.getPlayerContext(), false); this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.get() && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.provider.isNether(); this.canSprint = Baritone.settings().allowSprint.get() && player.getFoodStats().getFoodLevel() > 6; this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();