Advertisement
Skylinerw

@GamePhysics - Detecting Player Inventory

Jun 9th, 2014
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. PREREQUISITES:
  2.  
  3. /scoreboard objectives add hasBONE dummy
  4.  
  5. MECHANISM:
  6.  
  7. http://i.imgur.com/VqqbTjj.png
  8.  
  9. COMMANDS:
  10.  
  11. 1. Sets player scores to 0 for 'hasBONE'. Required to do it this way since players are not automatically tracked in 1.8, and scores are being reset at the end.
  12.  
  13. /scoreboard players set @a hasBONE 0
  14.  
  15. 2. Sets player scores to 1 for 'hasBONE' if they have the bone in their inventory. This separates those who has bones from those who don't.
  16.  
  17. /scoreboard players set @a hasBONE 1 {Inventory:[{id:minecraft:bone,tag:{display:{Name:"Custom Name"}}}]}
  18.  
  19. 3. Gives players the bone if they don't have it.
  20.  
  21. /give @a[score_hasBONE=0] minecraft:bone 1 0 {display:{Name:"Custom Name"}}
  22.  
  23. 4. Sets item entities 'hasBONE' score to 1 if their item is the custom bone.
  24.  
  25. /scoreboard players set @e[type=Item] hasBONE 1 {Item:{id:minecraft:bone,tag:{display:{Name:"Custom Name"}}}}
  26.  
  27. 5. Kills those items that has that score (so only the special bones will be killed)
  28.  
  29. /kill @e[type=Item,score_hasBONE_min=1]
  30.  
  31. 6. And resetting the 'hasBONE' objective to prevent clutter from item entities being tracked.
  32.  
  33. /scoreboard players reset * hasBONE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement