Execute give mob kill command (v. 1.15.2)?

Cl
6

I'm building a Minecraft map in version 1.15.2!

I want to do a challenge that if you kill an Elder Guardian then a lever is dropped.

How does this work?

I guess with a execute command, but I don't know exactly.

I thank you in advance for your help👌

Be

You can do this simply by putting a lever in the guardian's inventory

/ data merge entity @e [type = elder_guardian, limit = 1, sort = nearest] {HandItems: [{id: "minecraft: lever", Count: 1b}, {}], HandDropChances: [2.000F, 0.085F] }

Cl

But still no lever is dropped.

Be

Try it like this:

/ data merge entity @e [type = elder_guardian, limit = 1, sort = nearest] {HandItems: [{id: "minecraft: lever", Count: 1b}, {}], HandDropChances: [1,000F, 0.085F] }

Cl

How should I connect the command blocks? I once have the command block with the summon command and the one with the data command… Should I simply combine the two command blocks with redstone?

Be

The / data command causes an existing guardian to drop the lever.

With this command you can directly spawn one that drops a lever: (then you no longer need the other one)

/ summon minecraft: elder_guardian ~ ~ ~ {HandItems: [{id: "minecraft: lever", Count: 1b}, {}], HandDropChances: [1,000F, 0.085F]}

Cl

Okay thanks