本帖最后由 2398003522 于 2017-3-12 11:38 编辑
国外大大们做的地图都运用了很多命令,今天我就来讲讲做地图很实用的“书”的命令,希望大家喜欢。 (我用的游戏版本是1.11.2)
1、基础
最基础的命令当然是 give 命令了。
先输入 /give @p minecraft:written_book 获得一本书,不过在物品栏里不显示作者等信息,就只是一本“成书”。
然后打开,它就显示 * Invalid book tag * 。
2、简单
输入 /give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:["你好"]} ,得到一本书,现在在物品栏里就显示作者等信息了。名称:hello,作者:xiao___sun,还是原稿。
然后打开书,里面写着“你好”的两个黑字。
3、设置字体颜色
上一步的“你好”两个字是黑色的,那么怎样变成彩色呢?答案很简单,只需改一下:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你好\",\"color\":\"green\"}"]}
然后再看,发现里面的字变成绿色的了。
如果仔细看看代码,会发现和告示很像(如果会用告示牌的话)。
在 pages:[<页码>:"{}"] 中的 {} 下还可以加其他代码:
\"bold\":\"true\" 加粗
\"italic\":\"true\" 斜体
\"underlined\":\"true\" 下划线 \"strikethrough\":\"true\" 删除线
\"obfuscated\":\"true\" 乱码
\"extra\":[{ ... },{ ... },{ ... }, ... ] 附加
例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]}
书就显示:“你好”
不过这样有个缺点: extra 后的字体颜色、效果等会与 extra 前的重叠。
纠正方法:在 extra 后的每一句中把 extra 前的效果设置为 false :
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\",\"bold\":\"false\",\"underlined\":\"false\"}]}"]}
这样问题就解决了。不过还有个缺点:如果 extra 中要有多个 { ... } 那么就麻烦了,就可以这样:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\",\"extra\":[{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\"},{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]} 效果是一样的,然后问题完美解决了。
如果嫌 extra 太烦,就可以用 \\u00a7 来解决。 \\u00a7 在 Unicode 里是 § 符号,也就是 Minecraft中可以改变字体颜色、效果的符号:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\"}"]}
效果一模一样,还很方便。
4、高级
悬浮文字:
接着介绍悬浮文字,也就是当鼠标移动到某段文字上是会在鼠标附近弹出一个悬浮框,里面有文字。代码:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"哈哈哈\"}}"]}
然后把鼠标移到“你好”上,就会出现悬浮框,悬浮框里面则是“哈哈哈”:
同样,可以用 bold 、italic 、underlined 等来控制文字效果。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"\\u00a7b\\u00a7l哈哈哈\"}}"]}
那么悬浮框文字就成“哈哈哈”了。
点击事件:
点击事件,就是 clickEvent 。这段代码在玩家用鼠标左键文字时会被触发并执行相应的命令。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say 你好\"}}"]} 鼠标移到文字上没有什么事,但是一按那文字,就显示“[你的名称] 你好”:
除了 run_command , action 还支持 open_url ,如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://www.baidu.com/\"}}"]}
就是打开百度(是用电脑上的浏览器打开的,不是游戏内置显示的,电脑渣的可能会因为打开浏览器而卡)
然后还可以转到页码,用 change_page 就能实现:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a71点击跳转到第二页→\",\"color\":\"green\",\"clickEvent\":{\"action\":\"change_page\",\"value\":\"2\"}}",1:"{\"text\":\"\\u00a7a\\u00a7l第二页\"}"]}
OK,今天的书本命令就介绍到这里。如文章有问题或有建议,请回复,谢谢!
==================== END ====================
感谢:
Zero_Exact 的回复,已送 1 人气、 10 金粒 Java_command 的回复,已送 1 人气、 10 金粒
1、基础
最基础的命令当然是 give 命令了。
先输入 /give @p minecraft:written_book 获得一本书,不过在物品栏里不显示作者等信息,就只是一本“成书”。

