While creating player interface on a server, I have a place where the players can put items in a chest to get a reward. However, If they place other items in the chest it will still give them the reward, because I'm using comparators. Is there a way I can block them from placing anything other than the items I want them to get a reward for in the chests?

2 Answers 2


You can't, but you can make the counter increment for only a certain type of items:

the contraption

The redstone part, as visible, consists of a AND gate with a clock as one input and a comparator as the second input, with it's output leading to the dropper (under the chest).

The command part consists of four command blocks, the first (leftmost) one set to Repeat Need Redstone and all the others to Chain Always Active. Here are the commands, explained, from left to right:

  1. /scoreboard objectives add itemOnGround dummy

    • Explanation:

      /scoreboard objectives add   % create a new scoreboard objective (variable)
      itemOnGround                 % named "itemOnGround"
      dummy                        % and make it self-standing
  2. /scoreboard players set @e[type=Item,c=1,r=4] itemOnGround 1 {Item:{id:minecraft:stone}}

    The above command will check for an item that has an id minecraft:stone. Change that to your preferred item ID. You can as well adjust the r value.

    • Explanation:

      /scoreboard players set   % set scoreboard objective (variable)
      @e[type=Item,c=1,r=4]     % for the 1 closest 'Item' entities under 4 blocks away 
      itemOnGround              % named 'itemOnGroud'
      1                         % to 1
      {Item:{id:minecraft:stone}}       % with 'Item' selecting only dropped items with id 'minecraft:stone'
  3. execute @e[score_itemOnGround_min=1] ~ ~ ~ /say hello

    Runs the command /say hello each time there is a stone item (less than 4 blocks away) on the ground. Replace /say hello with any command you'd like to run for each item.

    • Explanation:

      execute                         % for all   
      @e[score_itemOnGround_min=1]    % entities with a score of 'itemOnGround' bigger than 1  
      ~ ~ ~                           % run at their coordinates
      /say hello                      % the command '/say hello'   
  4. /kill @e[score_itemOnGround_min=1]

    Just kills (deletes) all already counted items, so they don't get counted twice. Doesn't kill other items. Explanation is trivial here.

Update: Since it may seem complicated, I created a one-command version, rewarding you by saying "hello" for a stone block item, for you to try it out. You can copy it from here (pastebin) (paste into command block and power it. Do not move when running the command!!).

Old solution:

You can block any other items getting the player points by placing hoppers under the chest, in a way blocking all items other than the preferred ones to the "score updater":

hopper stuff (source)

Then, if your award item is 64-stackable, place 22 of it into the topmost hopper, if 16-stackable, place 5 (one in each slot): 1

If a container above the hopper contains any other item then your, it'll remain in the container; else, it'll get transported down the hoppers into the downmost container.

Connect a comparator to that container (chest) to get your item score.

1: non-stackable items can't be detected so.

  • 1
    Might want to reword this as it assumes a max stack size of 64 for the item, 16 stack size (like regular eggs) will need a LOT less items, and unstackable items do NOT work. If this rewards chest will be used a lot more than the "disposal" chest's capacity, there needs to be a way to destroy the items. Have the "disposal" chest instead be hoppers not connecting to that redstone torch so the item travels slowly to a dropper (NOT dispenser) pointing at a lava source block... sealed away, of course, to prevent issues (and while dropper has items, spit all into lava). [continued] Jan 3, 2017 at 20:00
  • 1
    [continued from previous] Could also have it, if Command Blocks are enabled, place one to be triggered by the redstone torch (have it replace the "disposal" chest with another that uses the json argument to make sure it is emptied. Jan 3, 2017 at 20:08
  • @KatieakaCtrl-Alt-Cuteness thanks for pointing out the 16-stackable items. As to the problems you pointed out, I think I found an alternative, more reliable solution, so I'll ping you when I get it.
    – user143228
    Jan 3, 2017 at 20:12
  • 1
    You're welcome, user<pi> :) Final option that also uses Command Blocks (multiple): If correct dropped item with correct stack size (preventing loss of items) is around so-and-so location, remove them and then spawn the reward in. Works to save space if the Command Blocks resides in the "server's" spawn chunks (as that means they will ALWAYS be loaded and able to execute their code), Jan 3, 2017 at 20:15
  • 1
    @ user<pi> ... (easier to type this way).... Of course, you must detect what the dropped item's stack count is in the JSON data. If you don't, you could match a stack of matching dropped instead of just a single dropped one in the command blocks. Jan 3, 2017 at 20:29

If I understand correctly, you are not using any plugins that could help you.

To do it in normal Redstone, just place hoppers underneath the chest to take the items out automatically. After that, make an item sorter (see Minecraft Wiki: Hoppers) and test the output with your comparator only after the sorting of the specific items.

(You can also give the wrong items back if needed)

  • I'm not using any plugins for this specifically, but if there is a plugin that would do this I would rather use that. I was hoping to not have to build an item sorter so that it would not take up as much space
    – MrSeaSlug
    Jan 3, 2017 at 14:08
  • 1
    I'm sorry but I don't know any plugins that would do it like you want it. I'd suggest to take a look at user3.14159265359's answer, he explained better what I had in mind.
    – user175938
    Jan 3, 2017 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .