How do I change one Item Entity into another/different entity using commands?
So, what I have for my command so far is:
/execute @e[type=Item] {id:"minecraft:double_plant"} ~ ~ ~ summon Item ~ ~ ~ {Item:{Count:1, id:17}}
The point of this command is to summon minecraft:log at the minecraft:double_plant entities. Progress is not really coming along so well though. I can summon a log at an item but I can't specify which specific item i want to summon it at. This is where I am having trouble.
Another command I used is this one:
/execute @p ~ ~ ~ fill ~-1 ~ ~-1 ~1 ~10 ~1 double_plant 0 destroy log
Now, this one works, kinda. It will just infinitely summons minecraft:double_plant. It will how ever destroy the blocks in the area given and drop the Item form, but will not only break minecraft:log. It will break every block.
If anyone can help me it would be greatly appreciated! I am running all the commands on a clock.
Best Answer
/execute's syntax:
/execute <target> X Y Z <command>
/execute <target> X Y Z detect X Y Z <block> <Damage> <command>
There is no section for dataTags. You must use a command that supports dataTags to apply a label based on NBT data first, such as /scoreboard, and then target the entity based on that label.
You should also not be using numerical IDs, since they are deprecated in 1.8 NBT data (and unusable in most command syntax) and no longer works at all in 1.9.
Item replacement
Instead of summoning a new item to 'replace' another item, you can use /entitydata to change the ID of the already-existing item.
Prerequisites:
An objective to label the item entity as being a double plant.
/scoreboard objectives add DoublePlant dummy
Clock commands:
The following must be run in numerical order on a clock.
First, assign a score to items that are double plants.
/scoreboard players set @e[type=Item] DoublePlant 1 {Item:{id:"minecraft:double_plant"}}Change the ID of the item using /entitydata.
/entitydata @e[type=Item,score_DoublePlant_min=1] {Item:{id:"minecraft:log"}}Reset the score of the item.
/scoreboard players reset @e[type=Item,score_DoublePlant_min=1] DoublePlant
Entity replacement
As per title, if you intend to replace an item entity with a non-item entity, you will need to use /execute like you've done, but with the proper label.
Prerequisites:
An objective to label the item entity as being a double plant.
/scoreboard objectives add DoublePlant dummy
Clock commands:
The following must be run in numerical order on a clock.
First, assign a score to items that are double plants.
/scoreboard players set @e[type=Item] DoublePlant 1 {Item:{id:"minecraft:double_plant"}}Summon a new entity at double plant items.
/execute @e[type=Item,score_DoublePlant_min=1] ~ ~ ~ summon CreeperKill the item entity to prevent constant summoning of creepers (which will also clear its scoreboard.dat record automatically).
/kill @e[type=Item,score_DoublePlant_min=1]
1.9 changes
Instead of using scoreboard objectives, you can use the new "tags" feature to apply a label directly onto the entity. The benefit is a less-bloated scoreboard.dat (since scoreboard.dat is not involved at all) and easier prevention of constant command activation.
Assign a tag to items that are double plants.
/scoreboard players tag @e[type=Item,tag=!DoublePlant] add DoublePlant {Item:{id:"minecraft:double_plant"}}Change the item's ID using /entitydata while also removing all tags from the item at the same time to prevent constant activation.
/entitydata @e[type=Item,tag=DoublePlant] {Item:{id:"minecraft:log"},Tags:[]}
Pictures about "How do I change one Item Entity into another/different entity using commands?"



How do you replace an entity with another entity in Minecraft?
You can use the /replaceitem command to instanty replace one item with another item. You can replace armor items worn, weapons held in your hands, items stored in chests and items in your inventory/hotbar. This is a great way to quickly put armor on a player during a Minecraft battle or change out a worn out weapon.How do I use item modify entity?
You can use the /data command to get, merge and remove NBT tags (formerly called data tags) for entities and block entities. The /data command is most useful for changing attributes of a mob after the mob has spawned or modifying attributes of a block entity after you have placed it.How do you use the entity data command in Minecraft?
replace - Replaces all blocks (including air) in the fill region with the specified block, without dropping blocks or block contents as entities.SpringBoot : Spring Data JPA - One To Many \u0026 Join Query | Example | Java Techie
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ketut Subiyanto, Ketut Subiyanto, Ketut Subiyanto, Ketut Subiyanto
