砖头强化

By MCSugar_cane    2018/03/17

板砖,又名砖头,在现实中以其方便性、普遍性使其登临十大利器之榜。可在MC里,它却变成了只能拿来装饰的红砖。我觉得不行.png

所以在增加硬化砖头的攻击和击退上,还使其可以将敌人击晕,详情如下(雾):

砖头使用说明

代码适用版本为1.11.2-1.12,逻辑支持1.8.x以上版本

使用说明:

  1. 初步硬化:红砖(普通)x1,铁粒x8,粘土x2
  2. 高度硬化:红砖(初步硬化)x1,钻石x2,粘土x2

我的世界砖头强化0我的世界砖头强化1

图片就介绍到这里,下面是详情以及代码部分~


详情:

砖头的合成就不用说啦,就是检测掉落物无序合成的玩意,具体方法可见:检测掉落物

关于击晕敌人,首先要检测玩家是否拿着硬化砖头,拿着的玩家是否攻击(造成伤害),如果满足,则检测附近谁受到了伤害。如果A受到了伤害,就表明拿着硬化砖头的攻击对象是A,虽然这个做不到完全准确,不过在MC中用命令方块也只有这样了。在玩家拿着不同硬度的砖头攻击一定次数后,即击晕敌人。


代码:

基础部分:

  1. /scoreboard objectives add gitems dummy
  2. /scoreboard objectives add hitems dummy 手持判断
  3. /scoreboard objectives add ztDamage stat.damageDealt 玩家造成伤害
  4. /scoreboard objectives add ztDT stat.damageTaken 玩家受到伤害
  5. /scoreboard objectives add ztHurt dummy 实体受到伤害
  6. /scoreboard objectives add ztFaint dummy
  7. /scoreboard objectives add ztTimer dummy

合成砖头——初步硬化:[高频循环]

  1. /scoreboard players set @e[type=item] gitems 1 {Item:{id:"minecraft:brick",Count:1b,Damage:0s},OnGround:1b}
  2. /scoreboard players set @e[type=item] gitems 0 {Item:{id:"minecraft:brick",Count:1b,Damage:0s,tag:{ZTLevel:2l}},OnGround:1b}
  3. /scoreboard players set @e[type=item] gitems 2 {Item:{id:"minecraft:iron_nugget",Count:8b,Damage:0s},OnGround:1b}
  4. /scoreboard players set @e[type=item] gitems 3 {Item:{id:"minecraft:clay_ball",Count:2b,Damage:0s},OnGround:1b}
  5. /execute @e[type=item,score_gitems_min=1,score_gitems=1] ~ ~ ~ execute @e[type=item,score_gitems_min=2,score_gitems=2,r=1] ~ ~ ~ execute @e[type=item,score_gitems_min=3,score_gitems=3,r=1] ~ ~ ~ scoreboard players tag @e[type=item,score_gitems_min=1,score_gitems=1,r=2,c=1] add creaftZT1
  6. /execute @e[type=item,tag=creaftZT1] ~ ~ ~ summon Item ~ ~0.2 ~ {PickupDelay:20s,Age:-23333s,Motion:[0.0d,0.2d,0.0d],CustomName:"初步硬化的红砖",CustomNameVisible:1b,Item:{id:minecraft:brick,Count:1b,Damage:0s,tag:{display:{Name:"砖头",Lore:["用精铁造成的红砖","较难将敌人敲晕"]},ench:[{id:34,lvl:10},{id:16,lvl:3},{id:19,lvl:1}],HideFlags:63,ZTLevel:1l}}}
  7. /execute @e[type=item,tag=creaftZT1] ~ ~ ~ particle angryVillager ~ ~ ~ .3 .5 .3 .1 30
  8. /execute @e[type=item,tag=creaftZT1] ~ ~ ~ kill @e[type=item,score_gitems_min=1,score_gitems=3,r=2]

