本帖最后由 PotatoMaster101 于 2015-4-2 17:46 编辑

大家好。今天Mojang出了MC新版本:14w25a。这是2014年第25个星期的快照。这个快照更新了很多东西,还加入了一个新的生物:水下护卫。但是本帖子讲解的是新的书本和牌子Json。这个是/tellraw使用的raw Json message,现在可以用在书本和牌子上了。这个本人不会说太多,因为以前的Syl版主已经发过了Json信息的教程。(教程点击这里)

首先是牌子,但是在牌子上面是有限制的,牌子只能有4行字,而且每行字也不能太多,太多了显示不下。所以牌子最好显示单个玩家的名字和玩家的分数。这个十分简单,指令:
  1. /setblock ~ ~1 ~ minecraft:standing_sign 0 replace
  2. {Text1:"{text:"Hi, ",color:aqua,extra:[{selector:"@p",color:red,bold:true}]}",
  3. Text2:"{text:"1.8 Json Signs",color:green,underlined:true}",
  4. Text3:"{text:"Like It?"}",
  5. Text4:"{text:"Your Score :",color:red,extra:[{score:{objective:"Json",name:"@p"},bold:true}]}"}
复制代码
牌子的NBT本人就不多说了,像Text1,Text2那些。大家看指令第二行有“
{text:\"Hi, \",color:aqua,extra:[{selector:\"@p\",color:red,bold:true}]}”,这个就是新加入的Json系统。这个就是牌子显示的第一行,主要是刚开始是显示“Hi,”,然后就显示最近玩家的名字,第二行就是显示“1.8 Json Signs”,第三行显示“Like It?”,第四行显示“Your Score:”,然后显示最近玩家的Json积分板分数。(如果玩家未创建这个“Json”积分板,游戏将会把积分板的位置留空。)

之后来简单的讲一下比较难的的Json,普通的就不多说了。详情去看Syl的教程:
selector:" " - Json内的选择器,写@p,@a什么。选择玩家使用。
score:{objective:" ",name:" "} - Json内显示积分板分数。里面的objective就是变量名称,name就是玩家。这里的name也可以使用选择器(@p)。

之后来说下书本,书本就可以显示的更加全面了。指令:
  1. /give @p minecraft:written_book 1 0
  2. {author:"PotatoMaster101",title:"Test 14w25b",pages:[
  3. "{text:"This is Minecraft 14w25a. ",color:green,underlined:true,extra:[{text:"HAHAHAHA",obfuscated:true,color:dark_blue,underlined:false}]}",
  4. "{text:"Right now you're reading the new Json text.",color:black}",
  5. "{text:"Hover your mouse to me.",color:dark_aqua,hoverEvent:{action:show_text,value:"hoverEvent in books."}}",
  6. "{text:"Hover your mouse to me.",color:aqua,clickEvent:{action:run_command,value:"/kill @e"},hoverEvent:{action:show_text,value:"Click me and see what happens."}}"]}
复制代码
这条指令给玩家一个写完的书。作者显示的是PotatoMaster101。大家看到里面的内容什么都是用Json自定义过了。大家分解完指令后,就会发现:书本内也可以使用/tellraw的Event,比如:hoverEvent, clickEvent等等。这本书一共有4页,前2页只是在文字上面的改动,第三第四页就是开始使用hoverEvent和clickEvent了。


注意:书本的NBT内一定要加入{title},也就是自定义书名。从14w26c开始,不加入的话Json就会失效。

第三页的内容是:"text:\"Hover your mouse to me.\",color:dark_aqua,hoverEvent:{action:show_text,value:\"hoverEvent in books.\"",也就是说:会显示"Hover your mouse to me"这些字符,然后当玩家把鼠标移到字的上面,会显示"hoverEvent in books"这些字符。

最后一页就是hoverEvent和clickEvent合并,当玩家鼠标移动到字符上面后,会出现"Click me and see what happens"的字样,当玩家点击字符后,那将会执行一条指令。那条指令是:/kill @e

接下来就不多说了,这些都比较简单。这个帖子主要是给大家看看格式而已,也不算是是"教程"。新手实在看不懂的话点击这里。(Syl的/tellraw Json教程).

随便创造的指令(未整理):
  1. /give @p minecraft:written_book 1 0 {title:"PotatoMaster101 OP Book",author:"PotatoMaster101",ench:[],pages:["{text:"Miscellaneous",color:green,extra:[{text:"\n[Day Time]",color:aqua,clickEvent:{action:"run_command",value:"/time set 137"},hoverEvent:{action:"show_text",value:"Set time to day (137)"}},{text:"\n[Night Time]",color:gray,clickEvent:{action:"run_command",value:"/time set 17500"},hoverEvent:{action:"show_text",value:"Set time to night (17500)"}},{text:"\n[Creative]",color:red,clickEvent:{action:"run_command",value:"/gamemode 1 @p[r=0]"},hoverEvent:{action:"show_text",value:"Change to Creative Mode (m=1)"}},{text:"\n[Survival]",color:red,clickEvent:{action:"run_command",value:"/gamemode 0 @p[r=0]"},hoverEvent:{action:"show_text",value:"Change to Survival Mode (m=0)"}},{text:"\n[Adventure]",color:red,clickEvent:{action:"run_command",value:"/gamemode 2 @p[r=0]"},hoverEvent:{action:"show_text",value:"Change to Adventure Mode (m=2)"}},{text:"\n[Spectator]",color:red,clickEvent:{action:"run_command",value:"/gamemode 3 @p[r=0]"},hoverEvent:{action:"show_text",value:"Change to Spectator Mode (m=3)"}},{text:"\n[Kill Players]",color:dark_gray,clickEvent:{action:"run_command",value:"/kill @a"},hoverEvent:{action:"show_text",value:"Kill all players"}},{text:"\n[Kill Entities]",color:dark_gray,clickEvent:{action:"run_command",value:"/kill @e"},hoverEvent:{action:"show_text",value:"Kill all entities"}},{text:"\n[TP All]",color:dark_red,clickEvent:{action:"run_command",value:"/tp @a @p[r=0]"},hoverEvent:{action:"show_text",value:"TP all players to current location"}},{text:"\n[TP Random]",color:dark_red,clickEvent:{action:"run_command",value:"/tp @p[r=0] @r"},hoverEvent:{action:"show_text",value:"TP to a random player"}},{text:"\n[Clear Inventory]",color:blue,clickEvent:{action:"run_command",value:"/clear @a"},hoverEvent:{action:"show_text",value:"Clear all players inventory"}}]}","{text:"Gamerule",color:green,extra:[{text:"\nmobGriefing ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule mobGriefing true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule mobGriefing false"}},{text:"\ncommandBlockOutput ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule commandBlockOutput true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule commandBlockOutput false"}},{text:"\ndoMobLoot ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule doMobLoot true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule doMobLoot false"}},{text:"\ndoMobSpawning ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule doMobSpawning true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule doMobSpawning false"}},{text:"\ndoTileDrops ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule doTileDrops true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule doTileDrops false"}},{text:"\nkeepInventory ",color:gray},{text:"\n[True]  ",color:green,clickEvent:{action:"run_command",value:"/gamerule keepInventory true"}},{text:"  [False]",color:red,clickEvent:{action:"run_command",value:"/gamerule keepInventory false"}}]}","{text:"Effects",color:aqua,extra:[{text:"\n[Clear Effects]",color:red,clickEvent:{action:"run_command",value:"/effect @p[r=0] clear"},hoverEvent:{action:"show_text",value:"Clear all effects"}},{text:"\n[Night Vision]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:night_vision 99999 255 true"},hoverEvent:{action:"show_text",value:"Night Vision Effect"}},{text:"\n[Strength]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:strength 99999 255 true"},hoverEvent:{action:"show_text",value:"Strength Effect"}},{text:"\n[Haste]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:haste 99999 255 true"},hoverEvent:{action:"show_text",value:"Haste Effect"}},{text:"\n[Speed]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:speed 99999 10 true"},hoverEvent:{action:"show_text",value:"Speed Effect"}},{text:"\n[Invisibility]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:invisibility 99999 255 true"},hoverEvent:{action:"show_text",value:"Invisibility Effect"}},{text:"\n[Resistance]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:resistance 99999 255 true"},hoverEvent:{action:"show_text",value:"Resistance Effect"}},{text:"\n[Jump Boost]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:jump_boost 99999 5 true"},hoverEvent:{action:"show_text",value:"Jump Boost Effect"}},{text:"\n[Regeneration]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:regeneration 99999 255 true"},hoverEvent:{action:"show_text",value:"Regeneration Effect"}},{text:"\n[Water Breathing]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:water_breathing 99999 255 true"},hoverEvent:{action:"show_text",value:"Water Breathing Effect"}},{text:"\n[Saturation]",color:green,clickEvent:{action:"run_command",value:"/effect @p[r=0] minecraft:saturation 2 255 true"},hoverEvent:{action:"show_text",value:"Saturation Effect"}}]}","{text:"Get Item",color:blue,extra:[{text:"\n[Diamond Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:diamond_block 64 0"},hoverEvent:{action:"show_text",value:"Get Diamond Blocks"}},{text:"\n[Iron Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:iron_block 64 0"},hoverEvent:{action:"show_text",value:"Get Iron Blocks"}},{text:"\n[Gold Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:gold_block 64 0"},hoverEvent:{action:"show_text",value:"Get Gold Blocks"}},{text:"\n[Coal Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:coal_block 64 0"},hoverEvent:{action:"show_text",value:"Get Coal Blocks"}},{text:"\n[Redstone Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:redstone_block 64 0"},hoverEvent:{action:"show_text",value:"Get Restone Blocks"}},{text:"\n[Lapis Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:lapis_block 64 0"},hoverEvent:{action:"show_text",value:"Get Lapis Blocks"}},{text:"\n[Command Block]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:command_block 64 0"},hoverEvent:{action:"show_text",value:"Get Command Blocks"}},{text:"\n[Beacon]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:beacon 64 0"},hoverEvent:{action:"show_text",value:"Get Beacon"}},{text:"\n[Potato]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:baked_potato 64 0"},hoverEvent:{action:"show_text",value:"Get Potatoes"}},{text:"\n[Wood]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:log 64 0"},hoverEvent:{action:"show_text",value:"Get Wood"}},{text:"\n[Torch]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:torch 64 0"},hoverEvent:{action:"show_text",value:"Get Torch"}},{text:"\n[TNT]",color:aqua,clickEvent:{action:"run_command",value:"/give @p[r=0] minecraft:tnt 64 0"},hoverEvent:{action:"show_text",value:"Get TNT"}}]}"]}
复制代码
============END===========