Is it possible to recharge a respawn anchor automatically?

I am trying to make a time bomb for a mini game map, involving a pillar of quartz, and a respawn anchor on the top. Gradually, the respawn anchor recharges, and once it has been fully charged (because you’re in the overworld) it explodes.

The issue is that I need to automatically recharge the anchor to a full charge, and then blow it up, without any player involvement.


Is there a way to fully recharge a respawn anchor automatically and then blow it up without player involvement?


After doing a little digging around with the /setblock command, you can actually set how many charges a respawn anchor has by using the blockstate option like so:

no charges: /setblock ~~~ respawn_anchor 0

1 charge: /setblock ~~~ respawn_anchor 1

2 charges: /setblock ~~~ respawn_anchor 2

3 charges: /setblock ~~~ respawn_anchor 3

4 charges: /setblock ~~~ respawn_anchor 4

For my problem, I can then clear the respawn anchor, then summon tnt at it’s position, simulating an explosion!


Use a dispenser!


What you need:

  • Redstone dust.
  • Observers.
  • A dispenser.
  • Stacks of glowstone.
  • A respawn anchor.
  • A redstone repeater.

Screenshot of my hotbar.

Layout

Place an observer with 3 pieces of redstone dust coming out of it in an wrap around shape. Next, place another observer to where it's observing this restone trail. Then create a trail to the adjacent face of the tile the last trail stopped at. Go back to the corner of that trail and place a redstone repeater (maximum delay) just after the turn. Then next to the origin, place a dispenser, facing the tile the first observer is watching, at the end of the chains of restone dust:

Screenshot of the repeating configuration.

Fill the Dispenser

Next, place your stacks of glowstone in the dispenser:

Screenshot of the dispenser filled with glowstone.

Place the Anchor

The last step is to place the anchor. This must happen last so that it triggers the observer; the completed configuration should look like this:

Screenshot of the completed configuration.

The Problem

There's a big problem with this plan though. Since the respawn anchor explodes in the overworld, you only get one use:

Screenshot of the aftermath.