Skip to content

Commit e15f84d

Browse files
committed
chore: update CHANGELOG.md
1 parent 950e18c commit e15f84d

13 files changed

+33
-26
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.8.18] - 2024-08-12
11+
12+
### Fixed
13+
14+
- Fix onMobHurt [#157]
15+
1016
## [0.8.17] - 2024-08-10
1117

1218
### Fixed
@@ -573,7 +579,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
573579
[#157]: https://github.com/LiteLDev/LegacyScriptEngine/issues/157
574580
[#160]: https://github.com/LiteLDev/LegacyScriptEngine/issues/160
575581

576-
[Unreleased]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.17...HEAD
582+
[Unreleased]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.18...HEAD
583+
[0.8.18]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.17...v0.8.18
577584
[0.8.17]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.16...v0.8.17
578585
[0.8.16]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.15...v0.8.16
579586
[0.8.15]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.8.14...v0.8.15

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "native",
55
"description": "A plugin engine for running LLSE plugins on LeviLamina",
66
"author": "LiteLDev",
7-
"version": "0.8.17",
7+
"version": "0.8.18",
88
"dependencies": [
99
{
1010
"name": "LegacyMoney"

src/legacy/api/BlockEntityAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class BlockActor;
88
class BlockEntityClass : public ScriptClass {
99
private:
10-
BlockActor* blockEntity;
10+
BlockActor* blockEntity = nullptr;
1111
int dim;
1212

1313
public:

src/legacy/api/EntityAPI.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ Actor* EntityClass::extract(Local<Value> v) {
198198
else return nullptr;
199199
}
200200

201-
std::optional<Actor*> EntityClass::tryExtractActor(Local<Value> v) {
201+
Actor* EntityClass::tryExtractActor(Local<Value> v) {
202202
if (IsInstanceOf<EntityClass>(v)) return EntityClass::extract(v);
203203
if (IsInstanceOf<PlayerClass>(v)) return PlayerClass::extract(v);
204-
return std::nullopt;
204+
return nullptr;
205205
}
206206

207207
// 成员函数
@@ -759,7 +759,7 @@ Local<Value> EntityClass::distanceTo(const Arguments& args) {
759759
} else if (IsInstanceOf<PlayerClass>(args[0]) || IsInstanceOf<EntityClass>(args[0])) {
760760
// Player or Entity
761761

762-
Actor* targetActor = EntityClass::tryExtractActor(args[0]).value();
762+
Actor* targetActor = EntityClass::tryExtractActor(args[0]);
763763
if (!targetActor) return Local<Value>();
764764

765765
Vec3 targetActorPos = targetActor->getPosition();
@@ -825,7 +825,7 @@ Local<Value> EntityClass::distanceToSqr(const Arguments& args) {
825825
} else if (IsInstanceOf<PlayerClass>(args[0]) || IsInstanceOf<EntityClass>(args[0])) {
826826
// Player or Entity
827827

828-
Actor* targetActor = EntityClass::tryExtractActor(args[0]).value();
828+
Actor* targetActor = EntityClass::tryExtractActor(args[0]);
829829
if (!targetActor) return Local<Value>();
830830

831831
Vec3 targetActorPos = targetActor->getPosition();

src/legacy/api/EntityAPI.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class EntityClass : public ScriptClass {
1616
void set(Actor* actor);
1717
Actor* get();
1818

19-
static Local<Object> newEntity(Actor* actor);
20-
static Actor* extract(Local<Value> v);
21-
static std::optional<Actor*> tryExtractActor(Local<Value> v);
22-
Local<Value> asPointer(const Arguments& args);
19+
static Local<Object> newEntity(Actor* actor);
20+
static Actor* extract(Local<Value> v);
21+
static Actor* tryExtractActor(Local<Value> v);
22+
Local<Value> asPointer(const Arguments& args);
2323

2424
Local<Value> getName();
2525
Local<Value> getType();

src/legacy/api/EventAPI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void EnableEventListener(int eventId) {
522522
bus.emplaceListener<ActorHurtEvent>([](ActorHurtEvent& ev) {
523523
IF_LISTENED(EVENT_TYPES::onMobHurt) {
524524
if (ev.self().hasType(ActorType::Mob)) {
525-
std::optional<Actor*> damageSource;
525+
Actor* damageSource = nullptr;
526526
if (ev.source().isEntitySource()) {
527527
if (ev.source().isChildEntitySource()) {
528528
damageSource = ll::service::getLevel()->fetchEntity(ev.source().getEntityUniqueID());
@@ -535,7 +535,7 @@ void EnableEventListener(int eventId) {
535535
CallEvent(
536536
EVENT_TYPES::onMobHurt,
537537
EntityClass::newEntity(&ev.self()),
538-
damageSource.has_value() ? EntityClass::newEntity(damageSource.value()) : Local<Value>(),
538+
damageSource ? EntityClass::newEntity(damageSource) : Local<Value>(),
539539
Number::newNumber(ev.damage()),
540540
Number::newNumber((int)ev.source().getCause())
541541
);

src/legacy/api/PlayerAPI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ Local<Value> McClass::getPlayer(const Arguments& args) {
643643
try {
644644
std::string target = args[0].toStr();
645645
if (target.empty()) return Local<Value>();
646-
Player* found;
646+
Player* found = nullptr;
647647
if (mce::UUID::canParse(target)) { // If target is UUID, then get player by using UUID
648648
found = ll::service::getLevel()->getPlayer(mce::UUID(target));
649649
if (found) {
@@ -2590,11 +2590,11 @@ Local<Value> PlayerClass::hurt(const Arguments& args) {
25902590
type = args[1].asNumber().toInt32();
25912591
}
25922592
if (args.size() == 3) {
2593-
std::optional<Actor*> source = EntityClass::tryExtractActor(args[2]);
2593+
Actor* source = EntityClass::tryExtractActor(args[2]);
25942594
if (!source) {
25952595
return Boolean::newBoolean(false);
25962596
}
2597-
ActorDamageByActorSource damageBySource = ActorDamageByActorSource(*source.value(), (ActorDamageCause)type);
2597+
ActorDamageByActorSource damageBySource = ActorDamageByActorSource(*source, (ActorDamageCause)type);
25982598
return Boolean::newBoolean(player->_hurt(damageBySource, damage, true, false));
25992599
}
26002600
ActorDamageSource damageSource = ActorDamageSource((ActorDamageCause)type);
@@ -3400,7 +3400,7 @@ Local<Value> PlayerClass::distanceTo(const Arguments& args) {
34003400
} else if (IsInstanceOf<PlayerClass>(args[0]) || IsInstanceOf<EntityClass>(args[0])) {
34013401
// Player or Entity
34023402

3403-
Actor* targetActor = EntityClass::tryExtractActor(args[0]).value();
3403+
Actor* targetActor = EntityClass::tryExtractActor(args[0]);
34043404
if (!targetActor) return Local<Value>();
34053405

34063406
Vec3 targetActorPos = targetActor->getPosition();
@@ -3466,7 +3466,7 @@ Local<Value> PlayerClass::distanceToSqr(const Arguments& args) {
34663466
} else if (IsInstanceOf<PlayerClass>(args[0]) || IsInstanceOf<EntityClass>(args[0])) {
34673467
// Player or Entity
34683468

3469-
Actor* targetActor = EntityClass::tryExtractActor(args[0]).value();
3469+
Actor* targetActor = EntityClass::tryExtractActor(args[0]);
34703470
if (!targetActor) return Local<Value>();
34713471

34723472
Vec3 targetActorPos = targetActor->getPosition();

src/lse/events/EventHooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ LL_TYPE_INSTANCE_HOOK(
11591159
) {
11601160
IF_LISTENED(EVENT_TYPES::onMobHurt) {
11611161
if (source.getCause() == ActorDamageCause::Magic || source.getCause() == ActorDamageCause::Wither) {
1162-
Actor* damageSource;
1162+
Actor* damageSource = nullptr;
11631163
if (source.isEntitySource()) {
11641164
if (source.isChildEntitySource()) {
11651165
damageSource = ll::service::getLevel()->fetchEntity(source.getEntityUniqueID());

tooth.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "github.com/LiteLDev/LegacyScriptEngine",
4-
"version": "0.8.17",
4+
"version": "0.8.18",
55
"info": {
66
"name": "LegacyScriptEngine",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",
@@ -12,7 +12,7 @@
1212
]
1313
},
1414
"dependencies": {
15-
"gitea.litebds.com/LiteLDev/legacy-script-engine-lua": "0.8.17",
16-
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": "0.8.17"
15+
"gitea.litebds.com/LiteLDev/legacy-script-engine-lua": "0.8.18",
16+
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": "0.8.18"
1717
}
1818
}

tooth.lua.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-lua",
4-
"version": "0.8.17",
4+
"version": "0.8.18",
55
"info": {
66
"name": "LegacyScriptEngine with Lua backend",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",

tooth.nodejs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-nodejs",
4-
"version": "0.8.17",
4+
"version": "0.8.18",
55
"info": {
66
"name": "LegacyScriptEngine with NodeJs backend",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",

tooth.python.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-python",
4-
"version": "0.8.17",
4+
"version": "0.8.18",
55
"info": {
66
"name": "LegacyScriptEngine with Python backend",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",

tooth.quickjs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 2,
33
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs",
4-
"version": "0.8.17",
4+
"version": "0.8.18",
55
"info": {
66
"name": "LegacyScriptEngine with QuickJs backend",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",

0 commit comments

Comments
 (0)