【我的世界】不乏很多玩家自制的有趣代码,今天我为大家带来一篇可以把玩家体质变成僵尸体质的代码,接下来一起来和我看看吧。
今天给大家带来的是让玩家在日照下燃烧的命令 效果如下: 当玩家上方有方块时(从头部一直到255格高),阳光被遮蔽,不会燃烧。一旦没有方块遮蔽,玩家开始燃烧。 下雨天不会燃烧 戴帽子也不会燃烧(锁链帽子除外,因为挡不住阳光) 一旦失去帽子还是会燃烧。 基本原理: 让玩家在阳光下燃烧首先大多数人想到了阳光传感器...但是让玩家头顶一个阳光传感器是不现实的。 所以我们需要多条件判定玩家是否被光照。 首先需要判定时间是否是白天,之后需要判断天气是否是晴天,满足上述两个条件之后,再执行后续的判断,判断玩家是否带有帽子可以来探测玩家103号物品栏,最后再判断玩家头顶到255格方块中非空气的方块数量。 下面给上OOC代码 /summon falling_block ~ ~1.5 ~ {Time:1,Block:"minecraft:redstone_block",Motion:[0d,-1d,0d],Passengers:[{id:falling_block,Time:1,Block:"minecraft:activator_rail",Passengers:[{id:commandblock_minecart,Command:"blockdata ~ ~-2 ~ {auto:0b,Command:\"\"}"},{id:commandblock_minecart,Command:"/scoreboard objectives add time dummy"},{id:commandblock_minecart,Command:"/scoreboard objectives add time2 dummy"},{id:commandblock_minecart,Command:"/scoreboard objectives add rain dummy"},{id:commandblock_minecart,Command:"/scoreboard objectives add sun dummy"},{id:commandblock_minecart,Command:"/scoreboard objectives add head dummy"},{id:commandblock_minecart,Command:"/summon armor_stand ~ ~ ~ {CustomName:\"time\",CustomNameVisible:1b,NoGravity:0,Invisible:1}"},{id:commandblock_minecart,Command:"/summon armor_stand ~ ~ ~1 {CustomName:\"24000\",CustomNameVisible:1b,NoGravity:0,Invisible:1}"},{id:commandblock_minecart,Command:"/scoreboard players set @e[name=time] time 0"},{id:commandblock_minecart,Command:"/scoreboard players set @e[name=24000] time 24000"},{id:commandblock_minecart,Command:"setblock ~2 ~30 ~0 chain_command_block 1 replace {Command:\"/kill @e[type=small_fireball,score_time_min=100]\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~29 ~0 chain_command_block 1 replace {Command:\"/scoreboard players add @e[type=small_fireball] time 1\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~28 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a[score_sun_min=1] time 98\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~27 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a[score_head_min=1] time 98\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~26 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a[score_time_min=101] time 1\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~25 ~0 chain_command_block 1 replace {Command:\"/scoreboard players add @a[score_sun=0,score_head=0,team=!op] time 1\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~24 ~0 chain_command_block 1 replace {Command:\"/execute @a[score_sun=0,score_head=0,team=!op,score_time_min=99,score_time=99] ~ ~ ~ /summon minecraft:small_fireball ~ ~0.1 ~ {direction:[0.0,0.0,0.0],power:[0.0,0.9,0.0]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~23 ~0 chain_command_block 1 replace {Command:\"effect @a[score_sun=0,team=!op,score_head=0,score_time_min=99,score_time=99] minecraft:instant_health 1 0\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~22 ~0 chain_command_block 1 replace {Command:\"/execute @a ~ ~ ~ /clone ~ ~1 ~ ~ 255 ~ ~ ~1 ~ masked force\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~21 ~0 chain_command_block 1 replace {Command:\"/scoreboard players remove @a[score_head_min=1] head 1\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~20 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:pumpkin\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~19 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:leather_helmet\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~18 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:skull\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~17 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:diamond_helmet\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~16 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:golden_helmet\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~15 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @a head 2 {Inventory:[{id:\\"minecraft:iron_helmet\\",Slot:103b}]}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~13 ~0 chain_command_block 1 replace {Command:\"testfor @e[tag=!rain,score_time_min=0,score_time=12567,name=time,type=armor_stand]\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~12 ~0 chain_command_block 1 replace {Command:\"/execute @e[name=time,score_time2_min=12568,score_time2=12568] ~ ~ ~ /tellraw @a {\\"text\\":\\"[url=]\\",\\"extra\\":[{\\"text\\":\[/url]"夜幕降临,太阳的威胁不复存在了}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~11 ~0 chain_command_block 1 replace {Command:\"/execute @e[name=time,score_time2_min=1,score_time2=1] ~ ~ ~ /tellraw @a {\\"text\\":\\"[url=]\\",\\"extra\\":[{\\"text\\":\[/url]"太阳升起,耀眼的阳光将对你造成灼烧}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~10 ~0 chain_command_block 1 replace {Command:\"/execute @a[tag=!game2] ~ ~ ~ scoreboard players tag @p add game\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~9 ~0 chain_command_block 1 replace {Command:\"/execute @a[tag=!game2] ~ ~ ~ scoreboard players set @p head 0\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~8 ~0 chain_command_block 1 replace {Command:\"/execute @a[tag=!game2] ~ ~ ~ /stats entity @a set AffectedBlocks @p sun\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~7 ~0 chain_command_block 1 replace {Command:\"/execute @a[tag=!game2] ~ ~ ~ scoreboard players add @p sun 0\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~6 ~0 chain_command_block 1 replace {Command:\"/scoreboard players tag @e[name=time,type=armor_stand] remove rain {Fire:20s}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~5 ~0 chain_command_block 1 replace {Command:\"/scoreboard players tag @e[name=time,score_rain_min=19,score_rain=19,type=armor_stand] add rain {Fire:-1s}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~4 ~0 chain_command_block 1 replace {Command:\"/scoreboard players tag @e[name=time,score_rain_min=19,score_rain=19,type=armor_stand] add rain {Fire:0s}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~3 ~0 chain_command_block 1 replace {Command:\"/entitydata @e[name=time,score_rain_min=20,type=armor_stand] {Fire:25s}\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~2 ~0 chain_command_block 1 replace {Command:\"/scoreboard players set @e[name=time,score_rain_min=21,type=armor_stand] rain 0\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~1 ~0 chain_command_block 1 replace {Command:\"/scoreboard players add @e[name=time,type=armor_stand] rain 1\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~0 ~0 chain_command_block 1 replace {Command:\"/scoreboard players operation @e[name=time,c=1,type=armor_stand] time2 %= @e[name=24000,c=1,type=armor_stand] time\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~-1 ~0 chain_command_block 1 replace {Command:\"/scoreboard players operation @e[name=time,c=1,type=armor_stand] time2 = @e[name=time,c=1,type=armor_stand] time\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~14 ~0 repeating_command_block 9 replace {Command:\"\",auto:1b}"},{id:commandblock_minecart,Command:"setblock ~2 ~-2 ~0 repeating_command_block 1 replace {Command:\"/execute @e[type=armor_stand,name=time] ~ ~ ~ time query daytime\",auto:1b}"},{id:commandblock_minecart,Command:"/stats entity @e[name=time,type=armor_stand] set QueryResult @e[name=time,type=armor_stand] time"},{id:commandblock_minecart,Command:"/gamerule commandBlockOutput false"},{id:commandblock_minecart,Command:"/tellraw @a {\"text\":\"\",\"extra\":[{\"text\":\\",\"color\":\"gold\",\"bold\":true}]}"},{id:commandblock_minecart,Command:"setblock ~ ~1 ~ command_block 0 replace {auto:1b,Command:\"fill ~ ~ ~ ~ ~-2 ~ air\"}"},{id:commandblock_minecart,Command:"kill @e[type=commandblock_minecart,r=1]"}]}]}
|