合成砖头——高度硬化:[高频循环]

  1. /scoreboard players set @e[type=item] gitems 4 {Item:{id:"minecraft:brick",Count:1b,Damage:0s,tag:{ZTLevel:1l}},OnGround:1b}
  2. /scoreboard players set @e[type=item] gitems 5 {Item:{id:"minecraft:diamond",Count:2b,Damage:0s},OnGround:1b}
  3. /execute @e[type=item,score_gitems_min=4,score_gitems=4] ~ ~ ~ execute @e[type=item,score_gitems_min=5,score_gitems=5,r=1] ~ ~ ~ execute @e[type=item,score_gitems_min=3,score_gitems=3,r=1] ~ ~ ~ scoreboard players tag @e[type=item,score_gitems_min=4,score_gitems=4,r=2,c=1] add creaftZT2
  4. /execute @e[type=item,tag=creaftZT2] ~ ~ ~ summon Item ~ ~0.2 ~ {PickupDelay:40s,Age:-23333s,Motion:[0.0d,0.2d,0.0d],CustomName:"高度硬化的红砖",CustomNameVisible:1b,Item:{id:minecraft:brick,Count:1b,Damage:0s,tag:{display:{Name:"砖头",Lore:["用钻石造成的红砖","容易将敌人敲晕"]},ench:[{id:34,lvl:10},{id:16,lvl:8},{id:19,lvl:2}],HideFlags:63,ZTLevel:2l}}}
  5. /execute @e[type=item,tag=creaftZT2] ~ ~ ~ particle angryVillager ~ ~.5 ~ .5 1 .5 .1 50
  6. /execute @e[type=item,tag=creaftZT2] ~ ~ ~ kill @e[type=item,score_gitems_min=3,score_gitems=5,r=2]

砖头眩晕:[高频循环]

    初始化
  1. /scoreboard players reset @a[score_hitems_min=1] hitems
  2. /scoreboard players set @a hitems 1 {SelectedItem:{id:"minecraft:brick",Damage:0s,tag:{display:{Name:"砖头"},ZTLevel:1l}}}
  3. /scoreboard players set @a hitems 2 {SelectedItem:{id:"minecraft:brick",Damage:0s,tag:{display:{Name:"砖头"},ZTLevel:2l}}}
  4. 检测实体受伤
  5. /scoreboard players reset @e[score_ztHurt_min=1] ztHurt
  6. /scoreboard players add @e[type=!item] ztHurt 1 {HurtTime:10s}
  7. 眩晕操作
  8. /execute @a[score_hitems_min=1,score_ztDamage_min=10] ~ ~ ~ execute @a[rm=0,score_ztDT_min=1,r=6] ~ ~ ~ scoreboard players operation @p[r=0] ztFaint += @a[score_hitems_min=1,score_ztDamage_min=10,r=6] hitems
  9. /execute @a[score_hitems_min=1,score_ztDamage_min=10] ~ ~ ~ execute @e[rm=0,score_ztHurt_min=1,r=6] ~ ~ ~ scoreboard players operation @e[r=0,c=1] ztFaint += @a[score_hitems_min=1,score_ztDamage_min=10,r=6] hitems
  10. /scoreboard players reset @a[score_ztDamage_min=10] ztDamage
  11. /scoreboard players reset @a[score_ztDT_min=1] ztDT
  12. /scoreboard players tag @e[score_ztFaint_min=5] add beFaint
  13. /scoreboard players reset @e[tag=beFaint] ztFaint
  14. /execute @e[tag=beFaint] ~ ~ ~ particle mobSpellAmbient ~ ~0.5 ~ .3 .3 .3 0.01 300
  15. /entitydata @e[tag=beFaint] {NoAI:1b}
  16. /scoreboard players set @e[tag=beFaint] ztTimer 1
  17. /effect @e[tag=beFaint] slowness 2 255 true
  18. /effect @e[tag=beFaint] nausea 3 1 true
  19. /scoreboard players tag @e[tag=beFaint] remove beFaint
  20. /scoreboard players add @e[score_ztTimer_min=1] ztTimer 1
  21. /entitydata @e[score_ztTimer_min=30] {NoAI:0b}
  22. /scoreboard players reset @e[score_ztTimer_min=30] ztTimer


OOC:

v1.11.2-v1.12.2
展开


欢迎加群交流划水:481528679