Minecraft Executing if more than 500 entities
In the past, you would first reset a scoreboard, then make every item entity increase the scoreboard by 1. Nowadays, you can do it more lag-friendly and without a reset:
/execute store result score PlayerName scoreboardName if entity @e[type=item]
The execute
command's purpose is usually to do something conditionally or under different circumstances, but here you don't want to do anything for these item entities, you just want to know their amount. So you can omit run
and the chained command.
Now you have the amount of players in the scoreboard "scoreboardName" for the player "PlayerName" (doesn't even have to be a real player) and can do things with that number, for example killing all items if there are more than 500:
/execute if score PlayerName scoreboardName matches 500.. run kill @e[type=item]