fix: fix resource lang

This commit is contained in:
2026-06-20 20:56:56 +08:00
Unverified
parent ce09c29431
commit f4727eb09b
6 changed files with 150 additions and 117 deletions
+3
View File
@@ -8,6 +8,9 @@
"dependencies": [
{
"name": "GMLIB"
},
{
"name": "ModAPI"
}
]
}
+27 -2
View File
@@ -12,7 +12,8 @@
#include "mc/world/actor/ActorDamageByChildActorSource.h"
#include "ll/api/service/Bedrock.h"
#include "mc/world/level/Level.h"
#include "mc/world/actor/monster/EnderCrystal.h"
#include "mc/world/actor/ActorHurtResult.h"
#include "mc/world/actor/Actor.h"
phmap::flat_hash_map<int64, float> mFallHeightMap;
@@ -176,7 +177,7 @@ DeathMessageResult makeDeathMessage(
}
auto weaponname = killer->getCarriedItem().getCustomName();
if (!weaponname.empty()) {
weaponname = "[" + weaponname + "§r]";
weaponname = "[§b§o" + weaponname + "§r]";
res.second.push_back(weaponname);
} else {
ll::utils::string_utils::replaceAll(res.first, ".item", "");
@@ -327,6 +328,30 @@ DeathMessageResult translateDeathMessage(DeathMessageResult origin, std::string
return makeDeathMessage((int)damageCause, origin, name, killer, weaponName, isEscaping);
}
LL_AUTO_TYPE_INSTANCE_HOOK(
CryatslHurtHook,
HookPriority::Normal,
EnderCrystal,
&EnderCrystal::$_hurt,
::ActorHurtResult,
ActorDamageSource const& a1,
float a2,
bool a3,
bool a4
) {
auto res = origin(a1, a2, a3, a4);
isCrystal = true;
auto& executor = ll::thread::ThreadPoolExecutor::getDefault();
auto callback = executor.executeAfter(
[] {
isCrystal = false;
},
ll::chrono::game::ticks(1)
);
return res;
}
LL_AUTO_TYPE_INSTANCE_HOOK(
DeathMessageHook1,
HookPriority::Lowest,
+4 -3
View File
@@ -45,8 +45,8 @@ bool Entry::load() {
}
bool Entry::enable() {
/* RegisterDamageDefinition();
ListenEvents();*/
RegisterDamageDefinition();
/* ListenEvents();*/
return true;
}
@@ -72,9 +72,10 @@ void Entry::loadI18n() {
}
void Entry::loadResourcePack() {
auto resource = gmlib::i18n::ResourceI18n(getSelf().getModDir() / u8"resource", MOD_NAME, 0, 8, 0);
auto resource = gmlib::i18n::ResourceI18n{getSelf().getModDir() / u8"lang", MOD_NAME, 0, 8, 0};
resource.addLanguage("en_US", en_US);
resource.addLanguage("zh_CN", zh_CN);
resource.loadAllLanguages();
}
} // namespace DeathMessages
+4 -2
View File
@@ -7,7 +7,9 @@ extern std::shared_ptr<ll::io::Logger> logger;
extern std::shared_ptr<ll::io::Logger> deathLogger;
extern std::shared_ptr<ll::io::Logger> infoLogger;
/*extern std::string tr(std::string const& key, std::vector<std::string> const& data = {});
extern void RegisterDamageDefinition();
extern void ListenEvents();*/
/*
*extern std::string tr(std::string const& key, std::vector<std::string> const& data = {});
*extern void ListenEvents();*/
+2 -1
View File
@@ -254,7 +254,7 @@ multiplayer.player.left=%s left the game
std::string zh_CN = R"(
death.attack.anvil=%1$s
death.attack.anvil.player=%1$sz在与%2$s战斗时被坠落的铁砧压扁了
death.attack.anvil.player=%1$s %2$s
death.attack.anvil.item=%1$s %3$s %2$s
death.attack.arrow=%1$s被 %2$s
death.attack.arrow.item=%1$s %2$s %3$s
@@ -360,6 +360,7 @@ death.fell.assist.item=%1$s因为%2$s使用了%3$s注定要摔死
death.fell.finish=%1$s %2$s
death.fell.finish.item=%1$s %2$s %3$s
death.fell.killer=%1$s
entity.area_effect_cloud.name=
entity.armor_stand.name=
entity.arrow.name=
+2 -1
View File
@@ -10,13 +10,14 @@ end
add_requires("levilamina 26.10.5",{configs = {target_type = "server"}})
add_requires("levibuildscript")
add_requires("gmlib 26.10.0")
add_requires("modapi 26.10.0")
target("DeathMessages") -- Change this to your mod name.
add_rules("@levibuildscript/linkrule")
add_rules("@levibuildscript/modpacker")
add_cxflags( "/EHa", "/utf-8", "/W4", "/w44265", "/w44289", "/w44296", "/w45263", "/w44738", "/w45204")
add_defines("NOMINMAX", "UNICODE")
add_packages("levilamina","gmlib")
add_packages("levilamina","gmlib","modapi")
set_exceptions("none") -- To avoid conflicts with /EHa.
set_kind("shared")
set_languages("c++23")