Skip to content

Instantly share code, notes, and snippets.

@rphsoftware
Created October 21, 2022 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rphsoftware/7e17776fa63825613a0f967f5206dfb9 to your computer and use it in GitHub Desktop.
Save rphsoftware/7e17776fa63825613a0f967f5206dfb9 to your computer and use it in GitHub Desktop.
# Given a 3 block column at armor_stand[tag=InternalAdderInput]
# places a single output bit at armor_stand[tag=InternalAdderOutput]
# and the carry flag at armor_stand[tag=InternalAdderInput].z + 1, y + 2
# then moves output and input ahead in z by 1 block.
scoreboard objectives add wacraft_adder_internals dummy [{"text":"Adder Internals"}]
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] run scoreboard players reset @s wacraft_adder_internals
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] run scoreboard players set @s wacraft_adder_internals 0
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] at @s run execute if block ~ ~ ~ minecraft:white_wool run scoreboard players add @s wacraft_adder_internals 1
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] at @s run execute if block ~ ~1 ~ minecraft:white_wool run scoreboard players add @s wacraft_adder_internals 1
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] at @s run execute if block ~ ~2 ~ minecraft:white_wool run scoreboard players add @s wacraft_adder_internals 1
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 0..1 run execute at @e[type=armor_stand,tag=InternalAdderInput] run setblock ~ ~2 ~1 minecraft:black_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 2..3 run execute at @e[type=armor_stand,tag=InternalAdderInput] run setblock ~ ~2 ~1 minecraft:white_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 0 run execute at @e[type=armor_stand,tag=InternalAdderOutput] run setblock ~ ~ ~ minecraft:black_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 1 run execute at @e[type=armor_stand,tag=InternalAdderOutput] run setblock ~ ~ ~ minecraft:white_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 2 run execute at @e[type=armor_stand,tag=InternalAdderOutput] run setblock ~ ~ ~ minecraft:black_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] if score @s wacraft_adder_internals matches 3 run execute at @e[type=armor_stand,tag=InternalAdderOutput] run setblock ~ ~ ~ minecraft:white_wool
execute as @e[type=armor_stand,tag=InternalAdderInput,limit=1] at @s run tp @s ~ ~ ~1
execute as @e[type=armor_stand,tag=InternalAdderOutput,limit=1] at @s run tp @s ~ ~ ~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment