猫史档案馆


简单又简洁的存档代码

用户:jlmbcjlmbc查看:0 回复:0 评论:0 创建时间:2021-05-24T22:02:09


本代码属于原创代码

求赞啊

(到时候我会录一个讲解视频emotion_喵喵)

代码如下:

world.onEntityContact(({ entity, other }) => {
    if(entity.hasTag("存档点")){
        other.player.spawnPoint = entity.position
        other.player.directMessage("存档成功!")
    }
});

world.onVoxelContact(({ x, y, z, voxel,entity }) => {
    const voxelName = voxels.name(voxel);  // 将方块id转换名称
    if (voxelName === 'grass'){              // 如果方块名称是grass
        entity.position.copy(entity.player.spawnPoint)
        entity.position.y += 4
    }
});


回复

上一页1 页 / 共 0下一页