Skip to content

Instantly share code, notes, and snippets.

@Korko
Last active August 29, 2015 14:05
Show Gist options
  • Save Korko/13106fa61ede051fc486 to your computer and use it in GitHub Desktop.
Save Korko/13106fa61ede051fc486 to your computer and use it in GitHub Desktop.
[Minecraft][Command Blocks][WIP] Torch Bomb - Launch a projectile that will explode into torches
# CommandBlock order : West, East, Down, Up, North, South
# Enchantment TorchBomber ID 101
# /give @p minecraft:bow 1 0 {display:{Lore:["TorchBomber"]},ench:[{id:101,lvl:1}]}
# /give @p minecraft:arrow 1
# Only call once
/scoreboard objectives add HandlingTorchBomber dummy
/scoreboard objectives add ArrowLifetime dummy
/scoreboard objectives add BombingArrow dummy
# Around a fast clock (20t/s)
# /fill ~ ~-1 ~ ~ ~-1 ~-1 redstone_block
# /fill ~ ~1 ~ ~ ~1 ~-1 stone
# Detecting which players has the boots
/scoreboard players set @a HandlingTorchBomber 0
/scoreboard players set @a HandlingTorchBomber 1 {SelectedItem:{tag:{ench:[{id:101,lvl:1}]}}}
# Computing arrows lifetime so we don't mixup with arrows coming towards the player holding the bow
/scoreboard players add @e[type=Arrow] ArrowLifetime 1
# Detecting arrows by the player
/execute @a[score_HandlingTorchBomber_min=1] ~ ~ ~ scoreboard players set @e[type=Arrow,score_ArrowLifetime=1,r=1] BombingArrow 1
# Now detecting when the arrow is on the ground
/scoreboard players set @e[type=Arrow,score_BombingArrow_min=1,score_BombingArrow=1] BombingArrow 2 {inGround:1}
# Summon some arrows from that spot
/execute @e[type=Arrow,score_BombingArrow_min=2,score_BombingArrow=2] ~ ~ ~ summon arrow {Motion:[.5,.5,.5],CustomName:"Lighter"}
# Detect when these arrows are on the ground in a limited radius
/execute @e[type=Arrow,score_BombingArrow_min=2,score_BombingArrow=2] ~ ~ ~ /scoreboard players set @e[type=Arrow,r=10] BombingArrow 3 {CustomName:"Lighter",inGround:1}
# Replace these arrows by torches
/entitydata @e[type=Arrow,score_BombingArrow_min=3] {id:"minecraft:torch"}
--- or in 1 command ---
/summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/fill ~ ~0 ~1 ~ ~-19 ~1 redstone_block},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~ ~3 ~1 stone},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~ ~4 ~ command_block 0 replace {Command:fill ~ ~2 ~ ~ ~-23 ~1 air}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add BombingArrow dummy},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add ArrowLifetime dummy},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add HandlingTorchBomber dummy},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/give @p minecraft:arrow 1},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/give @p minecraft:bow 1 0 {display:{Lore:["TorchBomber"]},ench:[{id:101,lvl:1}]}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~3 ~-11 ~-1 command_block 0 replace {Command:/scoreboard players set @a HandlingTorchBomber 0}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~3 ~-10 ~1 command_block 0 replace {Command:/scoreboard players set @a HandlingTorchBomber 1 {SelectedItem:{tag:{ench:[{id:101,lvl:1}]}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~4 ~-9 ~-1 command_block 0 replace {Command:/scoreboard players add @e[type=Arrow] ArrowLifetime 1}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~4 ~-8 ~1 command_block 0 replace {Command:/execute @a[score_HandlingTorchBomber_min=1] ~ ~ ~ scoreboard players set @e[type=Arrow,score_ArrowLifetime=1,r=1] BombingArrow 1}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~5 ~-7 ~-1 command_block 0 replace {Command:/scoreboard players set @e[type=Arrow,score_BombingArrow_min=1,score_BombingArrow=1] BombingArrow 2 {inGround:1}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~5 ~-6 ~1 command_block 0 replace {Command:/execute @e[type=Arrow,score_BombingArrow_min=2,score_BombingArrow=2] ~ ~ ~ summon arrow {Motion:[.5,.5,.5],CustomName:"Lighter"}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~6 ~-5 ~-1 command_block 0 replace {Command:/execute @e[type=Arrow,score_BombingArrow_min=2,score_BombingArrow=2] ~ ~ ~ /scoreboard players set @e[type=Arrow,r=10] BombingArrow 3 {CustomName:"Lighter",inGround:1}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~6 ~-4 ~1 command_block 0 replace {Command:/entitydata @e[type=Arrow,score_BombingArrow_min=3] {id:"minecraft:torch"}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:gamerule commandBlockOutput false},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"fill ~2 ~-2 ~ ~6 ~-2 ~ redstone_block"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"setblock ~2 ~-1 ~-1 command_block 0 replace {Command:/fill ~ ~ ~1 ~5 ~ ~1 stone 0 replace redstone_block}"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"setblock ~2 ~ ~1 command_block 0 replace {Command:/fill ~ ~ ~-1 ~5 ~ ~-1 redstone_block 0 replace stone}"},Time:1,Riding:{id:"FallingSand",Block:stone,Time:1}}}}}}}}}}}}}}}}}}}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment