So I'm working on 1.9 (yes, I'm old, thank you) and I'm working on a sword swinger thingy using an armor stand and an replaceitem command.
Here's how it works:
First the item is dropped on the armour stand, then the armor stand will replaceitem in its head the item, then the item is killed.
So I want it so every time I drop a item near the stand, it add to a score in a scoreboard, then the score is the amount of the items in the head.
For example, I throw it five times, so the score is 5. So there will be 5 swords swinging. If another item is dropped, the score will be 6 and the swords will be 6.
Is that possible to make using command blocks (duh). Thank you for reading!
to detect items near to the armor stand and then run something like this :
"/stats block #Command block's XYZ# set AffectedEntities #Player name# #score#"
You can use a dummy player for #Player name# and it must set the score as the number of items near the armor stand.
However, replacing the armor stand's head would be quite hard, as you need to copy the item's ID on it. This can not be done be done before the godlike /data modify from 1.13... and /replaceitem can not do that.
Though you can not copy the item data, you can still run a command for each item you want to be compatible with your system : %If item=dirt replaceitem dirt% etc. For every one.
Another thing : for testing an item id, you must search for its NBT. If I remember, NBT specifications are only avaible in /scoreboard and /testfor on 1.9 (urgh).
So for tracking which item you have to replace, you must run a /testfor command which will trigger a replaceitem command.
Example :
/execute @e[#armor stand selector#] ~ ~ ~ testfor @e[type=Item,r=1] {Item:{id:"minecraft:diamond"}}
Then if it is detected :
/replaceitem entity @e[#armor stand selector#] slot.armor.head minecraft:diamond
Note : I'm on phone right now and am writing all commands by memory. Some of them could contain errors...
As you can see, 1.9 is not the best version for this at all with its lack of commands and arguments
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
So I'm working on 1.9 (yes, I'm old, thank you) and I'm working on a sword swinger thingy using an armor stand and an replaceitem command.
Here's how it works:
First the item is dropped on the armour stand, then the armor stand will replaceitem in its head the item, then the item is killed.
So I want it so every time I drop a item near the stand, it add to a score in a scoreboard, then the score is the amount of the items in the head.
For example, I throw it five times, so the score is 5. So there will be 5 swords swinging. If another item is dropped, the score will be 6 and the swords will be 6.
Is that possible to make using command blocks (duh). Thank you for reading!
I think you could use the /stats command in 1.9 for setting the score... there are some infos about this here :
https://www.digminecraft.com/game_commands/stats_command.php
I do not remember very well this one, was a messy command, but I think you could do something with AffectedEntities argument...
Maybe you could use a repeated command block containing :
"execute @e[type=armor_stand,#specific tags#] ~ ~ ~ testfor @e[type=Item,r=1]"
to detect items near to the armor stand and then run something like this :
"/stats block #Command block's XYZ# set AffectedEntities #Player name# #score#"
You can use a dummy player for #Player name# and it must set the score as the number of items near the armor stand.
However, replacing the armor stand's head would be quite hard, as you need to copy the item's ID on it. This can not be done be done before the godlike /data modify from 1.13... and /replaceitem can not do that.
Though you can not copy the item data, you can still run a command for each item you want to be compatible with your system : %If item=dirt replaceitem dirt% etc. For every one.
Another thing : for testing an item id, you must search for its NBT. If I remember, NBT specifications are only avaible in /scoreboard and /testfor on 1.9 (urgh).
So for tracking which item you have to replace, you must run a /testfor command which will trigger a replaceitem command.
Example :
/execute @e[#armor stand selector#] ~ ~ ~ testfor @e[type=Item,r=1] {Item:{id:"minecraft:diamond"}}
Then if it is detected :
/replaceitem entity @e[#armor stand selector#] slot.armor.head minecraft:diamond
Note : I'm on phone right now and am writing all commands by memory. Some of them could contain errors...
As you can see, 1.9 is not the best version for this at all with its lack of commands and arguments
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).