跳到正文

NaKeR’s Bedrock Camera Lib

作者:NaKeRNarolino

A library replicating Minecraft Bedrock's ScriptAPI Camera APIs

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

NaKeR’s Bedrock Camera Lib is a library for Minecraft Java (Fabric), which replicates Minecraft Bedrock’s Script API Camera APIs

This mod is a library. It does not add/do anything on it’s own.

This library adds similar camera APIs to the ones in bedrock!
Currently, supports setCamera and fade.

This library was written in Kotlin, so FLK is a dependency.
The library contains a bunch of easings for you to make transitions!

Installation (for developers)

Add JitPack to your repositories:

maven { url 'https://jitpack.io' }

And add Bedrock Camera Lib to your dependencies:

modImplementation 'com.github.NaKeRNarolino:BECamera:<LIB_VERSION>-<MINECRAFT_VERSION>r'

Examples in both languages(Java and Kotlin).

Java

CameraManager.INSTANCE.setCamera(
    new CameraData(
            new Vec3d(30, 30, 30), // Camera location
            new Vec3d(15, 15, 15), // The position the camera will be looking at
            new EaseOptions(
                    Easings.INSTANCE::easeInOutBack, // Easing function for the transition
                    2500 // duration in ms
            )
        )
); // Setting a custom camera
                
CameraManager.INSTANCE.fade(new CameraFadeOptions(
    Colors.WHITE, // Color (ARGB)
    1500, // Fade in time, ms
    2000, // Hold time, ms
    1500 // Fade out time, ms
)); // Fading the camera

Kotlin

CameraManager.setCamera(
	CameraData(
        location = Vec3d(30.0, 30.0, 30.0),
        targetLocation = Vec3d(15.0, 15.0, 15.0),
        easeOptions = EaseOptions(
            easing = Easings::easeInOutBack,
            duration = 2500
        )
    )
) // Setting a custom camera

CameraManager.fade(
    CameraFadeOptions(
        fadeColor = Colors.WHITE,
        fadeInTime = 1500,
        holdTime = 2000,
        fadeOutTime = 1500
    )
) // Fading the camera

You can also use CameraManager.clear() or CameraManager.INSTANCE.clear() to bring back player’s camera state to the default one. Note that this does not affect fades.

Here’s a video showcasing setCamera and fade.

常见问题

NaKeR’s Bedrock Camera Lib 支持哪些 Minecraft 版本?

NaKeR’s Bedrock Camera Lib 支持 Minecraft Java 版 1.20.1,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

NaKeR’s Bedrock Camera Lib 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。

评论

登录后评论和评分