Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PREREQUISITES:
- Objective to hold the result from AffectedBlocks.
- /scoreboard objectives add FoundSpawner dummy
- AffectedBlocks trigger to apply to player. May need to be on a clock if new players can enter. Players running commands will set their own "FoundSpawner" score equal to the number of 'affected blocks', when applicable.
- /stats entity @a set AffectedBlocks @a[c=1] FoundSpawner
- In order for CommandStats to modify a target's score, they must be tracked prior. This may also need to run on a clock.
- /scoreboard players add @a FoundSpawner 0
- CLOCK:
- Image reference: http://i.imgur.com/BfPQWpH.png
- 1. Cause players to run a command that will update their own AffectedBlocks score, being /testforblock. This checks for a specific spawner, setting the player's "FoundSpawner" score to 1 if found.
- /execute @a ~ ~ ~ testforblock ~ ~-1 ~ minecraft:mob_spawner -1 {SpawnData:{id:"Zombie"}}
- 2. Conditional. If /execute was successful, the player would logically have a "FoundSpawner" score of 1. You'd then target players with that score, which would only be those that had a zombie spawner beneath them. The benefit of using conditional here is to prevent the selector from being processed unnecessarily, but it doesn't necessarily have to be conditional.
- /execute @a[score_FoundSpawner_min=1] ~ ~ ~ say Found zombie spawner.
- 3. Second cycle, checking for a skeleton spawner. Their score is set to 0 if it wasn't found, so works without conflict from the previous set of commands.
- /execute @a ~ ~ ~ testforblock ~ ~-1 ~ minecraft:mob_spawner -1 {SpawnData:{id:"Skeleton"}}
- 4. Conditional. Same as #2, the commands to perform based on the success.
- /execute @a[score_FoundSpawner_min=1] ~ ~ ~ say Found skeleton spawner.
- 5. Third cycle (spider spawner).
- /execute @a ~ ~ ~ testforblock ~ ~-1 ~ minecraft:mob_spawner -1 {SpawnData:{id:"Spider"}}
- 6. Conditional. Success command.
- /execute @a[score_FoundSpawner_min=1] ~ ~ ~ say Found spider spawner.
- SPAWNERS:
- Copy/paste spawners for testing:
- Zombie: /setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie"}}
- Skeleton: /setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Skeleton"}}
- Spider: /setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Spider"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement