How to use Interaction Entities in Minecraft
Ойындар
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.com/s/9xx1t6pt8pg...
🔵 Discord & Other Links: linktr.ee/CloudWolfMC
💻 Website: cloudwolfyt.github.io
Пікірлер: 67
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
Жыл бұрын
It's actually 1.19.4, so even sooner than 1.20 people can use it
@ignWally
Жыл бұрын
@@trashcaster well thats fantastic
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
Жыл бұрын
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
Жыл бұрын
@@Cl0udWolf Of course ^^ It's just the shortest way with the command blocks 👍🏻
@Cl0udWolf
Жыл бұрын
@@SozoKa sort of, tho with command blocks u can just do execute as @e[type=interactor] if data entity @s attack run ...
@SozoKa
Жыл бұрын
@@Cl0udWolf bruh 😭😂
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.
You're a legend, thanks for all these useful video's
This makes a lot of sense. Thank you!
Thanks for your contribution. I think it is very helpful for my inspiration when coding things in MC
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
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_
the command block placing is mad sus
@SozoKa
Жыл бұрын
🤨
@Loggog
Жыл бұрын
Nah bro you're just weird
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
6 күн бұрын
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
6 күн бұрын
@@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
Got to start playing MC again, this might be usefull in combination with display items for in-game shop rooms
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
Жыл бұрын
that seems both less efficient and more complicated
@SnowyRedstone
Жыл бұрын
@@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 ...
Noice
Genius :)
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?
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
6 ай бұрын
they are still entities, so yes of course we can add tags to them
Perhaps using this in conjunction with the bypass would allow for 20Hz left click detection?
is there a way to do it on entities such as frogs
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.
@Cl0udWolf
10 ай бұрын
Use tags
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
Жыл бұрын
This is interaction entity
@themissinglink2481
Жыл бұрын
@@Cl0udWolf Interestingly if you have the interaction width to 100 and height to 100 it wont detect right click to that range.
@onlylvic
6 ай бұрын
@@Cl0udWolf but he's saying about block display I think
1.19.4 is live!! ^^
Hi, can I translate your video for my auditory
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
10 ай бұрын
use like clickable items or sneaking or something
@calvinwithun6512
10 ай бұрын
@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!
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?
What causes the interaction entity to not be viable on a per-tick basis? Does it have some sort of cooldown?
@Cl0udWolf
Жыл бұрын
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
Жыл бұрын
@@Cl0udWolf oh, so the problem is with continuously holding the button?
@Cl0udWolf
Жыл бұрын
@@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
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
Жыл бұрын
cant with this or any method
@As1anCr4ck3r
Жыл бұрын
@@Cl0udWolf oh ok, dang it why can’t they just add a left click and right click scoreboard objective
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
Жыл бұрын
it could be possible but it would be not very efficient and finding a better way to accomplish a similar task would be ideal
Hi, is there any way to specify which interaction I'm attacking? for example by putting "type":"minecraft:interaction", [tag]
@Sakupenny
Жыл бұрын
yes
@benjaminnicro8775
Жыл бұрын
@@Sakupenny how?
@Sakupenny
Жыл бұрын
@@benjaminnicro8775 just summon a interaction with a tag then put @e[type=interaction, tag=the tag you added to the interaction]
Does this work on bedrock on nintendo switch
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
Жыл бұрын
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
Жыл бұрын
@@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
Жыл бұрын
@@bloosix no. i made a separate video explaining why the interaction entity is not a click detection entity
@bloosix
Жыл бұрын
@@Cl0udWolf Alr, thank you. You've been very helpful so i appreciate it
bro made a pen** 💀
@ethanellis4042
6 ай бұрын
bruh
ayo that command block shape kinda sus
@smallfry7304
Жыл бұрын
bro said sus
I bet they are not adding this to bedrock😢