Skip to content

Commit bb34469

Browse files
committed
ready to merge
1 parent 359783f commit bb34469

File tree

8 files changed

+103
-36
lines changed

8 files changed

+103
-36
lines changed

Diff for: CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.2.0] - 2025-3-7
9+
10+
### Added
11+
12+
+ Adapted to 1.21.60
13+
14+
### Fixed
15+
16+
+ Fix a bug that the village function may crash BDS when village is removed
17+
18+
### Removed
19+
20+
+ Remove command tick query
21+
822
## [2.1.0] - 2025-2-25
923

1024
### Added

Diff for: src/coral_fans/commands/Coralfans.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void registerCoralfansCommand() {
1414
.getOrCreateCommand("coralfans", "CoralFans Mod", CommandPermissionLevel::Any);
1515

1616
// version
17-
command.overload().text("version").execute([](CommandOrigin const&, CommandOutput&) {
17+
command.overload().text("version").execute([](CommandOrigin const&, CommandOutput& output) {
1818
#ifdef VERSION
1919
output.success(VERSION);
2020
#endif

Diff for: src/coral_fans/functions/hopperCounter/HopperCounter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class HopperCounterManager {
4747
static int getViewChannel(BlockSource&, HitResult);
4848

4949
static HopperCounterManager& getInstance() {
50-
static HopperCounterManager instance; // 唯一实例
50+
static HopperCounterManager instance;
5151
return instance;
5252
}
5353
};

Diff for: src/coral_fans/functions/village/Village.cpp

+37-9
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,44 @@ std::pair<std::string, bool> CFVillageManager::getVillageInfo(std::string id) {
250250
dwellerCountArray[2],
251251
dwellerCountArray[3]
252252
);
253+
int i = 0;
254+
auto level = ll::service::getLevel();
253255
for (auto& villager : ::getDwellerPoiMap(village)) {
254-
for (int index = 0; index < 3; ++index) {
255-
if (index == 0) {
256-
retstr += "|";
257-
}
258-
auto poi = villager.second[index].lock();
259-
if (poi) retstr += std::format(" §a{}§r, §e{:.1f}§r |", *poi->mPosition, poi->mRadius);
260-
else retstr += " §7(x)§r |";
261-
if (index == 2) retstr += "\n";
262-
}
256+
i++;
257+
retstr += "translate.village.villagerInfo"_tr(i, level->fetchEntity(villager.first, false)->getFeetPos());
258+
retstr += "translate.village.villagerPOIType1"_tr();
259+
auto poi1 = villager.second[0].lock();
260+
if (poi1)
261+
retstr += "translate.village.villagerPOIInfo"_tr(
262+
*poi1->mPosition,
263+
poi1->mOwnerCount,
264+
poi1->mOwnerCapacity,
265+
poi1->mRadius,
266+
poi1->mWeight
267+
);
268+
else retstr += " §7(x)§r\n";
269+
retstr += "translate.village.villagerPOIType2"_tr();
270+
auto poi2 = villager.second[1].lock();
271+
if (poi2)
272+
retstr += "translate.village.villagerPOIInfo"_tr(
273+
*poi2->mPosition,
274+
poi2->mOwnerCount,
275+
poi2->mOwnerCapacity,
276+
poi2->mRadius,
277+
poi2->mWeight
278+
);
279+
else retstr += " §7(x)§r\n";
280+
retstr += "translate.village.villagerPOIType3"_tr();
281+
auto poi3 = villager.second[2].lock();
282+
if (poi3)
283+
retstr += "translate.village.villagerPOIInfo"_tr(
284+
*poi3->mPosition,
285+
poi3->mOwnerCount,
286+
poi3->mOwnerCapacity,
287+
poi3->mRadius,
288+
poi3->mWeight
289+
);
290+
else retstr += " §7(x)§r\n";
263291
}
264292
return {retstr, true};
265293
}

Diff for: src/lang/en_US.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@
245245
},
246246
"village": {
247247
"cannotget": "cannot get village info",
248-
"info": "VID: {}\nUUID: {}\n- Center: {}\n- Bounds: [{}, {}]\n- Radius: {}\n- Dwellers: {} / {} / {} / {}\nPOIs: [Bed, Alarm, Jobsite] (§aPos§r, §bOwner count§r, §dCapacity§r, §eRadius§r, Weight)\n"
248+
"info": "VID: {}\nUUID: {}\n- Center: {}\n- Bounds: [{}, {}]\n- Radius: {}\n- Dwellers: {} / {} / {} / {}\nVillager list\n",
249+
"villagerInfo": "[{}] villager position:{}\n POI:\n",
250+
"villagerPOIType1": " bed: ",
251+
"villagerPOIType2": " alarm ",
252+
"villagerPOIType3": " jobSite: ",
253+
"villagerPOIInfo": "position: {} owner count: {} max capacity: {} radius: {} weight: {}\n"
249254
},
250255
"containerreader": {
251256
"null": "Container is null",

Diff for: src/lang/zh_CN.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@
245245
},
246246
"village": {
247247
"cannotget": "无法获取村庄信息",
248-
"info": "VID: {}\nUUID: {}\n- 中心: {}\n- 边界: [{}, {}]\n- 半径: {}\n- 居民: {} / {} / {} / {}\n兴趣点: [床, 钟, 工作方块] (§a坐标§r, §b所有者数量§r, §d最大容量§r, §e半径§r, 权重)\n"
248+
"info": "VID: {}\nUUID: {}\n- 中心: {}\n- 边界: [{}, {}]\n- 半径: {}\n- 居民: {} / {} / {} / {}\n村民列表:\n",
249+
"villagerInfo": "[{}] 村民坐标:{}\n POI:\n",
250+
"villagerPOIType1": " 床: ",
251+
"villagerPOIType2": " 钟: ",
252+
"villagerPOIType3": " 工作方块: ",
253+
"villagerPOIInfo": "坐标:{} 所有者数量:{} 最大容量:{} 半径:{} 权重:{}\n"
249254
},
250255
"containerreader": {
251256
"null": "容器为空",

Diff for: tooth.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "github.com/CoralFans-Dev/CoralFans",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"info": {
66
"name": "CoralFans",
77
"description": "CoralFans Mod.",
@@ -13,8 +13,8 @@
1313
},
1414
"asset_url": "https://github.com/CoralFans-Dev/CoralFans/releases/download/v$(version)/CoralFans-windows-x64.zip",
1515
"prerequisites": {
16-
"github.com/LiteLDev/LeviLamina": ">=1.0.0 <1.1.0",
17-
"github.com/OEOTYAN/BedrockServerClientInterface": "0.1.4"
16+
"github.com/LiteLDev/LeviLamina": ">=1.1.0 <1.2.0",
17+
"github.com/OEOTYAN/BedrockServerClientInterface": "0.1.6"
1818
},
1919
"files": {
2020
"place": [

Diff for: xmake.lua

+35-20
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_repositories("coralfansdev-repo https://github.com/CoralFans-Dev/xmake-repo.
1414
-- end
1515

1616
add_requires(
17-
"levilamina v1.1.0", {configs = {target_type = "server"}},
17+
"levilamina 1.1.0", {configs = {target_type = "server"}},
1818
"levibuildscript",
1919
"bsci main"
2020
)
@@ -23,33 +23,48 @@ if not has_config("vs_runtime") then
2323
set_runtimes("MD")
2424
end
2525

26-
option("CoralFans")
27-
set_default("server")
28-
set_showmenu(true)
29-
set_values("server", "client")
30-
option_end()
31-
3226
target("CoralFans") -- Change this to your mod name.
3327
add_rules("@levibuildscript/linkrule")
34-
add_rules("@levibuildscript/modpacker")
35-
add_cxflags( "/EHa", "/utf-8", "/W4", "/w44265", "/w44289", "/w44296", "/w45263", "/w44738", "/w45204")
28+
add_cxflags(
29+
"/EHa",
30+
"/utf-8",
31+
"/W4",
32+
"/w44265",
33+
"/w44289",
34+
"/w44296",
35+
"/w45263",
36+
"/w44738",
37+
"/w45204"
38+
)
3639
add_defines("NOMINMAX", "UNICODE")
40+
add_defines("COMMITID=\"$(shell git rev-parse HEAD)\"")
41+
add_defines("VERSION=\"$(shell git describe --tags --abbrev=0 --always)\"")
42+
add_files("src/**.cpp")
43+
add_includedirs("src")
3744
add_packages(
3845
"levilamina",
39-
"levibuildscript",
4046
"bsci"
4147
)
48+
add_shflags("/DELAYLOAD:bedrock_server.dll") -- To use symbols provided by SymbolProvider.
4249
set_exceptions("none") -- To avoid conflicts with /EHa.
4350
set_kind("shared")
4451
set_languages("c++20")
4552
set_symbols("debug")
46-
set_toolchains("msvc")
47-
add_files("src/**.cpp")
48-
add_includedirs("src")
49-
-- if is_config("target_type", "server") then
50-
-- add_includedirs("src-server")
51-
-- add_files("src-server/**.cpp")
52-
-- else
53-
-- add_includedirs("src-client")
54-
-- add_files("src-client/**.cpp")
55-
-- end
53+
54+
after_build(function (target)
55+
local mod_packer = import("scripts.after_build")
56+
57+
local tag = os.iorun("git describe --tags --abbrev=0 --always")
58+
local major, minor, patch, suffix = tag:match("v(%d+)%.(%d+)%.(%d+)(.*)")
59+
if not major then
60+
print("Failed to parse version tag, using 0.0.0")
61+
major, minor, patch = 0, 0, 0
62+
end
63+
local mod_define = {
64+
modName = target:name(),
65+
modFile = path.filename(target:targetfile()),
66+
modVersion = major .. "." .. minor .. "." .. patch,
67+
}
68+
69+
mod_packer.pack_mod(target,mod_define)
70+
end)

0 commit comments

Comments
 (0)