Skip to content

Instantly share code, notes, and snippets.

@Korko
Last active August 29, 2015 14:05
Show Gist options
  • Save Korko/1c15413cb8f594c0357c to your computer and use it in GitHub Desktop.
Save Korko/1c15413cb8f594c0357c to your computer and use it in GitHub Desktop.
[Minecraft][Command Blocks][1.8] LifeSteal enchantment # Using a sword with this enchantment will give you some heal back
# CommandBlock order : West, East, Down, Up, North, South
# /give @p minecraft:diamond_sword 1 0 {display:{Name:"LifeStealer"},ench:[{id:7,lvl:1}],HideFlags:1}
# /replaceitem entity @p slot.hotbar.0 minecraft:diamond_sword 1 0 {display:{Name:"LifeStealer"},ench:[{id:7,lvl:1}]}
# Only call once
/scoreboard objectives add LifeSteal dummy
/scoreboard objectives add DamageDealt stat.damageDealt
/scoreboard objectives add DamageAdded dummy
# Around a fast clock (20t/s)
# /fill ~ ~-1 ~ ~ ~-1 ~-1 redstone_block
# /fill ~ ~1 ~ ~ ~1 ~-1 stone
# Reset LifeSteal objective
/scoreboard players set @a[score_LifeSteal_min=1] LifeSteal 0
# Set the LifeSteal objective if using a sword with this enchantman)
/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:wooden_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}
/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:golden_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}
/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:stone_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}
/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:iron_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}
/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:diamond_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}
# Don't cheat, DamageDealt without a correct sword is reset
/scoreboard players set @a[score_LifeSteal=0] DamageDealt 0
# Be cool and keep the DamageDealt with the sword even if you change your weapon
/scoreboard players operation @a DamageAdded += @a[score_DamageDealt_min=1] DamageDealt
# Reset DamageDealt for everyone
/scoreboard players set @a DamageDealt 0
# If DamageAdded reachs a threshold, give regen enchantment to the player and reset the score
/effect @a[score_LifeSteal_min=1,score_DamageAdded_min=30] 10 1 50
# Reset player DamageAdded if reached a threshold
/scoreboard players remove @a[score_DamageAdded_min=30] DamageAdded 30
--- or in 1 command ---
/summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/fill ~ ~0 ~1 ~ ~-21 ~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 ~ ~ ~-25 ~1 air}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add DamageAdded dummy},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add DamageDealt stat.damageDealt},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/scoreboard objectives add LifeSteal dummy},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:/give @p minecraft:diamond_sword 1 0 {display:{Name:"LifeStealer"},ench:[{id:7,lvl:1}],HideFlags:1}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~3 ~-14 ~-1 command_block 0 replace {Command:/scoreboard players set @a[score_LifeSteal_min=1] LifeSteal 0}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~3 ~-13 ~1 command_block 0 replace {Command:/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:wooden_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~4 ~-12 ~-1 command_block 0 replace {Command:/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:golden_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~4 ~-11 ~1 command_block 0 replace {Command:/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:stone_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~5 ~-10 ~-1 command_block 0 replace {Command:/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:iron_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~5 ~-9 ~1 command_block 0 replace {Command:/scoreboard players set @a LifeSteal 1 {SelectedItem:{id:minecraft:diamond_sword,tag:{ench:[{id:7,lvl:1}],display:{Name:"LifeStealer"}}}}}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~6 ~-8 ~-1 command_block 0 replace {Command:/scoreboard players set @a[score_LifeSteal=0] DamageDealt 0}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~6 ~-7 ~1 command_block 0 replace {Command:/scoreboard players operation @a DamageAdded += @a[score_DamageDealt_min=1] DamageDealt}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~7 ~-6 ~-1 command_block 0 replace {Command:/scoreboard players set @a DamageDealt 0}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~7 ~-5 ~1 command_block 0 replace {Command:/effect @a[score_LifeSteal_min=1,score_DamageAdded_min=30] 10 1 50}},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:setblock ~8 ~-4 ~-1 command_block 0 replace {Command:/scoreboard players remove @a[score_DamageAdded_min=30] DamageAdded 30}},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 ~ ~8 ~-2 ~ redstone_block"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"setblock ~2 ~-1 ~-1 command_block 0 replace {Command:/fill ~ ~ ~1 ~7 ~ ~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 ~7 ~ ~-1 redstone_block 0 replace stone}"},Time:1,Riding:{id:"FallingSand",Block:stone,Time:1}}}}}}}}}}}}}}}}}}}}}}}}
@Korko
Copy link
Author

Korko commented Aug 25, 2014

TODO: Use Custom enchantment id and use Lore to display this enchantment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment