TransWikia.com

How can I make a T Fip Flop with commands in 1.13+?

Arqade Asked by David Bailey on September 29, 2021

I’m new to command blocks and I was watching this garage door tutorial which uses the following command to implement a T Flip Flop, i.e. it alternates between success and failure upon each activation:

testforblock ~ ~ ~ minecraft:command_block -1 {SuccessCount:0}

However, I’m using Minecraft 1.16.5 – I’m aware that testforblock was removed in Minecraft 1.13 and onwards in favour of execute if.

I tried the following:

execute if block ~ ~ ~ minecraft:command_block{SuccessCount:0}

However this seems to result in continuous success, due to the missing dataValue (set to -1) in the original command. edit: -1 is the same as not specifying anything according to the wiki

The following doesn’t work due to a syntax error:

execute if block ~ ~ ~ minecraft:command_block -1 {SuccessCount:0}

How can I implement a T Flip Flop using a command block in Minecraft Java Edition versions 1.13 and newer?

One Answer

It seems like the technique used to test for a success count in previous versions does not work in 1.13+, due to unknown reasons.

I have found a solution which unfortunately involves an arbitrary storage location (scoreboard) but works:

execute store success score @p test run execute if score @p test matches 0

You will have to set up a scoreboard objective named test and have this command store its success in the score.


P.S. For all you command gurus out there who want me to remove run execute from my command, I would prefer to keep run execute in on this command because my practice is to keep it in only for the last subcommand.

Correct answer by ExpertCoder14 on September 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP