Mob-Only-Allowed Barriers
I'm looking for a solution to solve my problem...
I am currently in the process of creating a Custom Map, called 'Monster Troubles', where (at least) 2-4 players defend their 'house' from being destroyed.
For the mobs to completely destroy the house, one just has to step on a Gold Block where a trigger will occur - then Game Over.
But, some of you may already see a problem here: anyone/anything can trigger the Game Over Sequence.
Which is a big problem, hence why I need Mob-Only-Allowed invisible barriers to surround the Gold Block (and surrounding area).
If anyone has a solution to this and would share, I'd appreciate that greatly.
Thanks
(Note: Focus on the Gold Block surrounded by double_stone_slab's - that's the Game Over Trigger)
(Secondary Note: The house and cave are aligned with each other, with invisible barrier blocks [minecraft:barrier] - hence why it looked a bit strange.)
Solution 1:
The solution is not to construct a player-proof barrier, but to make the end game trigger only respond to mobs. I presume that you are using command blocks. Put this command in a command block:
execute @e[type=Zombie] ~ ~ ~ testforblock ~ ~-1 ~ minecraft:gold_block
Set the command block to repeat mode, unconditional, and always active. Put a comparator facing out of the command block. When a zombie stands on a gold block, the comparator will activate until it steps off. If there is more than one zombie, then the command will activate for any zombie. It does not activate for players or other mobs.
Then, just add a command block for every monster in the game.
Alternatively, if you want to command to be able to be triggered by any entity apart from players, simply use this command instead:
execute @e[type=!Player] ~ ~ ~ testforblock ~ ~-1 ~ minecraft:gold_block
Tested and working in Minecraft 1.11.2