然后打开,它就显示 * Invalid book tag * 。

2、简单
输入 /give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:["你好"]} ,得到一本书,现在在物品栏里就显示作者等信息了。名称:hello,作者:xiao___sun,还是原稿。

然后打开书,里面写着“你好”的两个黑字。

3、设置字体颜色
上一步的“你好”两个字是黑色的,那么怎样变成彩色呢?答案很简单,只需改一下:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你好\",\"color\":\"green\"}"]}
然后再看,发现里面的字变成绿色的了。

如果仔细看看代码,会发现和告示很像(如果会用告示牌的话)。
在 pages:[<页码>:"{}"] 中的 {} 下还可以加其他代码:
\"bold\":\"true\" 加粗
\"italic\":\"true\" 斜体
\"underlined\":\"true\" 下划线 \"strikethrough\":\"true\" 删除线
\"obfuscated\":\"true\" 乱码
\"extra\":[{ ... },{ ... },{ ... }, ... ] 附加
例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]}
书就显示:“你好”
不过这样有个缺点: extra 后的字体颜色、效果等会与 extra 前的重叠。

纠正方法:在 extra 后的每一句中把 extra 前的效果设置为 false :
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\",\"bold\":\"false\",\"underlined\":\"false\"}]}"]}
这样问题就解决了。不过还有个缺点:如果 extra 中要有多个 { ... } 那么就麻烦了,就可以这样:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\",\"extra\":[{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\"},{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]} 效果是一样的,然后问题完美解决了。
如果嫌 extra 太烦,就可以用 \\u00a7 来解决。 \\u00a7 在 Unicode 里是 § 符号,也就是 Minecraft中可以改变字体颜色、效果的符号:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\"}"]}
效果一模一样,还很方便。
4、高级
悬浮文字:
接着介绍悬浮文字,也就是当鼠标移动到某段文字上是会在鼠标附近弹出一个悬浮框,里面有文字。代码:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"哈哈哈\"}}"]}
然后把鼠标移到“你好”上,就会出现悬浮框,悬浮框里面则是“哈哈哈”:

同样,可以用 bold 、italic 、underlined 等来控制文字效果。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"\\u00a7b\\u00a7l哈哈哈\"}}"]}
那么悬浮框文字就成“哈哈哈”了。

点击事件:
点击事件,就是 clickEvent 。这段代码在玩家用鼠标左键文字时会被触发并执行相应的命令。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say 你好\"}}"]} 鼠标移到文字上没有什么事,但是一按那文字,就显示“[你的名称] 你好”:


除了 run_command , action 还支持 open_url ,如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://www.baidu.com/\"}}"]}
就是打开百度(是用电脑上的浏览器打开的,不是游戏内置显示的,电脑渣的可能会因为打开浏览器而卡)

然后还可以转到页码,用 change_page 就能实现:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a71点击跳转到第二页→\",\"color\":\"green\",\"clickEvent\":{\"action\":\"change_page\",\"value\":\"2\"}}",1:"{\"text\":\"\\u00a7a\\u00a7l第二页\"}"]}

