How to use Interaction Entities in Minecraft

Поделиться
HTML-код
  • Опубликовано: 26 авг 2024
  • A quick tutorial on how to use interaction entities using both command blocks and datapacks.
    Command Blocks:
    execute as @e[type=interaction] on attacker run say left
    execute as @e[type=interaction] on target run say right
    bonus
    execute as @e[type=interaction] if data entity @s attack run say I was left clicked
    execute as @e[type=interaction] if data entity @s interaction run say I was right clicked
    execute as @e[type=interaction] run data remove entity @s attack
    execute as @e[type=interaction] run data remove entity @s interaction
    Latest Version (1.19.4)
    📦 Download: www.dropbox.co...
    🔵 Discord & Other Links: linktr.ee/Clou...
    💻 Website: cloudwolfyt.gi...

Комментарии • 68

  • @ignWally
    @ignWally Год назад +49

    This will be actually incredible for creating minigames in minecraft, considering the size of it can be fully customized. Great addition to 1.20!

    • @trashcaster
      @trashcaster Год назад +2

      It's actually 1.19.4, so even sooner than 1.20 people can use it

    • @ignWally
      @ignWally Год назад +1

      @@trashcaster well thats fantastic

  • @SozoKa
    @SozoKa Год назад +14

    To get the entity that got clicked in command block, you can do :
    execute as @e[type=minecraft:interaction,distance=..6] at @s on attacker as @e[type=minecraft:interaction,distance=...1] run ...

    • @Cl0udWolf
      @Cl0udWolf  Год назад +2

      Yeah u can do it by moving positioning around but I prefer the method with less @e selectors especially since u can optionally maintain the player and the entity’s location and selection at all times

    • @SozoKa
      @SozoKa Год назад

      ​@@Cl0udWolf Of course ^^ It's just the shortest way with the command blocks 👍🏻

    • @Cl0udWolf
      @Cl0udWolf  Год назад +3

      @@SozoKa sort of, tho with command blocks u can just do execute as @e[type=interactor] if data entity @s attack run ...

    • @SozoKa
      @SozoKa Год назад

      @@Cl0udWolf bruh 😭😂

  • @TheKnewGreg
    @TheKnewGreg Месяц назад +2

    Just a heads-up, you're able to completely skip searching for which interaction entity was interacted with by using a predicate. use "entity properties" and check that the nbt is equal to "{interaction:{}}" for right clicks and "{attack:{}}" for left clicks. Then, in the code that runs after getting the advancement, start it with
    "execute at @s as @n[type=minecraft:interaction,predicate={name of your predicate}] run tag @s add interaction"
    Now, you will only need to check the entity that has the tag "interaction" and it will be the one you interacted with (Just make sure to remove the tag at the end of the function)

    • @fullwoodenshovelfromminecr2365
      @fullwoodenshovelfromminecr2365 Месяц назад

      crazy that we're both in the comment section of a video a year old at roughly the same time lmao
      i dont fully understand what youre saying here though. what would the code be in the predicate?

    • @TheKnewGreg
      @TheKnewGreg Месяц назад

      @@fullwoodenshovelfromminecr2365 I recommend using Misode's predicate generator. It shows you all the things you can do in a predicate.
      For this one, you need to set the predicate to "entity properties" (it should be this by default, otherwise it's the drop-down next to "single"). One of the text boxes under it will be for nbt, and that's where you need to put {interaction{}}. Basically, this will make the predicate true as long as the interaction entity has any interaction data at all. Just make sure the function that checks for this also runs a data remove command to delete the interaction data

    • @witt7532
      @witt7532 10 дней назад

      @@fullwoodenshovelfromminecr2365 if you still care, in a datapack you can create a condition known as a predicate which is a type of .json file that goes in a predicate folder. so that code is a condition that gets checked when a command asks for it.
      So in his case he is using an advancement that triggers a function that follows:
      "execute at @s" to make sure that function happens on the activating player's position
      "as @n" to target the nearest entity that fits the criteria in brackets
      "[type=minecraft:interaction, predicate={predicate name}]" this makes sure that only an entity that is an interaction entity, AND has a predicate defined in the predicate folder of a datapack that passes its check (in this case it is looking for an entity that has the data of {interaction:{}}) and followed up by the resto of the command to do whatever you want to that entity.
      Alternately you could use a similar command "execute as @s as @n[type=minecraft:interaction, nbt={interaction:{}}]" the issue with this is that if there are a LOT of interactions nearby it has to check all their nbt data until it finds the correct one. to even further bring down the range of testable entities (if you plan on using a lot) you may want to try using "execute as @s positioned ^ ^ ^3 as @n[type=minecraft:interaction, nbt={interaction:{}},distance=..6]" this puts the location of command at 3 blocks in front of you, and only checks interactions within 6 blocks of that.

  • @captaincomic8678
    @captaincomic8678 Год назад +9

    I'm personally planning to use this in an adventure map I'm working on where I have stuff like force field generators to smash and multi-button control consoles to interact with, this is all very exciting stuff.

  • @The_Munch
    @The_Munch Год назад +5

    You're a legend, thanks for all these useful video's

  • @Njb-yp4td
    @Njb-yp4td Год назад +3

    This makes a lot of sense. Thank you!

  • @SnowyRedstone
    @SnowyRedstone Год назад +3

    also, I personally would use scoreboards for this one where in tick function I would save the attack/interaction into a scoreboard, and when no one touches it, it is blank, after attack/interaction, the scoreboard value will go to 1

    • @Cl0udWolf
      @Cl0udWolf  Год назад +1

      that seems both less efficient and more complicated

    • @SnowyRedstone
      @SnowyRedstone Год назад +3

      @@Cl0udWolf I guess since it is just like how you would use carrot on a stick for click detection except the score is in the interaction entity and not the player
      but I wish they can just add click detection that's something like this:
      /execute as @a if entity @s click right run ...

  • @gamingkanal7672
    @gamingkanal7672 8 месяцев назад +1

    Thanks for your contribution. I think it is very helpful for my inspiration when coding things in MC

  • @Bansed
    @Bansed Год назад +24

    the command block placing is mad sus

    • @SozoKa
      @SozoKa Год назад +4

      🤨

    • @Loggog
      @Loggog Год назад

      Nah bro you're just weird

  • @RoarkCats
    @RoarkCats Год назад

    5:40 Found a good use of the new return command here! Instead of having all subsequent commands run from an if statement or making a whole new function for them, you can just say the following and then all code thereafter can run freely as the clicked interaction
    _execute if score __#bool__ test matches 0 run return 0_

  • @AiRsTrIkExXzZ
    @AiRsTrIkExXzZ Год назад

    I’m using this for my tardis. I’m on my 8th iteration with this one going to be the most advanced since the vanity of the tardis will look spectacular with item frames with maps and making survival friendly. I’m using this for the door function where it’ll detect if the player who is trying to open the door has a tardis key before opening the door if they have a key

  • @maarcislv
    @maarcislv Год назад

    Got to start playing MC again, this might be usefull in combination with display items for in-game shop rooms

  • @foxlyticalxd2562
    @foxlyticalxd2562 Год назад +2

    Can we also add tags to these hitboxes so that way when we have multiple, we can tell the command to remove data of the hitboxes with only that tag?

    • @wassimtahraoui9888
      @wassimtahraoui9888 7 месяцев назад

      they are still entities, so yes of course we can add tags to them

  • @commanderweeb9949
    @commanderweeb9949 3 месяца назад

    Perhaps using this in conjunction with the bypass would allow for 20Hz left click detection?

  • @ivoknoob_2909
    @ivoknoob_2909 11 месяцев назад +1

    Imagine you have three of this interaction entities, how i can make them do different commands? Like first one to run say comand, second one to run playsound and etc.

  • @nobledame7110
    @nobledame7110 Год назад +4

    Noice

  • @oflashiii
    @oflashiii 10 месяцев назад

    Hey CloudWolf , im wondering if theres an easy toggle for something like this (like im left clicking once and it shows an message and left clicking again it will delete the message) , do i need to make this with an scorebaord or is there an other better way? And can i define the player (without the advancement) that clicked the interaction and tp it to somewhere?

  • @reallightengineer
    @reallightengineer 3 месяца назад

    is there a way to do it on entities such as frogs

  • @geohype1099
    @geohype1099 6 месяцев назад

    the interaction entity is just not working at all, for me the commands do not work and clicking on the interaction entity doesn't do anything. Even with the chain command blocks the interaction entity does not work. Do you know what to do?

  • @thesuitablecommand
    @thesuitablecommand 11 месяцев назад

    I am trying to find a way to give a player special powers while wearing different trims... this feels like the way to go, but it's tricky because the entity blocks you from attacking or interacting with anything behind it. So, you can't have it floating in front of you at all times. I could put it at the very end of your reach, so you can interact with things between you and it, but then you wouldn't be able to use these powers in tight spaces... hmm...

    • @Cl0udWolf
      @Cl0udWolf  11 месяцев назад

      use like clickable items or sneaking or something

    • @thesuitablecommand
      @thesuitablecommand 11 месяцев назад

      @CloudWolfMinecraft yeah, maybe, but I'm trying to get it to work without gating it behind holding items. Sorta breaks immersion.
      I might make these powers only work if you have an empty hand. That way it won't interfere with shooting a bow or swinging a sword, but you can attack and interact with this entity floating on top of your head any time you're not holding anything. And if you want to mine dirt and don't have a shovel, just mine it with more dirt, or your pickaxe or something.
      Idk, I'm still brainstorming this. I think it can work, I just gotta be clever about it!

  • @wolfoxcs
    @wolfoxcs Год назад

    1.19.4 is live!! ^^

  • @antekacki8753
    @antekacki8753 Год назад +1

    What causes the interaction entity to not be viable on a per-tick basis? Does it have some sort of cooldown?

    • @Cl0udWolf
      @Cl0udWolf  Год назад +3

      same as with carrot on a stick, it is rate limited to 5Hz unless u spam click it with ur mouse, then it can be up to 20Hz but that is even worse behavior to me

    • @antekacki8753
      @antekacki8753 Год назад +1

      @@Cl0udWolf oh, so the problem is with continuously holding the button?

    • @Cl0udWolf
      @Cl0udWolf  Год назад +1

      @@antekacki8753 yes but i would argue having inconsistent is worse than if it were consistently slow for most cases. also it blocks all other interactions both left and right
      i made a separate video explaining why it is not a good click detection method for most cases

  • @prismsmoviecavern
    @prismsmoviecavern Год назад

    Hey can you please do a tutorial explaining and teaching us how to use the block interaction entities? Lots of cool values but what do they all mean

    • @Cl0udWolf
      @Cl0udWolf  Год назад +2

      This is interaction entity

    • @themissinglink2481
      @themissinglink2481 Год назад

      @@Cl0udWolf Interestingly if you have the interaction width to 100 and height to 100 it wont detect right click to that range.

    • @onlylvic
      @onlylvic 8 месяцев назад

      ​@@Cl0udWolf but he's saying about block display I think

  • @Rusink
    @Rusink Год назад

    Genius :)

  • @mihaluich
    @mihaluich 6 месяцев назад

    Hi, can I translate your video for my auditory

  • @bloosix
    @bloosix Год назад

    So i have a situation where I have two interaction entites, and when i hold a specific item in my offhand and right click something happens, but I only want it to work with one interaction entity, how would I do that?

    • @Cl0udWolf
      @Cl0udWolf  Год назад

      U can’t. Interaction entities r hierarchical and cannot be ignored. The closest to the player while being in reach and clicked on will trigger

    • @bloosix
      @bloosix Год назад

      @@Cl0udWolf so then could i make it so that if others interact with it, nothing happens? Like if the don't have a certain tag when they click on it nothing happens

    • @Cl0udWolf
      @Cl0udWolf  Год назад

      @@bloosix no. i made a separate video explaining why the interaction entity is not a click detection entity

    • @bloosix
      @bloosix Год назад

      @@Cl0udWolf Alr, thank you. You've been very helpful so i appreciate it

  • @As1anCr4ck3r
    @As1anCr4ck3r Год назад

    Question, rn I am making a kit pvp thing and I want to be able to detect when a player left clicks while still being able to attack other players

    • @Cl0udWolf
      @Cl0udWolf  Год назад +1

      cant with this or any method

    • @As1anCr4ck3r
      @As1anCr4ck3r Год назад

      @@Cl0udWolf oh ok, dang it why can’t they just add a left click and right click scoreboard objective

  • @SnowyRedstone
    @SnowyRedstone Год назад +3

    ayo that command block shape kinda sus

  • @benjaminnicro8775
    @benjaminnicro8775 Год назад

    Hi, is there any way to specify which interaction I'm attacking? for example by putting "type":"minecraft:interaction", [tag]

    • @Sakupenny
      @Sakupenny Год назад

      yes

    • @benjaminnicro8775
      @benjaminnicro8775 Год назад +2

      @@Sakupenny how?

    • @Sakupenny
      @Sakupenny Год назад +1

      @@benjaminnicro8775 just summon a interaction with a tag then put @e[type=interaction, tag=the tag you added to the interaction]

  • @wolfoxcs
    @wolfoxcs Год назад

    Hi Cloud Wolf. I want to get a player with the same name as an armour stand's name. Is it possible to do that?

    • @Cl0udWolf
      @Cl0udWolf  Год назад

      it could be possible but it would be not very efficient and finding a better way to accomplish a similar task would be ideal

  • @TYRCGC
    @TYRCGC Год назад

    Does this work on bedrock on nintendo switch

  • @gground9702
    @gground9702 Год назад +2

    bro made a pen** 💀

  • @ChillsTars8
    @ChillsTars8 Год назад

    I bet they are not adding this to bedrock😢