Do you already know the new command block types we got in snapshot 15w34a? Well, they allow you to easily chain up command blocks that will all execute within 1 tick, as well as command blocks that trigger every tick when they're powered.
While this will definitely make complex command block contraptions more compact and easier to work on, I think there's still a crucial element missing: We now have normal command blocks, chains, and clocks, but not really anything that can make decisions. That's why I'm suggesting...
The branch command block
Well, I admit that my texturing skills aren't that good, but I didn't write this suggestion for looks, it's the function that is important.
What this command block does is very similar to the chain command block, but with one crucial difference: If the command fails (so that a comparator connected to it would stay off), it will act as if it's pointed the other way.
Here's an example of how a circuit utilizing this mechanic could look:
If the command in the yellow command block is executed successfully, that block acts as a normal chain block, and the execution path will follow the direction of the white arrow, which in this case means that the top row of command blocks will be executed. If the command isn't executed succesfully, it'll act like a chain block turned the other way, and the execution path will follow the direction of the black arrow. In this circuit, that means that the bottom row of command blocks will be executed.
If you don't need to run commands for both a positive result and a negative result, then you can just add them 'inline', like this:
On the top row, the chain blocks to the right of the branch block will only be executed if the command in the branch block executed succesfully.
On the middle row, the chain blocks to the right of the branch blocks will only execute if the command in the branch block didn't execute succesfully.
In other cases, it'll act like the bottom row, and the execution will stop once it reaches the branch block (those blocks are secured so that they can't trigger multiple times on one tick, so that loops don't cause a freeze). I just noticed that the normal command block at the start of the bottom row is turned the other way, so just imagine that it's rotated 180° for now.
Unlike chain blocks, branch blocks do not have to be powered to run their commands.
So, what do you guys think of this suggestion? Would you use it? Or would you prefer to find weird workarounds to do stuff like this?
Note: The chain blocks are already in the snapshot, they are not a part of my suggestion.
The conditional and unconditional blocks allowed me to create a circuit that does basically what my suggestion does, but since it relies on changing a block with /setblock, it always uses the result from the previous time the command block was triggered. This doesn't make a big difference in clocks, but when you only run a row of command blocks on certain events, then it can mess things up.
Decision-making on a singe tick is curently possible by using a controler entity with a scoreboard value (since even when a conditional block doesn't run, it keeps the chain running). You can for example use an armour stand with a "success" score. Then you set the success score at the start of a command block row to 0, then execute the command you want to test, then add a conditional command block which sets the succes score to 1, then you use execute commands that check for a succes score of 1 for the commands that should run when the test command was succesfull and run execute commands that check for a succes score of 0 for the commands that should run on failure.
But, since both chain command blocks and repeat command blocks were already somewhat possible using redstone and command magic, I'm not dropping this suggestion yet. They're making command blocks more intuitive and more programming-style, and I think that controlling which branch runs is a very basic control structure that really could use a more intuitive way to build.
SUPPORT SUPPORT SUPPORT!!! I was thinking of making a better command blocks mod, but that has some obvious issues. if they can add all this stuff in vanilla minecraft, I will be SOOO happy! now they just need to implement some sort of variables... probably going to make my own post on that.
Rollback Post to RevisionRollBack
If i where banned from minecraft, i would die of sadness...
I also need this. Using "fill gates" just isn't reliable! Support! Support! Support! This would seriously fix a technical issue that I have. It's not a bug but the game cannot compensate for it; but this command block would force it to!
Feel Free to PM me to talk about anything. Read the guidelines below if you want me to respond though.
1. I' not debating anything. This is a forum, a place for relaxing and having fun.
2. Don't PM me support questions.
3. Don't ask me to join your Faction/League/Clan.
4. If you need someone to write a lore for an RPG or help with some story ideas, don't hesistate to ask me! Although please note I can and will refuse to help with the storyline at any time.
5. Even if you have no other reason to PM other than just to say hi and chat, that's fine! I don't use PM just for straight serious stuff, I'm more than happy to chat.