There are different kind of secret triggers in minecraft:
Entity movement
Living entities like animals and monsters can only move if a player is in a 32 block radius, this radius is a spheroidal box around the cow. By placing the a cow in a place where pistons keep pushing the cow back you can make a proximity detector.
This can be seen at:
Tripwire
If properly applied, tripwires are hard to see, this works the best if the tripwire is placed around the eye level in buildings, or at the feet in the outside world.
Hidden pressure place
Its also possible to make a pressure plate completely hidden, for example, stone pressure plates can be nicely hidden in a hallway that goes down, the following image demonstrates this:
Did you see the pressure plate at the end of the stair?
Block update detector based detection
Some blocks have a special property that they update when the player walks over them, for example, redstone ore blocks start glowing. This can be detected with a BUD to deliver a redstone signal. A simple implementation this looks like:
The item through a corner technique
Items can be pickup through the corners of the blocks, by making your player pass past such corner, you can detect it using a wooden pressure plate in combination with a torch.
The casual player technique
What if you didn't need to make a hidden trap? You could add a couple of iron doors in combination with buttons to your building, this way the player going through it will thrust the button to continue, and keeps pressing them to open the next door.
The trapped chest
By placing a large number of loot crates through your building, player will get blind opening chests, they will just open every chest to get a little loot. By making the trap have a trapped chest in combination with some delay, the player will suspect nothing.
The minecart in a corner
Like items, you can also interact with minecarts in corners, by combining this with a powered rail and a detector rail, you have a accurate corner touch detector.
Command blocks
If you are making a custom map, you can also use command blocks for this purpose. You can run the command testfor @a[r=4]
from the commandblock in a loop using a clock, then check the output using a comparator. If you want a other center then the command block, there are 2 ways that you can do:
- Use the @a selector with x, y, z argument:
testfor @a[r=4,x=X,y=Y,z=Z]
- Place an armorstand at the required location and use
execute @e[type=ArmorStand] ~ ~ ~ testfor @a[r=4]
, you can give it a name and address it that way if you use this trick in multiple locations.
Best Answer
You can use CommandStats to count the number of items in a player's inventory.
The
/clear
command will return an "AffectedItems" value equal to the number of items that were cleared. You can set the maximum amount to 0 to prevent items from being removed, which will then return the total number of items that player had in their inventory.This is also multiplayer-friendly since each player can have their own score and stat assigned, and
/execute
can be used to cause players to run commands to trigger their own stat.Prerequisites
Objective to store the "AffectedItems" value.
Set that to display on the sidebar.
CommandStat to apply to players, who will target their own "PaperCount" score when running commands that return an "AffectedItems" value. If new players are able to join at any time, you may need to run this on a clock.
In order for CommandStats to modify a target's score, that target must be tracked on the scoreboard prior. If new players are able to join at any time, you may need to run this on a clock.
Clock commands
The following must be run on a clock.
Cause players to clear 0 paper from their own inventories.
The player will then have a "PaperCount" score equal to the number of paper they had in their inventory.