• 1

    posted a message on 1.14.3 How to add potion effects to item?
    execute as @a[nbt={SelectedItem:{id:"minecraft:barrier",tag:{hello:1b}}}] run say world

    This command will let the executor say world when they are holding a barrier with that specific tag in main hand.

    And here is the command for getting that item.

    /give @s minecraft:barrier{hello:1b}


    For offhand, use Inventory with Slot -106(offhand slot).

    /execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:barrier",tag:{hello:1b}}]}] run say world
    Posted in: Commands, Command Blocks and Functions
  • 2

    posted a message on How do I detect if a player is still or moving??

    Player's motion, unlike other entities, is inaccurate most of the time unless they are jumping.


    Therefore, it is highly recommended to use other method to detect if the player is moving.

    You can store player's Pos[0], Pos[1], and Pos[2] into scoreboard in current tick, and compare it with what you store from the previous tick to see if the position had changed. (so 6 dummy scoreboard are need, 3 for storing current tick, 3 for storing previous tick).


    Or you can use other criteria(some of them are probably duplicate, so choose only what movement you want to detect):

    climb_one_cm

    crouch_one_cm

    fall_one_cm

    fly_one_cm

    horse_one_cm

    minecart_one_cm

    jump

    pig_one_cm

    sprint_one_cm

    swim_one_cm

    walk_on_water_one_cm

    walk_one_cm

    walk_under_water_one_cm

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on [Solved] Modify data from scoreboard
    execute store result entity @s <path> int 1 run scoreboard get <target> <scoreboard_obj>


    Damage is an int type value.

    What this command do is get the score from a <target>, then scale it to 1 and save into the path of @s where you specified.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on [Solved] /Execute on specific named item with enchants/colors

    execute as @a[nbt={SelectedItem:{id:"minecraft:iron_axe",tag:{display:{Name:'{"bold":true,"italic":true,"color":"dark_purple","text":"Test"}'}}}}] run say hi


    This is the one for your item/img above.


    give @s minecraft:iron_axe{display:{Name:'{"bold":true,"italic":true,"color":"dark_purple","text":"Test"}'}} 1


    And if I am not wrong, this is how you can get that item with this specific display name.


    Oh, and for enchants.

    Enchantments:[{lvl:1s,id:"minecraft:mending"}]

    This test for item with this enchant.

    execute as @a[nbt={SelectedItem:{id:"minecraft:iron_axe",tag:{Enchantments:[{lvl:1s,id:"minecraft:mending"}]}}}]


    And this test for both enchant and name.

    execute as @a[nbt={SelectedItem:{id:"minecraft:iron_axe",tag:{Enchantments:[{lvl:1s,id:"minecraft:mending"}],display:{Name:'{"bold":true,"italic":true,"color":"dark_purple","text":"Test"}'}}}}]


    You can detect only Name, only Lore, or both Name and Lore, the point is the value for Name/Lore or such string type nbts must be match exactly since those value are just a bunch of strings.


    A quick way to determine whether you should include the entire strings is to know if those nbts are string type, or if the value comes along has " " or ' ' or \" \" on both side, or if the text is green like the one on your screenshot.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Trouble With /execute

    If this is for singleplayer world, it should be fine. If not, the first @p and the last @p doesn't mean the same player, which might cause issue. Therefore, use @s to make the target consistent.


    /execute as @a[x=-421,y=5,z=124,dx=0,dy=0,dz=0] at @s run teleport @s ~ ~6 ~



    That sounds like a specific area rather than a specific block. These two are not the same.

    In case you are wondering the other one.


    /execute as @a at @s if block ~ ~-0.1 ~ minecraft:diamond_block run teleport @s ~ ~6 ~
    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Written Book Author Detector

    Clearing books that's not written by X is possible, but it's not that simple.


    Since I haven't tried it myself, I rather leave it for others to answer.



    By counting how many X's written book a player has, you will need somewhere to store the result, AKA a scoreboard, to store the count result of the book.



    A dummy scoreboard will do.

    /scoreboard objectives add countx dummy

    So you will have to use execute store result score <...> run clear <...> 0 to store the result of the count.

    Clear 0 wouldn't remove those books from player's inventory, and books written by X will have author nbt in the item.

    By adding author:"X" in the clear <data>, together you will be able to detect and store the amount of X's written book into a scoreboard.


    /execute as @a store result score @s countx run clear @s minecraft:written_book{author:"X"} 0
    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on How does the new /data modify argument work?

    Inventory[{Slot:103b}]

    And you have to be at least in version 1.14, otherwise it wouldn't work.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Position 2.34 to 2

    Use execute align

    executes a command after aligning the current position to the block grid (rounding down)


    So in your case,

    execute at @a align xyz run summon <...>
    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Command Help minecraft 1.14

    execute at <trident> at <!player,!trident,!lightning_bolt,distance=1..10> run summon <lightning_bolt> ~ ~ ~

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Using a command block to teleport a player ONLY if they have a specific item in their inventory. 1.13.2

    Hold that item in your main hand.

    Use data get entity @s SelectedItem to get the nbts of that item, and put those specific nbts into the command below.


    execute as @a[nbt={Inventory:[{id:"minecraft:filltherest",tag:{nbts:1b}}]}] run teleport <fill the rest...>

    Posted in: Commands, Command Blocks and Functions
  • To post a comment, please or register a new account.