使用 ScriptCraft 在 Minecraft 中建造巨大峡谷(以及其他示例)
使用 ScriptCraft 在 Minecraft 中建造巨大峡谷(以及其他示例)
Minecraft 是一款庞大的游戏。特别是 PC 全版本,因为它可以通过互联网上大量可用的模组进行定制。一个很棒的新模组是 Walter Higgins 的 ScriptCraft (http://scriptcraftjs.org/)。ScriptCraft 在 minecraft 服务器的 bukkit 版本上运行。安装方法在 ServerCraft 网站上介绍。
ScriptCraft 为 minecraft 添加了 JavaScript 控制。建筑物和其他对象可以通过 Minecraft 命令行立即创建。此外,这也可以成为向初学者介绍编程的好方法。
尝试以下示例。将这些 JavaScript 源代码复制到您的服务器并重新启动它以进行测试。
保存为 igloo.js 并放入您的 js-plugins\drone 文件夹中。
load(__folder + "drone.js")
//
// constructs an igloo
//
Drone.extend('igloo', function () {
this.chkpt('igloo');
//make basic structure
this.hemisphere0(blocks.snow, 7, 'north');
this.right(2).down(2);
//clear door
this.back();
this.right(4);
this.up(2);
this.box(0, 2, 3, 2);
return this.move('igloo');
});
通过在 Minecraft 命令行中输入以下内容来运行它
/js igloo()
保存为 enchant_table.js 并放入您的 js-plugins\drone 文件夹中。
load(__folder + "drone.js")
//
// constructs an enchantment table surrounded with books for max enchanting
//
Drone.extend('enchant_table', function () {
this.up(); //set to just above floor level.
this.box0(blocks.bookshelf, 5, 5, 4);
this.chkpt('enchant_table');
//open side
this.up().right();
this.box0(0, 3, 3, 1);
//add enchantment table
this.move('enchant_table');
this.up().fwd().right(2);
this.box(blocks.table_enchantment);
//add floor
this.move('enchant_table');
this.box(blocks.bookshelf, 5, 1, 4);
//add roof
this.up(4);
this.box(blocks.bookshelf, 5, 1, 4);
return this; });
通过在 Minecraft 命令行中输入以下内容来运行它
/js enchant_table()
现在,你将拥有一个完全满级的附魔台。
我最喜欢用它做的事情之一是使用命令来探索和揭示地下的世界。因此,为了清除这个白雪皑皑的森林中的大片区域,请发出类似 down(height/2).box(blocktype, width, height, depth)
的命令,并将 0
设置为块类型。
/js down(40).box(0, 20, 70, 120)
现在看看我们创建的巨大峡谷。这种方法揭示了各种有趣的探索区域,非常适合挖掘。
函数的 box(...)
部分实际上清除了该区域,因为我们使用空气(块 0)作为块。由于 box()
总是向上移动,我们需要先使用 down(40) 命令向下发送命令。由于我们使用的是 JavaScript,我们可以将命令链接在一起,如上所示。
你正在做什么有趣的事情?如果你喜欢这个页面,请给我发个消息。
一些 ScriptCraft 内置的示例供你尝试
/js castle()
/js chessboard()
/js cottage()
/js cottage_road()
/js dancefloor()
/js fort()
/js rainbow()
/js temple()
要使用其他块类型进行创建,请使用官方 Minecraft 列表中的 (十进制) 值:http://www.minecraftwiki.net/wiki/Data_values.