8

Is it possible to make a chicken drop something else instead of an egg by using commands? I've tried the following:

/summon Chicken ~  ~ ~ {Drop:[{id:diamond}]}   

It said "Object succesfully summoned", but the chicken still dropped an egg.
So, what is the command needed for spawning a chicken that lays diamonds?

2 Answers 2

8

There is no simple command to do this, but I have found a way to replace eggs that were just laid by a chicken with a diamond.

This makes use of the chicken's EggLayTime data tag, to mark chickens which are about to lay an egg. Unfortunately, this tag never actually reaches 0, it resets immediately. So, marking them 1 tick before will have to suffice. Create a scoreboard objective for the chickens:

/scoreboard objectives add eggLayer dummy

Now set up a repeat/chain command block line, and put in the following commands:

/scoreboard players remove @e[type=Chicken,score_eggLayer_min=1] eggLayer 1
/scoreboard players set @e[type=Chicken] eggLayer 2 {EggLayTime:1}
/execute @e[type=Chicken,score_eggLayer=1,score_eggLayer_min=1] ~ ~ ~ /scoreboard players tag @e[type=Item,c=1,r=1] add laidEgg {Item:{id:minecraft:egg}}
/entitydata @e[type=Item,tag=laidEgg] {Item:{id:minecraft:diamond},Tags:[]}

Chickens that will lay an egg in 1 tick get an eggLayer score of 2, which automatically decreased by 1 per tick until it reaches 0 again. 1 tick later, when the egg is actually laid, it is marked with a tag and transformed into a diamond using /entitydata.

0
/summon Chicken ~0 ~1 ~0 {Equipment:[{Count:1,id:whatever},{},{},{},{}],DropChances:[2.0F,0.0F,0.0F,0.0F,0.0F]}

The chicken will drop the item listed as whatever whenever it's killed.

1
  • 2
    This will make the chicken drop the item when killed, but not lay it as it lays an egg (which seems to be what OP wants).
    – SirBenet
    Feb 20, 2016 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .