• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sciner/webcraft: Minecraft clone on JS

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

sciner/webcraft

开源软件地址(OpenSource Url):

https://github.com/sciner/webcraft

开源编程语言(OpenSource Language):

JavaScript 96.2%

开源软件介绍(OpenSource Introduction):

MadCraft

Minecraft clone on JS

Third Party

Run and play

Compilate texture pack. It require for first run the game, because textures not included in repo. For example you can download this texture pack from https://polyflore.net/projects/depixel

1. extract resource pack to directory ../resource-packs/1 (one level up from project root directory)
2. cd ./node_server
3. npm install
4. npm run compile-texture-pack

Start server:

// Run NodeJS v17.9.0 server!
cd ./node_server
npm run install-all
npm run start-rebuild

Commands

// Teleport current user to random location 
Qubatch.player.teleport('random', null);

// Toggle rain
Qubatch.render.setWeather('rain'); // rain|snow|clear

// Set block at current player coordinates
let pp = Qubatch.player.getBlockPos();
Qubatch.world.chunkManager.setBlock(pp.x, pp.y, pp.z, {id: 10}, true);

// Emulate user keyboard control
// .walk(direction, duration_milliseconds)
Qubatch.player.walk('forward', 2000); // forward|back|left|right

// Get player rotate
let rotate = Qubatch.player.rotate;

// Set player rotate
Qubatch.player.setRotate({x: 0, y: 0, z: 0});

// Send message to chat
Qubatch.player.chat.sendMessage('Hello, World!');

// Get all supported blocks
let blocks = Qubatch.world.block_manager.getAll();

// Change game mode
Qubatch.world.server.GameModeSet('creative'); // survival|creative|adventure|spectator

// Open inventory window
Qubatch.player.inventory.open();

// Spawn mob
Qubatch.player.chat.sendMessage('/spawnmob 3880 71 2527 horse creamy');
Qubatch.player.chat.sendMessage('/spawnmob 3880 71 2527 bee base');

// Admins
// 1. admin list managed only by chat commands
// 2. only owner or another admin can add new admin
// 3. owner cannot be removed from admins
/admin list
/admin add username
/admin remove username

Server packets

Send particle animation from server to player:

const packets = [{
    name: ServerClient.CMD_PARTICLE_BLOCK_DESTROY,
    data: {
        pos: {x: 100, y: 100, z: 100},
        item: {id: 2}
    }
}];
chunk.sendAll(packets, []);

Manage server by chat commands

  • /gamerule doDaylightCycle false|true

    You can stop the day and night shift with the command /gamerule doDaylightCycle false To disable the day and night shift, you need to assign false to the rule At this moment, the current position of the sun and moon will be "fixed". Time will go on, but the change of day and night will freeze until you set the rule to true

    Note!
    The command works only in worlds where the player has admin rights or he is its creator.
    If you need to stop the daylight time, and it's dark now, then before disabling the day and night shift, you first need to set the daylight time with the command /time set day

  • /time set day|midnight|night|noon

    You can change current world time by following commands

    • /time set day equal to 07:00
    • /time set midnight equal to 00
    • /time set night equal to 19:00
    • /time set noon equal to 12:00

    You can set specific daytime /time set 16500 it equal to 16:30.
    You can increase time by /add argument /time add 1000, this add one hour to current time.

    Note!
    The command works only in worlds where the player has admin rights or he is its creator.

  • /vdist 2-16

    You can change view distance by this command

    • /vdist 2 means 2 chunks showed around player
    • /vdist 16 means 16 chunks render around player

    Note!
    View distance can take number from 2 to 16




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap