If-Else Statements in Minecraft Datapacks

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 58

  • @conure512
    @conure512 4 місяці тому +87

    This is the #1 reason I was so hyped when they added "/return run" lol, great to see you covering it :)

  • @dragendghast
    @dragendghast 4 місяці тому +9

    This is awesome dude!
    As someone who is just getting into making datapacks after they changed up components and other stuff recently, it's been super valuable to have people I can watch and learn from.

  • @Pikatscha
    @Pikatscha 4 місяці тому +13

    Very usefull indeed. Thanks for showing! Love how I could redo everything in my project like every few months, cause of new versions and learning of such features lol

  • @godofgrains
    @godofgrains 4 місяці тому +5

    hell yeah a conure and cloud wolf upload on the same day

  • @Voriaxly
    @Voriaxly 4 місяці тому +12

    Needed this so bad. Absolute Godsend

  • @SparkKnight556
    @SparkKnight556 4 місяці тому +8

    This is awesome! Can't wait to figure out all the uses for this!

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому +7

      if i ever get around to a new ui tutorial i will for sure use it there

  • @BD0G
    @BD0G 4 місяці тому +2

    finally. so many use cases for this. I would be interested in the UI tutorial!

  • @sodalish
    @sodalish 4 місяці тому +2

    Long time fan just wanted to say thanks for keep coming back to share these nuggets. Best

  • @SuperAngel2384
    @SuperAngel2384 4 місяці тому

    I can't believe you still work with Minecraft commands after over 8 years, I watched DanTDM play "A Weekend in Hartsville" and "Quantum Labs" and those were some of my favorite maps I've ever watched him play. Keep doing what you do best! :D

  • @Kepplar
    @Kepplar 4 місяці тому +1

    Goodness me I am excited. I remember searching up desperately looking for this function and was disappointed.
    Glad it's here!

  • @AwesomeDomi1
    @AwesomeDomi1 4 місяці тому +2

    Seeing what you can do with datapacks as they add more commands is so nice, now I wish they would add more freedom in the entity selector, like if I want to select @e[type=cow or type=sheep] to select both cows and sheep

    • @coledoe1030
      @coledoe1030 4 місяці тому +2

      You can do this with custom entity tags

    • @vat1n456
      @vat1n456 4 місяці тому

      /tag @e remove OurTag
      /tag @e[type=cow] add OurTag
      /tag @e[type=sheep] add OurTag
      --> @e[tag=OurTag]

    • @AwesomeDomi1
      @AwesomeDomi1 4 місяці тому

      @@vat1n456 yes I’m aware, but that still takes 4 commands, it would be nice to be able to do it in 1, not to mention if you want more different entities you need even more

    • @vat1n456
      @vat1n456 4 місяці тому

      @@AwesomeDomi1 I agree. The selectors are pretty restrictive since they don't always support the 'OR'. It should be nice to see new concepts like sets of arguments in order to let the game choose between the type A or B. For example, /execute if entity @e[type=(minecraft:cow,minecraft:sheep)]. Unluckily, it's not here yet
      Otherwise, I think there is a workaround in one line. I don't know if it's satisfying, but :
      /execute unless entity @e[type=!cow] unless entity @e[type=!sheep]
      Explanation :
      Let A and B be the statements A="this is a cow" and B="this is a sheep". It's known that the expression "A or B" (our main goal) is equivalent to "not A and not B" (which explains the appearance of "unless" keyword and the "!" inside selectors)

  • @spoonofsugar1431
    @spoonofsugar1431 4 місяці тому

    I remember you from my favorite map when i was like 11, a weekend in heartsville! thanks for being apart of my childhood!

  • @vectorminecraft
    @vectorminecraft 4 місяці тому

    I love your tutorials. I haven't coded in minecraft since they added datapacks but your videos make me want to get back into it lol.

  • @TZARpixelforge
    @TZARpixelforge 2 місяці тому

    IDEA: Rideable Giant Wolf 🐺 Mount with a boss fight?

  • @newkamil3757
    @newkamil3757 4 місяці тому +2

    How do you use the visual studio code extension without it flagging everything as red????

  • @CreativelyJake
    @CreativelyJake 4 місяці тому

    getting into datapacking, and seeing examples of stuff like /return is really helpful, ty!!
    like. my functions are a bit messy... but im learnin what return does, and what execute store does...

  • @tonylovesmusic
    @tonylovesmusic 4 місяці тому

    this saved me hours of frustrations 😅

  • @WesleySprayue
    @WesleySprayue 4 місяці тому

    Hey thanks for this! I can make a card game in minecraft using this!

  • @mnight-4
    @mnight-4 3 місяці тому

    OH MY LORD, I REALLY NEED IT.
    THABKS!!!

  • @mika34653
    @mika34653 4 місяці тому +5

    NO WAYYYYYYYYYYYYY

    • @mika34653
      @mika34653 4 місяці тому +2

      oh lol i've been using that already im stupid hahah

  • @TheKnytemayor
    @TheKnytemayor 4 місяці тому

    Thanks, this helped a lot, but how would you check for the value of one variable, not as two separate booleans? For example, X could be 0, 1 or 2. (i’m trying to make a random decision function)

  • @HarisRehmanGG
    @HarisRehmanGG 4 місяці тому

    Summary:
    #IF
    execute (condition) run return (answer)
    #ELSE
    (another)
    condition is like using if or something else like predicates idk
    answer is like a command or function, anything
    another is the other bits in your file, this can be a IF statement also

    • @HarisRehmanGG
      @HarisRehmanGG 4 місяці тому

      btw tysm for telling this 😁 very useful indeed

  • @GoldenRJL123
    @GoldenRJL123 4 місяці тому +1

    yes plzzz new UI I have been stuggeling to update your old UI to 1.21 also I was able to change the ender chest stone button on head to a light gray stained glass pane inside the new crafting.slot.0 and everytime someone opens there inventoty and closes it or throws it out it copys it back to the crafting slot, but I am struggeling whith air{drop_contents:1b} cuz whith the new components that nolonger works

  • @bifusmorgus9000
    @bifusmorgus9000 4 місяці тому +2

    this is huge

  • @mc_acmora8554
    @mc_acmora8554 4 місяці тому

    i have a question, which extensions por VS Code did you use for datapacks creation. I used one, but with the 1.20.5 update, it is not compatible.

  • @maxanimator9547
    @maxanimator9547 4 місяці тому

    return in an execute statement breaks the flow of the script ; is this neat behaviour common to the return command as well, more than the return subcommand of /execute ?

  • @BeezyMC
    @BeezyMC 4 місяці тому

    I love this!

  • @SupFederich
    @SupFederich 4 місяці тому

    Strange how i had a lot of programmed stuff and datapacks that when they got updated to 1.21 stopped to work

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому

      All plural names folders were renamed to singular expect a few

  • @kaitouaonhayy
    @kaitouaonhayy 4 місяці тому +1

    can i ask for 1 question? what extension you use in visual code

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому

      Read other ppl’s comments

  • @terrywilliams450
    @terrywilliams450 4 місяці тому

    What VS Code plugin do you use for datapacks?

  • @gloxost
    @gloxost 4 місяці тому

    So if i am not mistaken this is just execute unless but 10 times better right?

  • @coledoe1030
    @coledoe1030 4 місяці тому

    Ok so if I understand properly, the “run return” end but just like ends the function and does something else?

    • @Run2Seeun
      @Run2Seeun 4 місяці тому +1

      When return passes, the rest of the function is skipped. You can either run something along with it or use return fail to skip without doing anything

  • @V1c._.
    @V1c._. 4 місяці тому

    Can we do math with data packs now? I dunno what’s new

  • @_bertrd5294
    @_bertrd5294 4 місяці тому

    I'm curious. How would you go about making a switch case statement ?

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому +1

      i would just use a giant if-elif block like this running a function for each case. not a more effecient way

  • @MonkeyAntagonist
    @MonkeyAntagonist 4 місяці тому

    so if the return command is unsuccessful it will allow the following commands to run as normal but if it runs successfully it will stop the function early?

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому

      If you run return it kills the current function. So if you have conditional stuff before running the return command and that conditional stuff fails, of course the command will not run

  • @danijelkonc4168
    @danijelkonc4168 4 місяці тому

    Comment for the algorithm! #FixTF2

  • @M_1024
    @M_1024 4 місяці тому +1

    What extension to vs code do you use?

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому +1

      datapack helper and datapack icons, but its just for videos i dont actually use those

    • @mc_acmora8554
      @mc_acmora8554 4 місяці тому

      Does they work for 1.21 data pack(? Because for 1.21 datapacks it doesn't work ​@@Cl0udWolf

  • @MarvelousButter
    @MarvelousButter 4 місяці тому

    Is there any program to autoupdate item nbts to components out there?

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому +1

      there might be some, misode's generator can do it but you need to paste each thing in one at a time.

  • @psyonide1394
    @psyonide1394 4 місяці тому

    Was return then run always in commands?

    • @Cl0udWolf
      @Cl0udWolf  4 місяці тому +1

      been there for a while, maybe 1.18

    • @vat1n456
      @vat1n456 4 місяці тому

      It was added in 1.20.2

  • @HMT_main
    @HMT_main 4 місяці тому +2

    Didn‘t you use sublime text?