OK,今天的书本命令就介绍到这里。如文章有问题或有建议,请回复,谢谢!
==================== END ====================
感谢:
Zero_Exact 的回复,已送 1 人气、 10 金粒 Java_command 的回复,已送 1 人气、 10 金粒
国外大大们做的地图都运用了很多命令,今天我就来讲讲做地图很实用的“书”的命令,希望大家喜欢。 (我用的游戏版本是1.11.2)
1、基础
最基础的命令当然是 give 命令了。
先输入 /give @p minecraft:written_book 获得一本书,不过在物品栏里不显示作者等信息,就只是一本“成书”。
然后打开,它就显示 * Invalid book tag * 。
2、简单
输入 /give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:["你好"]} ,得到一本书,现在在物品栏里就显示作者等信息了。名称:hello,作者:xiao___sun,还是原稿。
然后打开书,里面写着“你好”的两个黑字。
3、设置字体颜色
上一步的“你好”两个字是黑色的,那么怎样变成彩色呢?答案很简单,只需改一下:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你好\",\"color\":\"green\"}"]}
然后再看,发现里面的字变成绿色的了。
如果仔细看看代码,会发现和告示很像(如果会用告示牌的话)。
在 pages:[<页码>:"{}"] 中的 {} 下还可以加其他代码:
\"bold\":\"true\" 加粗
\"italic\":\"true\" 斜体
\"underlined\":\"true\" 下划线 \"strikethrough\":\"true\" 删除线
\"obfuscated\":\"true\" 乱码
\"extra\":[{ ... },{ ... },{ ... }, ... ] 附加
例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]}
书就显示:“你好”
不过这样有个缺点: extra 后的字体颜色、效果等会与 extra 前的重叠。
纠正方法:在 extra 后的每一句中把 extra 前的效果设置为 false :
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\",\"bold\":\"false\",\"underlined\":\"false\"}]}"]}
这样问题就解决了。不过还有个缺点:如果 extra 中要有多个 { ... } 那么就麻烦了,就可以这样:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\",\"extra\":[{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\"},{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]} 效果是一样的,然后问题完美解决了。
如果嫌 extra 太烦,就可以用 \\u00a7 来解决。 \\u00a7 在 Unicode 里是 § 符号,也就是 Minecraft中可以改变字体颜色、效果的符号:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\"}"]}
效果一模一样,还很方便。
4、高级
悬浮文字:
接着介绍悬浮文字,也就是当鼠标移动到某段文字上是会在鼠标附近弹出一个悬浮框,里面有文字。代码:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"哈哈哈\"}}"]}
然后把鼠标移到“你好”上,就会出现悬浮框,悬浮框里面则是“哈哈哈”:
同样,可以用 bold 、italic 、underlined 等来控制文字效果。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"\\u00a7b\\u00a7l哈哈哈\"}}"]}
那么悬浮框文字就成“哈哈哈”了。
点击事件:
点击事件,就是 clickEvent 。这段代码在玩家用鼠标左键文字时会被触发并执行相应的命令。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say 你好\"}}"]} 鼠标移到文字上没有什么事,但是一按那文字,就显示“[你的名称] 你好”:
除了 run_command , action 还支持 open_url ,如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://www.baidu.com/\"}}"]}
就是打开百度(是用电脑上的浏览器打开的,不是游戏内置显示的,电脑渣的可能会因为打开浏览器而卡)
然后还可以转到页码,用 change_page 就能实现:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a71点击跳转到第二页→\",\"color\":\"green\",\"clickEvent\":{\"action\":\"change_page\",\"value\":\"2\"}}",1:"{\"text\":\"\\u00a7a\\u00a7l第二页\"}"]}
OK,今天的书本命令就介绍到这里。如文章有问题或有建议,请回复,谢谢!
==================== END ====================
感谢:
Zero_Exact 的回复,已送 1 人气、 10 金粒 Java_command 的回复,已送 1 人气、 10 金粒
2021.12 数据,可能有更多内容
国外大大们做的地图都运用了很多命令,今天我就来讲讲做地图很实用的“书”的命令,希望大家喜欢。 (我用的游戏版本是1.11.2)1、基础
最基础的命令当然是 give 命令了。
先输入 /give @p minecraft:written_book 获得一本书,不过在物品栏里不显示作者等信息,就只是一本“成书”。

然后打开,它就显示 * Invalid book tag * 。

2、简单
输入 /give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:["你好"]} ,得到一本书,现在在物品栏里就显示作者等信息了。名称:hello,作者:xiao___sun,还是原稿。

然后打开书,里面写着“你好”的两个黑字。

