• 2

    posted a message on Is there a way to detect if a player is sneaking?

    Here's a list of all the stat types: https://minecraft.gamepedia.com/Statistics#Statistic_types_and_names

    and right below that is a list of all the custom stats.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on rail system -execute if- logic isn't working(?) 1.14.4
    But I checked it and apparently it stores the display name tag for items exactly as you enter it.

    The command will be able to detect the value but it won't be displayed in-game. The reason is that the value has to be stored as a string. And to be a string, it needs to have a pair of double-quotes around it. If you use Name:"stick", the game will store that value as stick. But if you use Name:"\"stick\"", the game will store that value as "stick" (which is the correct format). And you need to "escape" the inner pair of double quotes because the game can't store a string inside another string. I just wanted to explain that so anyone reading this knows why the backslashes are required.


    Anyway, back to the original problem. The NBT data should be inside the nbt tag in the selector. Here is the correct version:

    /execute positioned -630 62 348 if entity @p[distance=..7,nbt={Inventory:[{id:"minecraft:name_tag",tag:{display:{Name:'{"text":"substation"}'}}}]}]

    Also, I assumed that the nametag was renamed using an anvil so I changed the name format to '{"text":"substation"}' because that's the format anvils use. You can change it if you didn't use an anvil.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on rail system -execute if- logic isn't working(?) 1.14.4

    also im not sure you can just put "text" for a JSON string correct me if I'm wrong but minecraft stores it as '{"text":"substation"}'

    The JSON formatting is optional. You can use plain text but it has to be stringified (Name:"\"someName\"").

    Posted in: Commands, Command Blocks and Functions
  • 2

    posted a message on Is there a way to detect if a player is sneaking?

    The scoreboard system has some built-in criteria for detecting actions like walking, sprinting, jumping, sneaking, etc.


    Create an objective like this:

    /scoreboard objectives add sneaking minecraft.custom:minecraft.sneak_time

    The value of this objective will increase every time the player sneaks. Now all you need is a repeating command block with the detection command:

    /execute as @a[scores={sneaking=1..}] run say sneaking

    and a chain command block that will reset the value:

    /scoreboard players reset @a[scores={sneaking=1..}] sneaking
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on I'm struggling with making a shop.

    You need to store the amount of string the player has, into a scoreboard objective so you can test for a range.


    Create an objective:

    /scoreboard objectives add string dummy

    Store the number into the objective:

    /execute as @a store result score @s string run clear @s string 0

    And now you can use that objective like this:

    /clear @a[scores={string=16..}] string 16
    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Making a custom named gold nugget, "Coins", into in-game currency for mini-game map.

    The total amount is stored in the Coins objective of the fake player global. So you should decrease global's objective instead of the player's objective:

    /execute if score global Coins matches 5.. run give @p minecraft:iron_sword
    /scoreboard players remove global Coins 5
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Making a custom named gold nugget, "Coins", into in-game currency for mini-game map.

    I thought the fourth command block had something to do with the scoreboard, my bad.

    It does. It displays the value of the temp objective in the chat. Ptolemy2002's system uses two objectives, temp, and coins. You need to create those two objectives before running the system if you haven't already.

    /scoreboard objectives add coins dummy
    /scoreboard objectives add temp dummy

    I manually set the value of my temp objective to 1 and ran the fourth command (see included screenshot).

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Kill Oak Fences
    /kill @e[type=minecraft:item,nbt={Item:{id:"minecraft:oak_fence"},OnGround:1b}]
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to summon a mob in unloaded chunks?

    Are these chunks predetermined?

    if so, you can keep them loaded using /forceload.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Making a custom named gold nugget, "Coins", into in-game currency for mini-game map.
    Is the fourth command block suppose to show up as a scoreboard, or do I have to set up a scoreboard dummy before running this chained command?

    What do you mean by "show up as a scoreboard"?


    I tested the command and got this output: MegaCrafter10 Collected 1 coins.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Merge Villager Data to Give Them A Trade

    Like this:

    /execute as @e[type=villager,tag=Leatherworker] run data merge entity @s {Offers:{Recipes:[{buy:{id:emerald,Count:1},buyB:{id:rotten_flesh,Count:4},sell:{id:leather,Count:1},maxUses:9999999}]}}
    Posted in: Commands, Command Blocks and Functions
  • 2

    posted a message on Command Block perimiter problem
    Quote from aeuxdeus2019»

    Alright, i've tried to create a perimiter of 400 blocks in a circle, where inside of those 400 blocks u are in adventure mode, and the moment u go outside the radius you're switched to survival.


    this is what i have to far.


    gamemode adventure @s[x=-400,y=400,z=-400,dx=400,dy=400,dz=400,gamemode=survival]


    now i have no commandblock experience at all, how would u do such a thing.


    As others have said, you need to change @s to @a. Also, the dx, dy, and dz arguments don't use relative coordinates. x, y, and z are the coordinates of one corner of the area, and the dx, dy, and dz are the width, height, and length of the area. More info about these arguments: https://minecraft.gamepedia.com/Commands#Selecting_targets_by_volume.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Making a custom named gold nugget, "Coins", into in-game currency for mini-game map.

    Your NBT data is wrong. You don't need the tag:{} because everything that you type in between the first pair of curly brackets is already inside tag:{}. Also, your name and lore have to be stringified:

    gold_nugget{display:{Name:"\"Coin\"",Lore:["\"Dropped by mobs in return for rewards at the shop.\""]}}

    ^ the format has to match the format you used in your /give command when you generated the gold nugget. For example, if you used Name:'{"text":"Coin"}', you have to use that format instead.


    The id is already specified here: run clear @s gold_nugget. So there is no need to include id:"minecraft:gold_nugget" and the Count is not needed.


    Your command should look like this:

    /execute as @a store result score @s temp run clear @s gold_nugget{display:{Name:"\"Coin\"",Lore:["\"Dropped by mobs in return for rewards at the shop.\""]}}


    is the "temp=1.." suppose to be like this, or is there something that I have to change with the two dots

    The two dots are supposed to be like that. In this case, it means that the value has to be greater or equal to 1.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Give players effects when in a certain radius of mobs

    Because you want to execute the command from every zombie in the world, you don't need the distance argument in the first selector. Instead, you can specify a distance if the selector used by /effect. You also need to specify that the command should be executed at the location of the zombie. Otherwise, the distance between the command block and the player will be used. To specify that, I used the at keyword.

    /execute at @e[type=minecraft:zombie] run effect give @a[distance=..3] minecraft:weakness 3 0
    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Merge Villager Data to Give Them A Trade

    The syntax is:

    /data merge <entity|block|storage> <the entity, block or storage> <NBT to merge>

    However, using merge will overwrite every other trade the villager has (unless you include all the other trades in your merge command). A better way of doing this is using modify:

    /execute as @e[type=villager,tag=Leatherworker] run data modify entity @s Offers.Recipes append value {buy:{id:emerald,Count:1},buyB:{id:rotten_flesh,Count:4},sell:{id:leather,Count:1},maxUses:9999999}
    Posted in: Commands, Command Blocks and Functions
  • To post a comment, please or register a new account.