The simplest way to handle this is with a gamerule. If you don't want any mobs bothering you in your creative world, just turn off spawns with /gamerule doMobSpawning false
. No mobs will spawn, which will allow you to have a quiet creative world, free from cows, pigs, sheep, chickens, slimes, etc, while also allowing yourself to do science on mobs at will. Mobs will spawn only when you want them to.
If you're really committed to the idea of doing this with /kill
, however, you can do this one of two ways. You can set up individual command blocks to kill each type of mob, which might be a small set of command blocks if your main problem is slimes.
Alternatively, you can use the methods described in this answer to select exceptions. It uses a scoreboard to set a score for all entities to 1, and simultaneously sets the score of all exceptions to 0. From there, you can select the set of all mobs excluding any exceptions you want with @e[score_select_min=1]
.
The simplest and most flexible way to keep slimes from bothering you though is to turn off mob spawning altogether.
The coordinates can be added as target selector arguments, i.e. inside the @e[...]
, using the x
, y
, and z
arguments, combined with r
to set a maximum radius. Note that Tilde notation is not allowed for this, you need the absolute coordinates.
Placing an enchanted item in an Item Frame has to be done all at once, since the entitydata is running on the Item Frame, not on the item that is in it. This is done by setting the Item
tag of the item frame to a valid compound NBT structure for an item, such as
{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}
for a Sharpness I Stone Sword.
Overall, the command you want to be running might look like:
entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=2] {Item:{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}}
Be careful regarding the closing parentheses.
Best Answer
You can add a scoreboard tag to the item frame when you spawn it in, so your kill function looks like this:
kill @e[type=item_frame,tag=killable]
with killable being the tag. If a player is running the command/you aren't spawning it in you can kill one within a certain radius:
kill @e[type=item_frame,distance=..1]
which will kill any item frames within one block.
Edit: I saw your other question and here's the summon command you would use:
summon minecraft:item_frame -1242 58 219 {Facing:2,Tags["killable"]}
Edit 2: I just remembered that a tag is not unique: if you have multiple entities tagged as 'killable' it will kill all of them. Instead, use a customName:
summon minecraft:item_frame -1242 58 219 {Facing:2,CustomName:"killableFrame"}
kill @e[name=killableFrame]