Skip to content

Commit 2af3784

Browse files
n15421Singl-Daemon
andcommitted
feat: adapt to ll1.1.0 and gmlib 1.0.1-rc.1
chore: update readme Co-authored-by: Singl_Daemon <SingleIsland@outlook.com>
1 parent d41cc86 commit 2af3784

File tree

12 files changed

+214
-207
lines changed

12 files changed

+214
-207
lines changed

.clangd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Diagnostics:
2-
Suppress: ["-Wmicrosoft-enum-forward-reference", "-Wc++11-narrowing", "-Wc++2b-extensions", "-Wmicrosoft-cast"]
2+
Suppress:
3+
- "-Wmicrosoft-enum-forward-reference"
4+
- "-Wc++11-narrowing"
5+
- "-Wc++2b-extensions"
6+
- "-Wmicrosoft-cast"
37
CompileFlags:
4-
Add: ["-ferror-limit=0", "-D__FUNCTION__=\"dummy\"", "-D_CRT_USE_BUILTIN_OFFSETOF", "-std:c++latest"]
5-
Remove: ["/Yu_HeaderOutputPredefine.h", "/FI_HeaderOutputPredefine.h"]
8+
Add:
9+
- "-ferror-limit=0"
10+
- '-D__FUNCTION__="dummy"'

