0

So I am trying to be able to detect if a specific mob is dead and then execute a command. I have already tagged the mob "boss1" and I know that you need a tag to detect the entity but I don't know the commands to actually detect it.

2

You will need to check for the entity using /execute.

/execute unless entity @e[tag=boss1] run ...

Run the command unless there is an entity with the tag boss1.

When the boss dies, you can put the command to run after the run parameter.

6
  • Is there a way to make it only run once? – Firestryke Jun 2 '20 at 17:26
  • I figured it out – Firestryke Jun 2 '20 at 17:51
  • 1
    I had a repeating blinking circuit activating 2 command blocks with the /execute unless entity @e[tag=boss1] run ... command but one had the command I wanted to run and the other had a fill command that stopped the circuit by replacing certain blocks with air. – Firestryke Jun 2 '20 at 17:54
  • 1
    Great job, you figured it out! Please consider clicking the check button on the answer you find most useful. Thanks! – ExpertCoder14 Jun 2 '20 at 17:56
  • @ExpertCoder14 placing or removing a redstone block next to a repeating command block in order to turn it on or off isn't that bad. There are other ways to turn a repeating command block on and off, such as setting "Needs Redstone" when there isn't any power around to stop the chain, though. – MBraedley Jun 2 '20 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.