Recently I discovered a new way to test if a player is holding a specific item, IN ANY SLOT OF THE HOTBAR WITH ONLY ONE COMMAND BLOCK!
Probably you are thinking that I'm going to use something like 9 command blocks testing if I have a specific item in a specific slot and if I am selecting that slot, but that's not what I'm going to show you.
-First of all you need the item.- (For example a golden sword)
/give @p minecraft:golden_sword 1 0
Now you have to add an "Attribute" to the item, something like this:
To add different items, you have to change the UUID in the testfor command and in the give command.
(NOTE: In the testfor command you have to put an "l" at the end of the UUIDMost and the UUIDLeast)
Now you only have to hold the item while you are activating the testfor command. (Put a comparator)
You can hold the item in any slot and the comparator will be activated!
Recently I discovered a new way to test if a player is holding a specific item, IN ANY SLOT OF THE HOTBAR WITH ONLY ONE COMMAND BLOCK!
Probably you are thinking that I'm going to use something like 9 command blocks testing if I have a specific item in a specific slot and if I am selecting that slot, but that's not what I'm going to show you.
-First of all you need the item.- (For example a golden sword)
/give @p minecraft:golden_sword 1 0
Now you have to add an "Attribute" to the item, something like this:
To add different items, you have to change the UUID in the testfor command and in the give command.
(NOTE: In the testfor command you have to put an "l" at the end of the UUIDMost and the UUIDLeast)
Now you only have to hold the item while you are activating the testfor command. (Put a comparator)
You can hold the item in any slot and the comparator will be activated!
THANKS FOR READING!!!
Nifty usage of the new list-tag changes! In previous versions, you would have to include every single attribute and modifier, which would make such a device unfeasible. With this one, you don't even have to include all of the tags within, so you can just testfor the UUID pair in the modifier and remove the "Operation", "Amount", and "Name" tags (you'll still need to label these tags in your /give), and the "Base" tag from the root attribute:
And of course, your method doesn't actually modify the final outcome of the attribute, so you can have the player wear gear that will affect it, so long as that gear doesn't have the same UUID pair. You can also switch to using just the "Name" tag instead:
And then switching out the value of "Name" in the /give with "Custom Name". Still have to be careful with UUIDs; have had some oddities where the /testfor stops working entirely if I give myself some armor with the same UUID pair and attributes as the sword, but a different "Name". Removing the helmet from my inventory doesn't fix it, nor does a full /clear. The command block itself has to be deleted and replaced in order for it to work again.
It's a shame that most of these /testfor methods doesn't support a multiplayer environment. Once you get the success signal from a /testfor, you won't know which player it had found without a slow and convoluted setup. Personally I should like to see the ability to track attribute "Base" and "Amount" tags via the /scoreboard command, similar to how you can track the players Health/HealF tags with the "health" objective-type. But kudos on the great concept!
EDIT:
/scoreboard can now assign scores based on NBT data, which is needed for multiplayer support:
/scoreboard players set @a OBJECTIVE 1 {Attributes:[{Name:"generic.knockbackResistance",Modifiers:[{Name:"Custom Name"}]}]}
Nifty usage of the new list-tag changes! In previous versions, you would have to include every single attribute and modifier, which would make such a device unfeasible. With this one, you don't even have to include all of the tags within, so you can just testfor the UUID pair in the modifier and remove the "Operation", "Amount", and "Name" tags (you'll still need to label these tags in your /give), and the "Base" tag from the root attribute:
And of course, your method doesn't actually modify the final outcome of the attribute, so you can have the player wear gear that will affect it, so long as that gear doesn't have the same UUID pair. You can also switch to using just the "Name" tag instead:
And then switching out the value of "Name" in the /give with "Custom Name". Still have to be careful with UUIDs; have had some oddities where the /testfor stops working entirely if I give myself some armor with the same UUID pair and attributes as the sword, but a different "Name". Removing the helmet from my inventory doesn't fix it, nor does a full /clear. The command block itself has to be deleted and replaced in order for it to work again.
It's a shame that most of these /testfor methods doesn't support a multiplayer environment. Once you get the success signal from a /testfor, you won't know which player it had found without a slow and convoluted setup. Personally I should like to see the ability to track attribute "Base" and "Amount" tags via the /scoreboard command, similar to how you can track the players Health/HealF tags with the "health" objective-type. But kudos on the great concept!
Well if you want to use this concept in multiplayer you can simply use the SquirtDude's player scanner.
Here is a link to his video:
Finally a way to see whether or not a player is wearing their appropriate armor in minigames. Instant death will arise if someone disobeys the "do not remove armor" rule >: D
Horay! This has been something I've been pondering for quite some time. In the past I used /clear etc, but this system works great for customised items!
Horay! This has been something I've been pondering for quite some time. In the past I used /clear etc, but this system works great for customised items!
Yes! When I discovered this concept I was so happy, with that you can do a lot of things! And it's more compacted than something like 9 command blocks!
congrats on finding this by the way, it's a really smart way of using NBT tags, but my question is, would this work with custom named Items? I was looking through my favourite rescource pack when I saw that Gold Nuggets looked like coins, so, I started building a city, when it just got TOO big, so now I have a railway, the problem being I allready had a currency using Gold nuggets in it, but when I tried using this testfor command...
"testfor @p {display:{Name:"Money",color:"",Lore:["The currency of Minecraftia, released year 1250"]}}" the comparotor doesn't read anything......and I have the tags right, its probably something simple but I'd like someone to help ASAP, THX for reading!.
Several things: the /testfor command's dataTags start within the root of the entity, while you've started deep within the item format. You'll instead have to test for player data first, being the "Inventory" tag. Secondly, the "color" tag is an integer-type, while adding quotation marks turns it to a string-type. The "color" tag is not used on gold nuggets, so it doesn't need to be specified at all, nor does it need to be included if you intend on it being unused.
The fixed command (the "id" tag doesn't necessarily need to be specified, but I have included it in the example):
/testfor @p {
Inventory:[
{
id:minecraft:gold_nugget,
tag:{
display:{
Name:"Money",
Lore:[
"The currency of Minecraftia, released year 1250"
]
}
}
}
]
}
Condensed:
/testfor @p {Inventory:[{id:minecraft:gold_nugget,tag:{display:{Name:"Money",Lore:["The currency of Minecraftia, released year 1250"]}}}]}
Is it possible to use a stat that would not effect gameplay like generic.followRange, or horse.jumpStrength ?
His method does not affect any stats. What it does is "adds 0" to the current value, which essentially does nothing except for inserting the existence of the modifier to allow the tracking to work.
Several things: the /testfor command's dataTags start within the root of the entity, while you've started deep within the item format. You'll instead have to test for player data first, being the "Inventory" tag. Secondly, the "color" tag is an integer-type, while adding quotation marks turns it to a string-type. The "color" tag is not used on gold nuggets, so it doesn't need to be specified at all, nor does it need to be included if you intend on it being unused.The fixed command (the "id" tag doesn't necessarily need to be specified, but I have included it in the example):Condensed:
/testfor @p {Inventory:[{id:minecraft:gold_nugget,tag:{display:{Name:"Money",Lore:["The currency of Minecraftia, released year 1250"]}}}]}
but it did nothing. (yes the diamond is called Magical Diamond)What I am attempting to do, is have it when a player approaches an iron door with the correct item in hand, the door will turn into a wood one. "Unlocking" it.
but it did nothing. (yes the diamond is called Magical Diamond)What I am attempting to do, is have it when a player approaches an iron door with the correct item in hand, the door will turn into a wood one. "Unlocking" it.
The correct ID for diamonds is "minecraft:diamond", as it's case-sensitive:
Recently I discovered a new way to test if a player is holding a specific item, IN ANY SLOT OF THE HOTBAR WITH ONLY ONE COMMAND BLOCK!
Probably you are thinking that I'm going to use something like 9 command blocks testing if I have a specific item in a specific slot and if I am selecting that slot, but that's not what I'm going to show you.
-First of all you need the item.- (For example a golden sword)
(NOTE: To avoid this you can put "HideFlags:2" at the end of the command)
The important part of the item is the UUIDLeast and the UUIDMost, to make different items with different abilities you have to change only that.
-Now testing for the item-
You have to create a command block and put this:
To add different items, you have to change the UUID in the testfor command and in the give command.
(NOTE: In the testfor command you have to put an "l" at the end of the UUIDMost and the UUIDLeast)
Now you only have to hold the item while you are activating the testfor command. (Put a comparator)
You can hold the item in any slot and the comparator will be activated!
THANKS FOR READING!!!
Nifty usage of the new list-tag changes! In previous versions, you would have to include every single attribute and modifier, which would make such a device unfeasible. With this one, you don't even have to include all of the tags within, so you can just testfor the UUID pair in the modifier and remove the "Operation", "Amount", and "Name" tags (you'll still need to label these tags in your /give), and the "Base" tag from the root attribute:
And of course, your method doesn't actually modify the final outcome of the attribute, so you can have the player wear gear that will affect it, so long as that gear doesn't have the same UUID pair. You can also switch to using just the "Name" tag instead:
And then switching out the value of "Name" in the /give with "Custom Name". Still have to be careful with UUIDs; have had some oddities where the /testfor stops working entirely if I give myself some armor with the same UUID pair and attributes as the sword, but a different "Name". Removing the helmet from my inventory doesn't fix it, nor does a full /clear. The command block itself has to be deleted and replaced in order for it to work again.
It's a shame that most of these /testfor methods doesn't support a multiplayer environment. Once you get the success signal from a /testfor, you won't know which player it had found without a slow and convoluted setup. Personally I should like to see the ability to track attribute "Base" and "Amount" tags via the /scoreboard command, similar to how you can track the players Health/HealF tags with the "health" objective-type. But kudos on the great concept!
EDIT:
/scoreboard can now assign scores based on NBT data, which is needed for multiplayer support:
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
And yes it's true you don't need to mention the amount and operation, that makes my concept easier
Well if you want to use this concept in multiplayer you can simply use the SquirtDude's player scanner.
Here is a link to his video:
Thanks
Finally a way to see whether or not a player is wearing their appropriate armor in minigames. Instant death will arise if someone disobeys the "do not remove armor" rule >: D
Link Removed
Link Removed
Yes! When I discovered this concept I was so happy, with that you can do a lot of things! And it's more compacted than something like 9 command blocks!
And thanks for visiting my topic!!!
Would it not just output a signal strength of two?
Several things: the /testfor command's dataTags start within the root of the entity, while you've started deep within the item format. You'll instead have to test for player data first, being the "Inventory" tag. Secondly, the "color" tag is an integer-type, while adding quotation marks turns it to a string-type. The "color" tag is not used on gold nuggets, so it doesn't need to be specified at all, nor does it need to be included if you intend on it being unused.
The fixed command (the "id" tag doesn't necessarily need to be specified, but I have included it in the example):
Condensed:
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
His method does not affect any stats. What it does is "adds 0" to the current value, which essentially does nothing except for inserting the existence of the modifier to allow the tracking to work.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
i think you can have any names for an attribute and it wont have any effect.. can't test it though cause i don't have MC on right now
But I'm really happy to know that there are people using my method.
Thanks!
The correct ID for diamonds is "minecraft:diamond", as it's case-sensitive:
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
But this only tests for if I have it, how could I make it test if im holding it?
the one I tried to use was:
testfor @p {Inventory:{[ID:minecraft:Lever]}}
Adding picture of code
Can someone please tell me if there is something wrong with it
Thank you