README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
11
# FreeCamera
2-
Free Camera Mod on Bedrock Dedicated Server
3-
4-
# 开源许可
5-
## 源代码可用性
6-
- 您可以自由地获取、使用和修改本插件的源代码,无论是个人使用还是商业目的。
7-
## 修改发布
8-
- 如果您对本插件进行了修改或衍生创作,并打算分发、发布该修改或衍生作品,您必须开源并且以GPL3.0协议下相同的许可证条件进行分发。
9-
## 版权声明
10-
- 在您分发或发布基于GPL3.0协议的软件时(包括但不限于本插件以及本插件的衍生作品),您必须保留原始版权声明、许可证说明和免责声明。
11-
## 引用链接
12-
- 如果您在一个作品中使用了本插件或者本插件的源码,您需要提供一个明确的引用链接,指向软件的许可证和源代码。
13-
## 对整体的影响
14-
- 如果您将基于本插件与其他插件结合使用,或整合成一个单一的插件,那么整个插件都需要遵守GPL3.0协议进行开源。
2+
3+
[![Minecraft - Version](https://img.shields.io/badge/minecraft-v1.21.60_(Bedrock)-black)](https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs)
4+
![GitHub Tag](https://img.shields.io/github/v/tag/GroupMountain/FreeCamera)
5+
![GitHub License](https://img.shields.io/github/license/GroupMountain/FreeCamera)
6+
7+
[ [简体中文](README_zh.md) | [English](README.md) ]
8+
9+
A high-performance free camera mod for Minecraft Bedrock Dedicated Server (BDS).
10+
11+
## 🎇 Features
12+
13+
- **No Fake Players** - Pure packet-based solution ensures server performance.
14+
15+
- **Safety First** - Automatically reverts to survival mode upon taking damage.
16+
17+
- **Client-Side Magic** - Manipulates client state without server-side hacks.
18+
19+
- **Simple Commands** - Toggle with /freecamera or /fc.
20+
21+
## 📦 Installation
22+
23+
1. 📋 Install Dependencies:
24+
- Ensure [`LeviLamina`](https://github.com/LiteLDev/LeviLamina) is installed.
25+
- Download [`GMLIB`](https://github.com/GroupMountain/GMLIB-Release) and install it.
26+
2. 🎯 Install FreeCamera
27+
- Download the latest release from [Releases](https://github.com/GroupMountain/FreeCamera/releases).
28+
- Extract the `FreeCamera` folder into `./plugins/` directory.
29+
30+
## 🧭 Usage
31+
32+
- **Enter Free Camera**: Run `/freecamera` or `/fc` in-game.
33+
- **Exit Free Camera**: Use the same command or take damage to auto-exit.
34+
35+
## 🧪 Principle
36+
37+
This plugin tricks the client into Spectator Mode via fake packets, while the server maintains the actual game mode.
38+
However, the server still operates in the original game mode, and players will still take damage normally.
39+
40+
## 📝 Feedback and Contributions
41+
42+
- Found a bug? Open an [Issue](https://github.com/GroupMountain/FreeCamera/issues).
43+
- Contributions welcome! Fork and submit a Pull Request.
44+
45+
## 📜 License
46+
47+
Distributed under the GPL-V3.0 License.
48+
See [LICENSE](LICENSE) for details.

README_zh.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# FreeCamera
2+
3+
[![Minecraft - Version](https://img.shields.io/badge/minecraft-v1.21.60_(Bedrock)-black)](https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs)
4+
![GitHub Tag](https://img.shields.io/github/v/tag/GroupMountain/FreeCamera)
5+
![GitHub License](https://img.shields.io/github/license/GroupMountain/FreeCamera)
6+
7+
[ [简体中文](README_zh.md) | [English](README.md) ]
8+
9+
## 🎇 特点
10+
11+
- **无假人占用** - 纯数据包解决方案,保障服务器性能。
12+
13+
- **安全机制** - 受到伤害时自动切换回生存模式。
14+
15+
- **纯客户端** - 通过控制客户端状态实现,无需侵入服务端修改。
16+
17+
- **指令简洁** - 使用 `/freecamera``/fc` 快速切换模式。
18+
19+
## 📦 安装
20+
21+
1. 📋 安装依赖:
22+
- 确保已安装 [`LeviLamina`](https://github.com/LiteLDev/LeviLamina)
23+
- 下载并安装 [`GMLIB`](https://github.com/GroupMountain/GMLIB-Release)
24+
2. 🎯 安装 FreeCamera
25+
-[发行版](https://github.com/GroupMountain/FreeCamera/releases)下载最新版本。
26+
- 将解压后的 `FreeCamera` 文件夹放入服务器 `./plugins/` 目录。
27+
28+
## 🎍 使用
29+
30+
- **进入自由视角**:在游戏中执行 `/freecamera``/fc`
31+
32+
- **退出自由视角**:重复执行上述指令,或受到伤害时自动退出。
33+
34+
## 🧪 原理
35+
36+
本插件通过伪造数据包使客户端进入旁观者模式,而服务器端仍为玩家实际游戏模式。
37+
由于服务端侧逻辑不变,玩家仍会正常受到环境伤害。
38+
39+
## 📝 反馈与贡献
40+
- 发现漏洞?请提交 [问题报告](https://github.com/GroupMountain/FreeCamera/issues)
41+
- 欢迎贡献代码!请 Fork 项目并提交拉取请求。
42+
43+
## 📜 开源
44+
45+
基于 GPL-V3.0 协议分发。
46+
详见 [LICENSE](LICENSE) 文件。

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "native",
55
"author": "GroupMountain",
66
"description": "Free Camera",
7-
"version": "0.13.2",
7+
"version": "0.13.3",
88
"dependencies": [
99
{
1010
"name": "GMLIB"

scripts/after_build.lua

Lines changed: 0 additions & 118 deletions
This file was deleted.

src/Command.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#include "Global.h"
2+
#include "gmlib/mc/world/actor/Actor.h"
3+
#include "ll/api/command/CommandHandle.h"
4+
#include "ll/api/command/CommandRegistrar.h"
5+
#include "ll/api/service/Bedrock.h"
6+
#include "mc/server/commands/CommandOutput.h"
7+
#include "mc/world/actor/player/Player.h"
28

39
void RegisterCommand() {
410
auto& cmd = ll::command::CommandRegistrar::getInstance()
511
.getOrCreateCommand("freecamera", tr("freecamera.command.desc"), CommandPermissionLevel::Any);
612
ll::service::getCommandRegistry()->registerAlias("freecamera", "fc");
713
cmd.overload().execute([&](CommandOrigin const& origin, CommandOutput& output) {
8-
auto entity = (GMLIB_Actor*)origin.getEntity();
14+
auto entity = (gmlib::world::actor::GMActor*)origin.getEntity();
915
if (entity && entity->isPlayer()) {
1016
auto pl = (Player*)entity;
1117
auto guid = pl->getNetworkIdentifier().mGuid.g;

src/Entry.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#include "Entry.h"
22
#include "Global.h"
3-
#include "Language.h"
3+
#include "Language.h" // IWYU pragma: keep
4+
#include "gmlib/gm/i18n/LangI18n.h"
5+
#include "ll/api/Config.h"
6+
#include "ll/api/Versions.h"
7+
#include "ll/api/mod/NativeMod.h"
8+
#include "ll/api/mod/RegisterHelper.h"
9+
#include "ll/api/service/Bedrock.h"
10+
#include "mc/world/level/Level.h"
411

512
namespace FreeCamera {
613

@@ -9,7 +16,9 @@ Entry& Entry::getInstance() {
916
return instance;
1017
}
1118

12-
bool Entry::load() {
19+
bool Entry::load() { return true; }
20+
21+
bool Entry::enable() {
1322
mConfig.emplace();
1423
if (!ll::config::loadConfig(*mConfig, getSelf().getConfigDir() / u8"config.json")) {
1524
ll::config::saveConfig(*mConfig, getSelf().getConfigDir() / u8"config.json");
@@ -18,19 +27,15 @@ bool Entry::load() {
1827
mI18n->updateOrCreateLanguage("en_US", en_US);
1928
mI18n->updateOrCreateLanguage("zh_CN", zh_CN);
2029
mI18n->loadAllLanguages();
21-
if (GMLIB::Version::getProtocolVersion() != TARGET_PROTOCOL) {
30+
if (ll::getNetworkProtocolVersion() != TARGET_PROTOCOL) {
2231
getSelf().getLogger().error(tr("error.protocolMismatch.info"));
2332
getSelf().getLogger().error(
2433
tr("error.protocolMismatch.version",
25-
{std::to_string(TARGET_PROTOCOL), std::to_string(GMLIB::Version::getProtocolVersion())})
34+
{std::to_string(TARGET_PROTOCOL), std::to_string(ll::getNetworkProtocolVersion())})
2635
);
2736
return false;
2837
}
2938
FreeCamera::freecameraHook(true);
30-
return true;
31-
}
32-
33-
bool Entry::enable() {
3439
RegisterCommand();
3540
return true;
3641
}
@@ -53,7 +58,7 @@ bool Entry::unload() {
5358

5459
Config& Entry::getConfig() { return mConfig.value(); }
5560

56-
GMLIB::Files::I18n::LangI18n& Entry::getI18n() { return mI18n.value(); }
61+
gmlib::i18n::LangI18n& Entry::getI18n() { return mI18n.value(); }
5762

5863
} // namespace FreeCamera
5964

src/Entry.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#pragma once
2+
23
#include "Config.h"
34
#include "Global.h"
5+
#include "gmlib/gm/i18n/LangI18n.h"
6+
#include "ll/api/mod/NativeMod.h"
47

58
namespace FreeCamera {
69

@@ -26,12 +29,12 @@ class Entry {
2629

2730
Config& getConfig();
2831

29-
GMLIB::Files::I18n::LangI18n& getI18n();
32+
gmlib::i18n::LangI18n& getI18n();
3033

3134
private:
32-
ll::mod::NativeMod& mSelf;
33-
std::optional<Config> mConfig;
34-
std::optional<GMLIB::Files::I18n::LangI18n> mI18n;
35+
ll::mod::NativeMod& mSelf;
36+
std::optional<Config> mConfig;
37+
std::optional<gmlib::i18n::LangI18n> mI18n;
3538
};
3639

3740
} // namespace FreeCamera

0 commit comments

Comments
 (0)