How do I kill mobs using /kill without them dropping loot?

How do I kill mobs using /kill without them dropping loot? - Photo of Woman Taking Notes

I have a spawn area I am hoping to make a safe haven, so I have a command block on a clock that kills each hostile mob type. This works to keep the place free of any hostile mobs, however every night I see rotten flesh, bones, arrows, and string everywhere.

I would like to add something to my command blocks so that they are killed without dropping loot. How can I accomplish this?

Note that I want mobs to drop loot generally elsewhere in the world, so /gamerule doMobLoot false will not do the trick for me. I'm hoping for a command that only applies to the mobs killed by the command block, and not anything else.



Best Answer

The DeathLootTable string tag can modify which loot table the mob will use when killed. The "empty" loot table will cause it to drop nothing:

1.12 and lower:

/entitydata @e[type=Zombie,r=40] {DeathLootTable:"minecraft:empty"}

1.13:

/execute as @e[type=zombie,distance=..40] run data merge entity @s {DeathLootTable:"minecraft:empty"}



Pictures about "How do I kill mobs using /kill without them dropping loot?"

How do I kill mobs using /kill without them dropping loot? - Top view of slogan Stop Killing Us on surface of square blackboard on black background
How do I kill mobs using /kill without them dropping loot? - Student Taking Photo of the Test Paper
How do I kill mobs using /kill without them dropping loot? - Free stock photo of adult, business, casual



How do you make mobs not drop loot?

How to Disable Mobs Dropping Loot on your Minecraft Server
  • Head over to your server Console or enter into your Minecraft Server.
  • Enter the command /gamerule doMobLoot false (ensuring to keep the upper case letters). This'll prevent all mobs from dropping items. ...
  • That's it!


  • Do mobs drop items when killed by other mobs?

    Most mobs have certain items that they may drop when killed. Some common drops, such as leather, don't always drop, but have a large chance (at least 50%, depending on the drop range) to do so. Some common drops, such as blaze rods, don't drop at all if the mob was not killed by the player.

    How do you kill specific mobs with kills?

    Kill Command Examples
  • If you don't want to kill yourself or any other player in the process of removing mobs from the world, type in \u201c /kill @e[type=! player] \u201d. ...
  • For example, the command \u201c /kill @e[type=! player,type=! ...
  • If you want to kill a specific type of mob, use the parameter \u201c @e[type=<mob_type> \u201d.


  • What is the cheat to kill mobs in Minecraft?

    Minecraft kill command Kills everything, including the player. But should you want to kill another player, use \u201c/kill <player>\u201d. And to kill a certain type of mob, \u201c/kill @e[type=mobType]\u201d.



    Kill Command Explained




    More answers regarding how do I kill mobs using /kill without them dropping loot?

    Answer 2

    You should teleport the entity into the void. That will drop the items, but in the void too.

    /tp @e[selector] ~ -100000 ~
    

    This will take a few gameticks to kill the mob, but with the amount of natural spawns, this does not matter.

    Answer 3

    I have a not so compact idea, but it will fit for your needs:

    1. First you will need to give a score for each item you don't need to be on ground. I added the r selector, the number depending of your spawn radius

      /scoreboard objectives add trash dummy - Add the scoreboard
      

    Now these command in a clock / repeating command block:

    /scoreboard players set @e[type=Item,r=50] trash 1 {Item:{id:"minecraft:bone"}}
    
    /scoreboard players set @e[type=Item,r=50] trash 2 {Item:{id:"minecraft:rotten_flesh"}}
    

    Explanation : Each type of item will have their own number in the scoreboard to diffetentiate them later. I wrote only some examples above. You can continue the list

    1. Now that all your "trash" has their own "recognize ID" just simply run this command in a repeating command block.

      /kill @e[score_trash_min=1,score_trash=#]
      

    Explanation : Where I put the # mark , you need to put the maximum number of item you put on your "kill list". So I pretend I choose 6 type of items to be erased, so I will put put 6 instead of #.

    Answer 4

    The old-fashioned way would be to build a structure that keeps mobs out (a fence is sufficient) and adequate lighting inside.

    Answer 5

    Give your self 2 command blocks, set at repeating. unconditional, no Redstone in one paste this: kill @e[type=minecraft:creeper,distance=..170]

    in the second one paste this: kill@e[type=minecraft:item,nbt{Item{id:"minecraft:gunpowder"}},distance=..170]

    -170 is how many blocks around the command block it will kill entities for, you must put the .. before the 170(or how every many blocks out you want to go.) this works in 1.18. you will need to replace creeper with what ever mob and replace gunpowder with that mobs specific drop. ex: for zombie it will be "minecraft:zombie" and "minecraft:rotten_flesh"

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Ivan Samkov, Brett Sayles, RODNAE Productions, Polina Tankilevitch