So i was wanting to set up a mechanism for my original youtube series idea but i don't know how. The idea is, i want to test for a item right click, example: i am holding a stick and i right click it and is makes an explosion right were i am. Also if you know a way to upgrade that to making it so it has to be a certain named item, example: stick name self destruct. But i want to know at least how to make an item cause it, the name thing thats just a little bonus if you know how to do that. Thanks in advance everyone.
I do not think that is possible, unless… hmm. Well the one way I could think to do it would be to use a scoreboard. Scoreboards can test if a player uses an item, but I think it only works with items that are useable with right click, or placeable with right click. So if you did an item (such as blocking with a sword maybe?) That does something when you right click, it is possible. First you would make a scoreboard with the command /scoreboard objectives add useX stat.useItem.minecraft.X. Then you would do another command that would be /scoreboard players set @a useX 0. Afterwards, (have the next 2 commands on a clock) /scoreboard players set @e[type=Player,score_useX_min=1] useX 0. One more command, this one would be what actually makes the explosion, /execute @e[type=Player,score_useX_min=1] ~ ~ ~ /summon PrimedTnt ~ ~ ~. This whole thing will summon PrimedTnt in your feet when you use an item. Of course, change the X that i've put in this to whatever item it would be that you would be using. However, as for making it only work with an item with a name, I do not think that is possible, simply due to the way /scoreboard criteria works. Anyway, hope this helped
Rollback Post to RevisionRollBack
This sentence is false. And btw, the chicken came first.
The Meaning of Life, the Universe, and Everything.
Join Date:
2/23/2014
Posts:
275
Location:
The Void
Minecraft:
Upsilon
Member Details
You could try setblocking a piston extension in their head whenever they are holding the stick. Then check if the extension is gone and they are holding the stick. If yes, then create the explosion. You just have to test for their held item. You are able to test for a specific item NBT, which would allow you to check for a named item.
If there was a way, it would be in editing the criteria type (in the very first command where you do the stat.useItem.minecraft.X), but I do not think it is possible, simply due to the syntax of that command.
Rollback Post to RevisionRollBack
This sentence is false. And btw, the chicken came first.
THIS IS AWESOME!!! My friend and I are going to recreate powers of Greek myths and fight each other to find who the better redstoner is. This helps a lot!
The Meaning of Life, the Universe, and Everything.
Join Date:
5/24/2015
Posts:
319
Minecraft:
WhiteAutumn
Member Details
Greetings
It's very possible making non right clickable items semi clickable. You would need to be using a 30HZ clock and you would need to execute multiple commands in the same tick in order.
Therefor i recommend doing it in 1.9.
First you would need to detect what the player is holding in their hand.
You could do that with something like:
/scoreboard players tag @a add Item {SelectedItemSlot:0,Inventory:[{Slot:0b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:1,Inventory:[{Slot:1b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:2,Inventory:[{Slot:2b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:3,Inventory:[{Slot:3b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:4,Inventory:[{Slot:4b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:5,Inventory:[{Slot:5b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:6,Inventory:[{Slot:6b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:7,Inventory:[{Slot:7b,tag:{display:{Name:"ClickMe"}}}]}
/scoreboard players tag @a add Item {SelectedItemSlot:8,Inventory:[{Slot:8b,tag:{display:{Name:"ClickMe"}}}]}
In this example i use the 1.9 tag system but you could use scoreboards if you want it in 1.8.
You need to have those command on the clock and be executed first in the tick. (Yes you need all of them)
You would want to spawn a armour stand before the next command.
You would want to spawn an invisible armour stand but it can not have the marker tag.
The next thing you want to do in the tick is to use the /execute command to teleport an armour stand to the player with the tag (or right score)
When the player clicks the item they will click the armour stand and give the armour stand the item.
The next command you need to use is /scoreboard to add a scoreboard value or a tag to the armour stand that is holding the item
This next command is optional depending on if you want the item to be re usable or single use.
You would want this command block to be conditional or hooked up to a comparator (slower) depending on if you are using 1.8 or 1.9.
If you want the item to be re usable you would want to put a /give command here that gives back the item to the player who is closest to the armour stand.
After that would would want to put the commands you want the clickable items to execute.
If you want to target the player who clicked the item just use /execute at the armour stand and then use @p.
Last in the tick you want to kill the armour stand.
I am sorry about how messy this little guide is but i did not have the time to make a proper one.
If you need any help let me know and i will answer and if necessary build a full prototype.
Sorry, old habit, people used to call them 30hz clocks for some reason.
Ofc it can't go faster than 20hz since a minecraft tick occurs 20 times a second.
Afterwards, spawn in an invisible and invincible villager (preferably with no AI and is silent). When you have the Offers:{} tag added, it means that the villager dosen't have any trades; hence no GUI will show up.
Have a 20Hz fill clock tp the villager to the player constantly.
/tp @e[type=Villager,name=rclick_detector] @a
When the player right clicks onto the villager (basically anywhere), it will add 1 to the score 'rightClick'. You can use this score for whatever you want.
Is there a way in which you could do this with a named item? Like for example, use the testfor commands and everything, but the explosion would be caused by a named hoe.
THIS IS AWESOME!!! My friend and I are going to recreate powers of Greek myths and fight each other to find who the better redstoner is. This helps a lot!
THX
The only issue with the piston head thing is that if they're riding a minecart and clip through a block, it'll destroy it.
>> My Resource Pack
>> Ground Penetrating Radar
Greetings
It's very possible making non right clickable items semi clickable. You would need to be using a 30HZ clock and you would need to execute multiple commands in the same tick in order.
Therefor i recommend doing it in 1.9.
First you would need to detect what the player is holding in their hand.
You could do that with something like:
In this example i use the 1.9 tag system but you could use scoreboards if you want it in 1.8.
You need to have those command on the clock and be executed first in the tick. (Yes you need all of them)
You would want to spawn a armour stand before the next command.
You would want to spawn an invisible armour stand but it can not have the marker tag.
The next thing you want to do in the tick is to use the /execute command to teleport an armour stand to the player with the tag (or right score)
When the player clicks the item they will click the armour stand and give the armour stand the item.
The next command you need to use is /scoreboard to add a scoreboard value or a tag to the armour stand that is holding the item
This next command is optional depending on if you want the item to be re usable or single use.
You would want this command block to be conditional or hooked up to a comparator (slower) depending on if you are using 1.8 or 1.9.
If you want the item to be re usable you would want to put a /give command here that gives back the item to the player who is closest to the armour stand.
After that would would want to put the commands you want the clickable items to execute.
If you want to target the player who clicked the item just use /execute at the armour stand and then use @p.
Last in the tick you want to kill the armour stand.
I am sorry about how messy this little guide is but i did not have the time to make a proper one.
If you need any help let me know and i will answer and if necessary build a full prototype.
Oh and if you insist on doing it in 1.8, here's a link to which block executes in what order in a tick:
http://testfordev.com/update-order-fill-propagation/
The only item that can be used to detect right-clicking anywhere, anytime, is a Carrot on a Stick.
As such, you'll need to use this scoreboard objective:
/scoreboard objectives add carrotUse stat.useItem.minecraft.carrot_on_a_stick
Next, hook these two commands up to a fill clock:
1:/execute @a[score_carrotUse_min=1] ~ ~ ~ /summon PrimedTnt ~ ~ ~
2:/scoreboard players set @a[score_carrotUse_min=1] carrotUse 0
Make sure that the second command is activated after the first command.
I make Minecraft maps and (formerly) One-Command Creations.
Check out my website to see all the things I've made.
If you want concepts and s**tposts, here's my YouTube.
Incorrect. but carrot on a stick is the easiest way of doing it.
I was referring to actual items, instead of using a method involving Villagers or something.
I make Minecraft maps and (formerly) One-Command Creations.
Check out my website to see all the things I've made.
If you want concepts and s**tposts, here's my YouTube.
Splash water bottles can be used.
So can snowballs, eggs, and other projectiles.
Can shields be detected?
IQ Test
Autumn, you can't have a clock faster than 20hz.
IQ Test
Sorry, old habit, people used to call them 30hz clocks for some reason.
Ofc it can't go faster than 20hz since a minecraft tick occurs 20 times a second.
Use a villager. There's a stat in scoreboards that lets you check if you talked to a villager. Here's how:
Afterwards, spawn in an invisible and invincible villager (preferably with no AI and is silent). When you have the Offers:{} tag added, it means that the villager dosen't have any trades; hence no GUI will show up.
Have a 20Hz fill clock tp the villager to the player constantly.
When the player right clicks onto the villager (basically anywhere), it will add 1 to the score 'rightClick'. You can use this score for whatever you want.
Choco, with that setup, you can't break blocks or open chests.
IQ Test
There's many items you can use. Just by testing a few of how the scoreboards work for the item. Might of missed a few but here's a decent list.
Is there a way in which you could do this with a named item? Like for example, use the testfor commands and everything, but the explosion would be caused by a named hoe.