• 0

    posted a message on How to untame a cat (or any other animal) in MC15.2?

    /data merge entity (entity) {CustomName:"\"NAME\""}



    Indeed it changes the animal custom name, but it's still tamed by the same user. Or did I miss something?

    https://minecraft.fandom.com/wiki/Taming

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to untame a cat (or any other animal) in MC15.2?

    Thanks for the reply Megacrafter.

    I've made some similar experiments since my initial post, with the same conclusions, unfortunately :/

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to untame a cat (or any other animal) in MC15.2?

    I'm trying to programmatically "un-tame" a cat using the `data set` command. According to an Arqade answer, you just have to remove the `OwnerUUID` property of the animal NBT data. I tried the following commands with no success:


    /data modify entity 71cfdc75-9cfa-4989-be66-3f481ed9baa7 OwnerUUID set value ""
    /data remove entity 71cfdc75-9cfa-4989-be66-3f481ed9baa7 OwnerUUID


    In both cases, the command seems successful, with a message saying the entity was modified. But there was no observable change and the target animal remains associated with the same OwnerUUID.


    Any suggestion to untame an animal in MC15.2?

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Block Movement/Dectection

    My own two cents--you can also try setting the Motion attribute of an armor stand to make it move:


    /data modify [email protected][tag=creeperStand] Motion set value [1d,0d,0d]


    Unfortunately, with this solution you have to specify the Cartesian coordinates of the motion vector, and AFAIK you cannot make it move relative to the player's facing direction.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to execute command if mob is touching water

    All that sounds really interesting. Thank you for sharing this!

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on execute a command when player walks on a specific cordinates
    Quote from TNTQc»

    But in my case, it doesn't matter, since my setblock command sets a redstone block that triggers a fill clock to another system.



    🎓

    Indeed! At the risk of sounding pedantic , in CS we say such operation is idempotent: "[it] can be applied multiple times without changing the result beyond the initial application"






    More seriously, I assume your goal was to trigger other command blocks execution with that redstone block. Could you tell me a little bit more about that or share a screenshot of such design? As I said previously, I'm new to all of this, and I would be curious to see how we can handle control structures or alternate branches of execution with Minecraft commands and command block chains.


    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to count entities in a given area [1.14]?
    Quote from Megacrafter107»

    [...] I noticed the redstone signal strength did not match my entity count either.



    Thank you for having taken the time to test that.


    On my side, I noticed I can have an output signal strength matching the entity count if I use "execute as" and if the execute statement actually runs a command:


    --ok--
    execute as @e[type=villager,distance=..20] run me ""
    execute as @e[type=villager,distance=..20] run execute if entity @s  
     
    --not ok--
    execute if @e[type=villager,distance=..20]
    execute as @e[type=villager,distance=..20]
    execute as @e[type=villager,distance=..20] run


    I suspect the output value is the sum of the output values of the commands: if you run for 5 entities a command returning 1, the result is 1+1+1+1+1 and that is what reflects the output signal strength. It is somewhat confirmed by the contrived command below:


    [/p]
    [p]execute as @e[type=villager,distance=..20] run execute if entity @s[tag=T][/p]
    [p]


    Here, the nested `execute` command is run once for each villager in the range. And that nested command will return either 0 or 1 depending if the villager is tagged. In my tests, the result value of the outer `execute` command is the number of tagged villagers.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to execute command if mob is touching water

    ... and I suspect you can't detect both water and waterloged blocks in only one command. Or can you?

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Command noob here. I need help with a kinda simple command.

    Will it work if the melon slice is in an unloaded chunk?
    I don't think so, but I can't tell for sure: I'm rather new to MC commands myself ;)

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How far can go a fireball?

    I've created a fireball with the following command:


    /summon minecraft:fireball ~ ~ ~ {power:[0d,3d,0d],direction:[0d,0d,0d]}



    It is currently over 45000 in the Y direction (vertical axis) and still progressing--and way beyond the one minute lifespan before despawn mentionned in the wiki.


    Is there a limit on the distance an entity can travel (in Y as well as X/Z direction)? Can I limit the lifespan of my fireball so it will auto-destruct after having traveled a given distance and/or time?

    Posted in: Discussion
  • 0

    posted a message on Command noob here. I need help with a kinda simple command.

    Running this from the chat console should bring you to your melon slice:


    /execute at @e[type=item,nbt={Item:{id:"minecraft:melon_slice"}}] run tp @s ~ ~ ~


    The `execute at` statement changes the current location (`~ ~ ~`) for the command to the location of a melon slice. Then, it runs the `tp` command that will bring you (`@s`) at that location.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to execute command if mob is touching water
    Quote from Megacrafter107»


    /execute as @e[tag=mob] at @s if block ~ ~ ~ water run <command>


    Would that work with waterlogged blocks?

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on execute a command when player walks on a specific cordinates

    Thank you for having posted the solution!

    Amusingly enough, I was bitten myself by the `as`/`at` clause of the execute command yesterday. And despite that, I didn't pinpoint a similar issue in your command. I definitively need a lot more practice with Minecraft commands!

    Actually, in your case, I suspect the following commands would do the trick too:

    execute as @a[x=-160,y=75,z=164,distance=..1] run setblock -153 75 165 redstone_block
    execute if entity @a[x=-160,y=75,z=164,distance=..1] run setblock -153 75 165 redstone_block


    According to my (very recent) knowledge in that matter, I would favor the `if entity` version: I think the `as`/`at` versions may be less efficient, since they may potentially run the `setblock` command several times, once for each matching entity. Or am I wrong?

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to implement conditional control structure with command blocks?
    Quote from s_leroux»

    I still wonder however if we can emulate more complex control flows by spawning blocks or "passing" redstone power to different command chains. Any thought or ideas about that?



    For fun I tried a couple of things, and end up with this design:



    It works, but it is not very time efficient since branches execution is triggered on the falling edge of the redstone signal activating the "test" command (the `execute if` or `execute unless` command block on the foreground)

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to implement conditional control structure with command blocks?
    Quote from Megacrafter107»


    Answer #2:

    /execute has "if" and "unless" subcommands which you can use to achieve this. For example, if you want one branch to activate if there is a villager named "Villager_1" and the other branch to activate if there is a villager named "Villager_2", you would do it like this:


    branch #1:

    /execute if entity @e[type=villager,name=Villager_1] run <command_to_run_for_branch_1>


    branch #2:

    /execute if entity @e[type=villager,name=Villager_2] run <command_to_run_for_branch_2>

    this will execute the command at the end of the criteria is met. Think of this as separating the "cases"

    from the switch statement into separate if statements with the same criteria.


    Yes, I saw the `if` and `unless` statements of the `execute` command. What was boring me is to repeat again and again the same condition for every command in each branch. But from your other answers, I'm afraid this is how it has to be done with the Minecraft's command system per se. I still wonder however if we can emulate more complex control flows by spawning blocks or "passing" redstone power to different command chains. Any thought or ideas about that?

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