3、设置字体颜色
上一步的“你好”两个字是黑色的,那么怎样变成彩色呢?答案很简单,只需改一下:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你好\",\"color\":\"green\"}"]}
然后再看,发现里面的字变成绿色的了。

如果仔细看看代码,会发现和告示很像(如果会用告示牌的话)。
在 pages:[<页码>:"{}"] 中的 {} 下还可以加其他代码:
\"bold\":\"true\" 加粗
\"italic\":\"true\" 斜体
\"underlined\":\"true\" 下划线 \"strikethrough\":\"true\" 删除线
\"obfuscated\":\"true\" 乱码
\"extra\":[{ ... },{ ... },{ ... }, ... ] 附加
例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]}
书就显示:“你好”
不过这样有个缺点: extra 后的字体颜色、效果等会与 extra 前的重叠。

纠正方法:在 extra 后的每一句中把 extra 前的效果设置为 false :
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\",\"extra\":[{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\",\"bold\":\"false\",\"underlined\":\"false\"}]}"]}
这样问题就解决了。不过还有个缺点:如果 extra 中要有多个 { ... } 那么就麻烦了,就可以这样:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\",\"extra\":[{\"text\":\"你\",\"color\":\"green\",\"underlined\":\"true\"},{\"text\":\"好\",\"color\":\"red\",\"strikethrough\":\"true\"}]}"]} 效果是一样的,然后问题完美解决了。
如果嫌 extra 太烦,就可以用 \\u00a7 来解决。 \\u00a7 在 Unicode 里是 § 符号,也就是 Minecraft中可以改变字体颜色、效果的符号:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\"}"]}
效果一模一样,还很方便。
4、高级
悬浮文字:
接着介绍悬浮文字,也就是当鼠标移动到某段文字上是会在鼠标附近弹出一个悬浮框,里面有文字。代码:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"哈哈哈\"}}"]}
然后把鼠标移到“你好”上,就会出现悬浮框,悬浮框里面则是“哈哈哈”:

同样,可以用 bold 、italic 、underlined 等来控制文字效果。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"\\u00a7b\\u00a7l哈哈哈\"}}"]}
那么悬浮框文字就成“哈哈哈”了。

点击事件:
点击事件,就是 clickEvent 。这段代码在玩家用鼠标左键文字时会被触发并执行相应的命令。例如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say 你好\"}}"]} 鼠标移到文字上没有什么事,但是一按那文字,就显示“[你的名称] 你好”:


除了 run_command , action 还支持 open_url ,如:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a7a\\u00a7n你\\u00a7c\\u00a7m好\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://www.baidu.com/\"}}"]}
就是打开百度(是用电脑上的浏览器打开的,不是游戏内置显示的,电脑渣的可能会因为打开浏览器而卡)


然后还可以转到页码,用 change_page 就能实现:
/give @p minecraft:written_book 1 0 {title:"hello",author:xiao___sun,pages:[0:"{\"text\":\"\\u00a71点击跳转到第二页→\",\"color\":\"green\",\"clickEvent\":{\"action\":\"change_page\",\"value\":\"2\"}}",1:"{\"text\":\"\\u00a7a\\u00a7l第二页\"}"]}


OK,今天的书本命令就介绍到这里。如文章有问题或有建议,请回复,谢谢!
==================== END ====================
感谢:
Zero_Exact 的回复,已送 1 人气、 10 金粒 Java_command 的回复,已送 1 人气、 10 金粒
图片挂了,建议使用微博图床
另外排版需要改一改,太亮眼了...
可以借鉴一下别人优秀的排版
另外排版需要改一改,太亮眼了...
可以借鉴一下别人优秀的排版
那是json,不算是nbt
请修复图片,否则将关闭
图挂了,另外请排版一下有点乱
这太刺眼了点吧
Java_command 发表于 2017-3-12 00:18
http://minecraft.tools/en/book.php
大赞~帮了大忙了~~~~
66666666666
学习啦~感谢楼主分享
大、大佬
牛逼, 学到了