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.
Fixing your command
Your problem here is that you are mixing up target selector arguments with data tags, and then some minor mistakes.
Target selector arguments, such as team=Moderators
(lowercase!) are placed in square brackets ([]
) directly with the target selector, such as @a
or @p
. They come in the form key=value
, with a predefined set of valid keys.
Data tag matching on the other hand is looking directly at the NBT data of an entity, such as ActiveEffects
. They are placed within curly brackets ({}
) and come in the form of key:value
. Only a fairly small subset of commands are capable of using data tags at all.
Your command in this case should be
/testfor @a[team=Moderators] {ActiveEffects:[{Id:21b,Amplifier:20b}]}
Fixing your setup
However, your whole idea is rubbish, if I may be so blunt. It looks like you are testing if there are moderators with Health Boost 20, then invert the signal and re-apply health boost. The first problem is that no moderator gets health boost unless none of the moderators currently have health boost. Actually negating data tag matching requires assigning scoreboard values based on the data tag.
For most effects, reapplying the effect all the time works just fine, e.g. run
/effect @a[team=Moderators] <effect> 1 <amplifier> true
on a fast clock (setblock/fill clock!) works just fine, and is actually way less resource-intensive than a redstone lag-machine with torches, comparators and whatnot.
However, there is an issue with reapplying Health Boost since it will reset your current health to 10 hearts all the time. If you want to reapply the effect only when needed, using /testfor
, comparators and redstone is still not a good idea. Instead, you should translate the data tag into a scoreboard value which can be used in a target selector. To do that, start by creating a scoreboard objective:
/scoreboard objectives add hasEffect dummy
Create a fill/setblock clock and put the following commands in order:
/scoreboard players set @a[team=Moderators] hasEffect 0
/scoreboard players set @a[team=Moderators] hasEffect 1 {ActiveEffects:[{Id:21b,Amplifier:20b}]}
/effect @a[team=Moderators,score_hasEffects=0] minecraft:health_boost 9999 20 true
Best Answer
To give a custom potion to a player you can use the command:
Replace <selector> with whatever you are giving it to, <id> with the numerical ID for what you want, and <duration> with the duration in ticks. See here for a list of potion IDs.
If you want multiple effects on one potion you can duplicate
{Id:<id>,Duration:<duration>}
within its list multiple times, separated with commas.