Some of you may not know, but you can clear dropped Items, by doing this command:
/kill @e[type=Item] if you hook it up to a clock, all dropped items will disappear almost instantly.
my question is how do I kill Items EXCEPT a certain Item.
If that's not possible, how do I detect an certain Item then.
/kill @e[type=Item] if you hook it up to a clock, all dropped items will disappear almost instantly.
my question is how do I kill Items EXCEPT a certain Item.
If that's not possible, how do I detect an certain Item then.
5
You can use scoreboard to give a certain Item a score.
For example (for killing specific items!):
- set up a scoreboard dummy: /scoreboard objectives add Kill dummy
- make a clock with: /scoreboard players set @e[type=Item] Kill 1 {Item:{id:ITEM_NAME_HERE,Damage:DAMAGE_VALUE_HERE,tag:{ANY_ADDITIONAL_TAGS_HERE}}}
(Note that you can just leave out "Damage" and "tag" when you don't need them)
- add to the same clock: /kill @e[type=Item,score_Kill_min=1]
For example (for excluding specific items! This is what you want I think):
- set up a scorebord dummy: /scoreboard objectives add NoKill dummy
- make a clock with (IN THIS SPECIFIC ORDER, FILL CLOCKS WORK BEST):
> /scoreboard players set @e[type=Item] NoKill 0
(For each item, add this command:)
> /scoreboard players set @e[type=Item] NoKill 1 {Item:{id:ITEM_NAME_HERE,Damage:DAMAGE_VALUE_HERE,tag:{ANY_ADDITIONAL_TAGS_HERE}}}
> /kill @e[type=Item,score_NoKill=0]
For example (for killing specific items!):
- set up a scoreboard dummy: /scoreboard objectives add Kill dummy
- make a clock with: /scoreboard players set @e[type=Item] Kill 1 {Item:{id:ITEM_NAME_HERE,Damage:DAMAGE_VALUE_HERE,tag:{ANY_ADDITIONAL_TAGS_HERE}}}
(Note that you can just leave out "Damage" and "tag" when you don't need them)
- add to the same clock: /kill @e[type=Item,score_Kill_min=1]
For example (for excluding specific items! This is what you want I think):
- set up a scorebord dummy: /scoreboard objectives add NoKill dummy
- make a clock with (IN THIS SPECIFIC ORDER, FILL CLOCKS WORK BEST):
> /scoreboard players set @e[type=Item] NoKill 0
(For each item, add this command:)
> /scoreboard players set @e[type=Item] NoKill 1 {Item:{id:ITEM_NAME_HERE,Damage:DAMAGE_VALUE_HERE,tag:{ANY_ADDITIONAL_TAGS_HERE}}}
> /kill @e[type=Item,score_NoKill=0]
You sir are just the best
What if he is allready using scoreboards for another system and he needs to give an item that needs to be deleted the score of 1?
Dummy scoreboards don't interfere with eachother... if you're already using a scoreboard named Kill/NoKill, just use different names.
Bump
