经过我蛋疼了N个星期后终于做出了完整版本,这个版本有手榴弹高爆雷闪光弹烟雾弹四种手雷,还用了村民的自定义交易,然后我也用这个东西成功混进了TML,好了不说了,放OOC
- /summon FallingSand ~ ~1 ~2 {Time:1,Block:"minecraft:redstone_block",Passengers:[{id:"FallingSand",Time:1,Block:"minecraft:activator_rail",Passengers:[{id:"MinecartCommandBlock",Command:"/gamerule commandBlockOutput false"},{id:"MinecartCommandBlock",Command:"/scoreboard objectives add timer dummy"},{id:"MinecartCommandBlock",Command:"/scoreboard objectives add xptimer dummy"},{id:"MinecartCommandBlock",Command:"/scoreboard objectives add crafting dummy"},{id:"MinecartCommandBlock",Command:"/title @a title [{"text":"手榴弹模组安装成功","color":"red"}]"},{id:"MinecartCommandBlock",Command:"/title @a subtitle [{"text":"Freerr制作","color":"aqua"}]"},{id:"MinecartCommandBlock",Command:"/setblock ~ ~-1 ~-2 minecraft:air"},{id:"MinecartCommandBlock",Command:"/difficulty easy"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":""}]"},{id:"MinecartCommandBlock",Command:"/tellraw @a [{"text":"向村民丢一个绿宝石使其变成军火贩子!","color":"red","bold":"true"}]"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~2 ~0 repeating_command_block 1 replace {auto:1b,Command:"/testfor @a {SelectedItem:{id:minecraft:experience_bottle,tag:{display:{Name:\\"手榴弹\\",Lore:[0:\\"右键丢出使用\\"]}}}}"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~3 ~0 chain_command_block 9 replace {auto:1b,Command:"/scoreboard players tag @e[type=ThrownExpBottle] add true"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~4 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players add @e[type=XPOrb] xptimer 1"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~5 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=ThrownExpBottle,tag=true] ~ ~ ~ scoreboard players add @a timer 1"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~6 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players test @a timer 3"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~7 ~0 chain_command_block 9 replace {auto:1b,Command:"/execute @e[type=XPOrb,score_xptimer=5] ~ ~ ~ summon PrimedTnt"}"},{id:"MinecartCommandBlock",Command:"setblock ~0 ~8 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=PrimedTnt] ~ ~ ~ scoreboard players set @a timer 0"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~2 ~0 repeating_command_block 1 replace {auto:1b,Command:"/scoreboard players tag @e[type=Item] add GBL {Item:{id:minecraft:magma_cream,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"高爆雷\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~3 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=Item,tag=GBL,score_timer_min=50] ~ ~ ~ summon Creeper ~ ~ ~ {ighted:1,Fuse:0,ExplosionRadius:10b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~4 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players tag @e[type=Item] add SGD {Item:{id:minecraft:slime_ball,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"闪光弹\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~5 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=Item,tag=SGD,score_timer_min=50] ~ ~ ~ effect @e[r=5] 15 15 0 true"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~6 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players tag @e[type=Item] add YWD {Item:{id:minecraft:firework_charge,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"烟雾弹\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~7 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=Item,tag=YWD,score_timer_min=50] ~ ~ ~ /particle largesmoke ~ ~2 ~ 5 5 5 0.0 10000"}"},{id:"MinecartCommandBlock",Command:"setblock ~1 ~8 ~0 chain_command_block 1 replace {auto:1b,Command:"/kill @e[type=Item,score_timer_min=50]"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~2 ~0 repeating_command_block 1 replace {auto:1b,Command:"/scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:magma_cream,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"高爆雷\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~3 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:slime_ball,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"闪光弹\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~4 ~0 chain_command_block 1 replace {auto:1b,Command:"/scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:firework_charge,tag:{display:{Lore:[\\"按Q丢出使用\\"],Name:\\"烟雾弹\\"}}},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~5 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=Villager] ~ ~ ~ scoreboard players tag @e[type=Item,r=1] add CM {Item:{id:\\"minecraft:emerald\\"},OnGround:1b}"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~6 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[type=Item,tag=CM] ~ ~ ~ execute @e[type=Villager,r=1] ~ ~ ~ scoreboard players tag @e[type=Villager,r=1] add CM1"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~7 ~0 chain_command_block 1 replace {auto:1b,Command:"/entitydata @e[type=Villager,tag=CM1] {Profession:3,CustomName:\\"军火贩子\\",CustomNameVisible:1,Offers:{Recipes:[{maxUses:99999,buy:{id:gold_ingot,Count:10},sell:{id:experience_bottle,Count:1,tag:{display:{Name:\\"手榴弹\\",Lore:[右键丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:magma_cream,Count:1,tag:{display:{Name:\\"高爆雷\\",Lore:[按Q丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:slime_ball,Count:1,tag:{display:{Name:\\"闪光弹\\",Lore:[按Q丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:firework_charge,Count:1,tag:{display:{Name:\\"烟雾弹\\",Lore:[按Q丢出使用]}}}}]}}"}"},{id:"MinecartCommandBlock",Command:"setblock ~2 ~8 ~0 chain_command_block 1 replace {auto:1b,Command:"/execute @e[tag=CM1] ~ ~ ~ kill @e[type=Item,tag=CM,r=1]"}"},{id:"MinecartCommandBlock",Command:"/setblock ~ ~-1 ~ minecraft:lava 15"},{id:"MinecartCommandBlock",Command:"setblock ~ ~ ~ air 0"}]}]}
命令详解:
- //只需执行一次的命令{
- init:/gamerule commandBlockOutput false
- //关闭命令方块输出
- init:/scoreboard objectives add timer dummy
- //新建计时器——计分板timer
- init:/scoreboard objectives add xptimer dummy
- //新建计时器2——计分板xptimer
- init:/scoreboard objectives add crafting dummy
- //新建用于合成的计分板
- init:/title @a title [{"text":"手榴弹模组安装成功","color":"red"}]
- //主标题
- init:/title @a subtitle [{"text":"Freerr制作","color":"aqua"}]
- //副标题
- init:/setblock ~ ~-1 ~-2 minecraft:air
- //替换命令方块为空气
- init:/difficulty easy
- //修改难度为简单(和平模式下高爆雷不可用)
- //无聊的提示部分{
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":""}]
- init:/tellraw @a [{"text":"向村民丢一个绿宝石使其变成军火贩子!","color":"red","bold":"true"}]
- //(其实是我懒得换行)
- //}
- //}
- //手榴弹引爆部分{
- rcb:/testfor @a {SelectedItem:{id:minecraft:experience_bottle,tag:{display:{Name:"手榴弹",Lore:[0:"右键丢出使用"]}}}}
- //检测玩家手里的物品是否合格
- cond:/scoreboard players tag @e[type=ThrownExpBottle] add true
- //合格则给经验瓶添加tag
- /scoreboard players add @e[type=XPOrb] xptimer 1
- //每tick给经验球的xptimer加一分
- /execute @e[type=ThrownExpBottle,tag=true] ~ ~ ~ scoreboard players add @a timer 1
- //增加计时器分数
- /scoreboard players test @a timer 3
- //检测计时器的分数是否超过三
- cond:/execute @e[type=XPOrb,score_xptimer=5] ~ ~ ~ summon PrimedTnt
- //如果是则使xptimer分数小于5的经验球召唤点燃的tnt
- /execute @e[type=PrimedTnt] ~ ~ ~ scoreboard players set @a timer 0
- //让点燃的tnt重置计时器的分数
- //}
- //拓展手雷引爆部分{
- new 1 0 0
- rcb:/scoreboard players tag @e[type=Item] add GBL {Item:{id:minecraft:magma_cream,tag:{display:{Lore:["按Q丢出使用"],Name:"高爆雷"}}},OnGround:1b}
- //给高爆雷添加tag
- /execute @e[type=Item,tag=GBL,score_timer_min=50] ~ ~ ~ summon Creeper ~ ~ ~ {ighted:1,Fuse:0,ExplosionRadius:10b}
- //使高爆雷爆炸
- /scoreboard players tag @e[type=Item] add SGD {Item:{id:minecraft:slime_ball,tag:{display:{Lore:["按Q丢出使用"],Name:"闪光弹"}}},OnGround:1b}
- //给闪光弹添加tag
- /execute @e[type=Item,tag=SGD,score_timer_min=50] ~ ~ ~ effect @e[r=5] 15 15 0 true
- //给闪光弹5格以内的实体添加失明效果
- /scoreboard players tag @e[type=Item] add YWD {Item:{id:minecraft:firework_charge,tag:{display:{Lore:["按Q丢出使用"],Name:"烟雾弹"}}},OnGround:1b}
- //给烟雾弹添加tag
- /execute @e[type=Item,tag=YWD,score_timer_min=50] ~ ~ ~ /particle largesmoke ~ ~2 ~ 5 5 5 0.0 10000
- //让烟雾弹在五格范围内生成烟雾效果
- /kill @e[type=Item,score_timer_min=50]
- //清除爆炸后的手雷
- //}
- //三种拓展手雷计时部分{
- new 2 0 0
- rcb:/scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:magma_cream,tag:{display:{Lore:["按Q丢出使用"],Name:"高爆雷"}}},OnGround:1b}
- //给高爆雷的计时器加一分
- /scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:slime_ball,tag:{display:{Lore:["按Q丢出使用"],Name:"闪光弹"}}},OnGround:1b}
- //给闪光弹的计时器加一分
- /scoreboard players add @e[type=Item] timer 1 {Item:{id:minecraft:firework_charge,tag:{display:{Lore:["按Q丢出使用"],Name:"烟雾弹"}}},OnGround:1b}
- //给烟雾弹的计时器加一分
- //}
- //自定义村民部分{
- /execute @e[type=Villager] ~ ~ ~ scoreboard players tag @e[type=Item,r=1] add CM {Item:{id:"minecraft:emerald"},OnGround:1b}
- //让村民给物品添加tag
- /execute @e[type=Item,tag=CM] ~ ~ ~ execute @e[type=Villager,r=1] ~ ~ ~ scoreboard players tag @e[type=Villager,r=1] add CM1
- //让物品给村民添加tag
- /entitydata @e[type=Villager,tag=CM1] {Profession:3,CustomName:"军火贩子",CustomNameVisible:1,Offers:{Recipes:[{maxUses:99999,buy:{id:gold_ingot,Count:10},sell:{id:experience_bottle,Count:1,tag:{display:{Name:"手榴弹",Lore:[右键丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:magma_cream,Count:1,tag:{display:{Name:"高爆雷",Lore:[按Q丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:slime_ball,Count:1,tag:{display:{Name:"闪光弹",Lore:[按Q丢出使用]}}}},{maxUses:99999,buy:{id:gold_ingot,Count:20},sell:{id:firework_charge,Count:1,tag:{display:{Name:"烟雾弹",Lore:[按Q丢出使用]}}}}]}}
- //修改符合条件的村民NBT
- /execute @e[tag=CM1] ~ ~ ~ kill @e[type=Item,tag=CM,r=1]
- //修改完成后清除物品
- //}

