I was wondering if there was a way that you could give an item from a command block that had been edited by using like MCEdit or NBTExplorer, would you have to do something to a command block and edit that too or is it impossible?
(Edit)
Oh and if anyone can, I was wondering if you could test for someone holding a blocked sword and then do something based on that.
You will need to modify the command block's "Command" tag using a third-party editor to match the item you'd like to give. Assuming you mean custom formatting: once you modify it in an editor, be careful modifying it in-game. The section symbol can't be inserted into command blocks in-game, so if you accidentally delete it you'll need to redo the process.
Currently (as far as I know) there is no way to detect a player blocking.
When it comes to blocking, we know that blocking slows the player down, that the player is right clicking when they are blocking, and that they take less damage when they are blocking. You could maybe test for those variables, but it won't be easy. I don't know how the generic movement speed attribute works, but if blocking a sword changes that value, you could do something like /scoreboard players add @p OBJECTIVE 1 {generic movement speed tag here*} If that is at all possible however, I believe the same speed is true while eating food and maybe walking on soulsand. A right click detections system while the player is holding a sword might work, but it won't show that the player is blocking unless you use an armor stand to position another sword in front of the player.
*Although I don't know what that value is, i'm sure it can be found.
Rollback Post to RevisionRollBack
I have a small YouTube channel and would greatly appreciate it if you were to check me out!!
When it comes to blocking, we know that blocking slows the player down, that the player is right clicking when they are blocking, and that they take less damage when they are blocking. You could maybe test for those variables, but it won't be easy. I don't know how the generic movement speed attribute works, but if blocking a sword changes that value, you could do something like /scoreboard players add @p OBJECTIVE 1 {generic movement speed tag here*} If that is at all possible however, I believe the same speed is true while eating food and maybe walking on soulsand. A right click detections system while the player is holding a sword might work, but it won't show that the player is blocking unless you use an armor stand to position another sword in front of the player.
*Although I don't know what that value is, i'm sure it can be found.
Before posting this I thought that things like blocking, the slowness potion effect and soulsand affected the generic.movementSpeed modifier, (because why else would this be a thing?) but now I know that is not true.
To test this, I found the attribute potion.moveSlowdown. I tried the same for soulsand, but I didn't see any modifiers on the entity for it. I know that you are probably right when you say that blocking does not apply an attribute modifier, but I am curious how you know this. I have found my information via the entity data command and because the entity data command does not work with players, my knowledge of player data tags are pretty limited.
Before posting this I thought that things like blocking, the slowness potion effect and soulsand affected the generic.movementSpeed modifier, (because why else would this be a thing?) but now I know that is not true.
To test this, I found the attribute potion.moveSlowdown. I tried the same for soulsand, but I didn't see any modifiers on the entity for it. I know that you are probably right when you say that blocking does not apply an attribute modifier, but I am curious how you know this. I have found my information via the entity data command and because the entity data command does not work with players, my knowledge of player data tags are pretty limited.
What I did to test it was search for the existence of a "Modifiers" tag in the movementSpeed attribute on myself. When there's no modifiers, the "Modifiers" tag doesn't exist, so I used the following command while blocking and it returned false (compared to giving myself a speed potion, which returned true):
I checked in-game rather than saving when blocking just in case it didn't get saved if it existed.
The reason "Modifiers:[{}]" is used instead of "Modifiers:[]" is because checking for just the list has a separate function: it checks if the list exists but is specifically empty. This allows you to see if inventories such as droppers are empty, since the "Items" tag will always exist, but will be blank if there's no items. "Modifiers:[{}]" instead looks for both the list and if there is a compound inside the list (in this case, any modifiers at all). Since it returned false when I was blocking, that means no modifiers are applied.
I was wondering if there was a way that you could give an item from a command block that had been edited by using like MCEdit or NBTExplorer, would you have to do something to a command block and edit that too or is it impossible?
(Edit)
Oh and if anyone can, I was wondering if you could test for someone holding a blocked sword and then do something based on that.
Currently (as far as I know) there is no way to detect a player blocking.
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/
*Although I don't know what that value is, i'm sure it can be found.
I have a small YouTube channel and would greatly appreciate it if you were to check me out!!
Blocking does not apply an attribute modifier.
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/
Before posting this I thought that things like blocking, the slowness potion effect and soulsand affected the generic.movementSpeed modifier, (because why else would this be a thing?) but now I know that is not true.
To test this, I found the attribute potion.moveSlowdown. I tried the same for soulsand, but I didn't see any modifiers on the entity for it. I know that you are probably right when you say that blocking does not apply an attribute modifier, but I am curious how you know this. I have found my information via the entity data command and because the entity data command does not work with players, my knowledge of player data tags are pretty limited.
And this is the data tag I found:
Attributes:[0:{Name:"generic.maxHealth",Base:10.0d},1:{Name:"generic.knockbackResistance",Base:0.0d},2:{Name:"generic.movementSpeed",Base:0.25d,Modifiers:[0:{Name:"potion.moveSlowdown 0",UUIDLeast:-7778190119041365872L,Operation:2,Amount:-0.15000000596046448d,UUIDMost:8144722948526719024L}]}
I have a small YouTube channel and would greatly appreciate it if you were to check me out!!
What I did to test it was search for the existence of a "Modifiers" tag in the movementSpeed attribute on myself. When there's no modifiers, the "Modifiers" tag doesn't exist, so I used the following command while blocking and it returned false (compared to giving myself a speed potion, which returned true):
I checked in-game rather than saving when blocking just in case it didn't get saved if it existed.
The reason "Modifiers:[{}]" is used instead of "Modifiers:[]" is because checking for just the list has a separate function: it checks if the list exists but is specifically empty. This allows you to see if inventories such as droppers are empty, since the "Items" tag will always exist, but will be blank if there's no items. "Modifiers:[{}]" instead looks for both the list and if there is a compound inside the list (in this case, any modifiers at all). Since it returned false when I was blocking, that means no modifiers are applied.
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 have a small YouTube channel and would greatly appreciate it if you were to check me out!!