How to use the /clear command correctly?

How to use the /clear command correctly? - Crop hacker silhouette typing on computer keyboard while hacking system

I used The following:

/clear @p (id of item ex:1) 8

I wanted to remove only a certain amount of items. Any ideas on how to remove only a few items rather than all of them?

Note: I am using 1.7.10 because I'm using a modpack.



Best Answer

So the syntax of the command is:

clear [player] [item] [data] [max-count] [dataTag]

So if you wanted to clear your own inventory you would say:

/clear

If you wanted to clear rappatic's inventory:

/clear rappatic

If you wanted to clear rappatic's inventory of stone blocks:

/clear rappatic minecraft:stone

If you wanted to clear rappatic's inventory of blue wool (here for data values)

/clear rappatic minecraft:wool 11

or for all types of wool:

/clear rappatic minecraft:wool -1

To clear rappatic's inventory of 12 stone blocks:

/clear rappatic minecraft:stone 1 12



Pictures about "How to use the /clear command correctly?"

How to use the /clear command correctly? - From above of crop anonymous male hacker typing on netbook with data on screen while sitting at desk
How to use the /clear command correctly? - From below of ethnic boy in hoodie controlling robot using panel while standing in light room
How to use the /clear command correctly? - Elderly white hair worker using machine



How do you use the clear command?

The coordinates for the desired area to be cleared will need to be obtained. To do this, players can either use the F3 key on Minecraft: Java Edition or the "show coordinates" option in Bedrock Edition to note the start and end points of where they want the fill command to clear.

How do you use the clear Area command in Minecraft?

You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators.

How do I completely clear terminal?

clr performs: clear all; close all; clc; This clears your workspace, closes all figures, and clears command window.



How To Use The CLEAR COMMAND | How To Use Commands




More answers regarding how to use the /clear command correctly?

Answer 2

From the minecraft wiki:

clear [player] [item] [data] [maxCount] [dataTag] 

For example: clear @p 1 -1 64 will remove all kinds of stone up to a stack (-1 in data means match only itemID, so stone, granite, diorite, etc will be removed).

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Anete Lusina, Sora Shimazaki, Vanessa Loring, Andrea Piacquadio