Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 62b3942

Browse files
authored
Release 2.14.1 (#1305)
2 parents 2fb89ca + 6d4b6c8 commit 62b3942

File tree

6 files changed

+16
-71
lines changed

6 files changed

+16
-71
lines changed

LiteLoader/include/liteloader/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define LITELOADER_VERSION_MAJOR 2
88
#define LITELOADER_VERSION_MINOR 14
9-
#define LITELOADER_VERSION_REVISION 0
9+
#define LITELOADER_VERSION_REVISION 1
1010
#define LITELOADER_VERSION_COMMIT_SHA UNKNOWN
1111
#define LITELOADER_VERSION_STATUS LITELOADER_VERSION_DEV
1212
#define LITELOADER_VERSION_STATUS_VERSION 0

LiteLoader/include/llapi/EventAPI.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,6 @@ class EntityStepOnPressurePlateEvent : public EventTemplate<EntityStepOnPressure
661661
BlockInstance mBlockInstance;
662662
};
663663

664-
class NpcCmdEvent : public EventTemplate<NpcCmdEvent> {
665-
public:
666-
Actor* mNpc = nullptr;
667-
std::string mCommand;
668-
Player* mPlayer = nullptr;
669-
};
670-
671664
class ProjectileSpawnEvent : public EventTemplate<ProjectileSpawnEvent> {
672665
public:
673666
Actor* mShooter = nullptr;

LiteLoader/src/llapi/EventAPI.cpp

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <typeinfo>
88
#include <vector>
99

10+
#include "llapi/mc/WeakEntityRef.hpp"
1011
#include "llapi/mc/ActorDamageSource.hpp"
1112
#include "llapi/mc/BaseCommandBlock.hpp"
1213
#include "llapi/mc/BedrockBlocks.hpp"
@@ -32,9 +33,7 @@
3233
#include "llapi/mc/PlayerActionPacket.hpp"
3334
#include "llapi/mc/RespawnPacket.hpp"
3435
#include "llapi/mc/Scoreboard.hpp"
35-
#include "llapi/mc/NpcSceneDialogueData.hpp"
3636
#include "llapi/mc/ArmorStand.hpp"
37-
#include "llapi/mc/NpcComponent.hpp"
3837
#include "llapi/mc/Container.hpp"
3938
#include "llapi/mc/ScoreboardId.hpp"
4039
#include "llapi/mc/ServerNetworkHandler.hpp"
@@ -268,7 +267,6 @@ DECLARE_EVENT_DATA(ProjectileHitEntityEvent);
268267
DECLARE_EVENT_DATA(WitherBossDestroyEvent);
269268
DECLARE_EVENT_DATA(EntityRideEvent);
270269
DECLARE_EVENT_DATA(EntityStepOnPressurePlateEvent);
271-
DECLARE_EVENT_DATA(NpcCmdEvent);
272270
DECLARE_EVENT_DATA(ProjectileSpawnEvent);
273271
DECLARE_EVENT_DATA(ProjectileCreatedEvent);
274272
DECLARE_EVENT_DATA(EntityTransformEvent);
@@ -1334,7 +1332,7 @@ TInstanceHook(void*, "?die@ServerPlayer@@UEAAXAEBVActorDamageSource@@@Z", Server
13341332
#include "llapi/mc/SurvivalMode.hpp"
13351333

13361334
/////////////////// PlayerDestroy ///////////////////
1337-
TInstanceHook(bool,"?playerWillDestroy@BlockLegacy@@UEBA_NAEAVPlayer@@AEBVBlockPos@@AEBVBlock@@@Z", BlockLegacy ,Player *player, const BlockPos *pos, const Block *block){
1335+
TInstanceHook(bool,"?playerWillDestroy@Block@@QEBA_NAEAVPlayer@@AEBVBlockPos@@@Z", Block, Player *player, const BlockPos *pos){
13381336
if (player != nullptr && player->isPlayer()) {
13391337
IF_LISTENED(PlayerDestroyBlockEvent) {
13401338
PlayerDestroyBlockEvent ev{};
@@ -1346,7 +1344,7 @@ TInstanceHook(bool,"?playerWillDestroy@BlockLegacy@@UEBA_NAEAVPlayer@@AEBVBlockP
13461344
}
13471345
IF_LISTENED_END(PlayerDestroyBlockEvent)
13481346
}
1349-
return original(this, player, pos, block);
1347+
return original(this, player, pos);
13501348
}
13511349

13521350
// TInstanceHook(bool, "?destroyBlock@SurvivalMode@@UEAA_NAEBVBlockPos@@E@Z", GameMode, BlockPos blockPos,
@@ -1842,40 +1840,6 @@ TClasslessInstanceHook(void, "?releaseUsing@TridentItem@@UEBAXAEAVItemStack@@PEA
18421840
return original(this, a2, a3, a4);
18431841
}
18441842

1845-
#include "llapi/mc/WeakEntityRef.hpp"
1846-
#include "llapi/mc/EntityContext.hpp"
1847-
#include "llapi/mc/Npc.hpp"
1848-
1849-
////////////// NpcCmd //////////////
1850-
TInstanceHook(void,
1851-
"?executeCommandAction@NpcComponent@@QEAAXAEAVActor@@AEAVPlayer@@HAEBV?$basic_string@DU?$char_traits@D@"
1852-
"std@@V?$allocator@D@2@@std@@@Z",
1853-
NpcComponent, Actor* ac, Player* player, int a4, string& a5) {
1854-
IF_LISTENED(NpcCmdEvent) {
1855-
// IDA NpcComponent::executeCommandAction
1856-
// NpcSceneDialogueData data(*this, *ac, a5);
1857-
1858-
NpcSceneDialogueData data(WeakEntityRef(ac->getEntityContext().getWeakRef()), a5);
1859-
1860-
auto container = data.getActionsContainer();
1861-
if (container) {
1862-
auto actionAt = container->at(a4);
1863-
if (actionAt) {
1864-
if (auto* command = std::get_if<npc::CommandAction>(actionAt)) {
1865-
NpcCmdEvent ev{};
1866-
ev.mPlayer = player;
1867-
ev.mNpc = ac;
1868-
ev.mCommand = command->mActionValue.mText;
1869-
if (!ev.call())
1870-
return;
1871-
}
1872-
}
1873-
}
1874-
}
1875-
IF_LISTENED_END(NpcCmdEvent)
1876-
return original(this, ac, player, a4, a5);
1877-
}
1878-
18791843
////////////// ArmorStandChange //////////////
18801844
TInstanceHook(bool, "?_trySwapItem@ArmorStand@@AEAA_NAEAVPlayer@@W4EquipmentSlot@@@Z", ArmorStand, Player* a2, int a3) {
18811845
IF_LISTENED(ArmorStandChangeEvent) {

RELEASE_NOTES.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
# Release 2.14.0
1+
# Release 2.14.1
22

33
![BDS 1.20.0.01](https://img.shields.io/badge/BDS-1.20.0.01-blue?style=for-the-badge) ![Protocol 589](https://img.shields.io/badge/Protocol-589-orange?style=for-the-badge)
44

5-
## Added
6-
7-
- Support 2.14.0 (by @dreamguxiang @OEOTYAN)
5+
<!-- ## Added -->
86

97
## Changed
108

11-
- Remove EnderDragonDestroy event
9+
- Remove NpcCmd event
1210

1311
## Fixed
1412

15-
- Fix item disappear caused by players throwing items at unloaded chunks (by @timiya233)
16-
- Fix empty overloads error (by @OEOTYAN)
17-
- Fix destroy event (by @dofes)
18-
- Fix VectorBase::toString incorrect process of right parenthesis (by @Redbeanw44602)
19-
- Fix stop server crash caused by BDS (by @dofes)
13+
- Fix the original PlayerDestroy event doesn't cover the full blocks #1303 (by @dofes)
14+
- Fix isSimulatedPlayer in LLSE #1285 (by @OEOTYAN)

ScriptEngine/src/api/EventAPI.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ enum class EVENT_TYPES : int {
9696
onStepOnPressurePlate,
9797
onSpawnProjectile,
9898
onProjectileCreated,
99-
onNpcCmd,
10099
onChangeArmorStand,
101100
onEntityTransformation,
102101
/* Block Events */
@@ -855,16 +854,6 @@ void EnableEventListener(int eventId) {
855854
});
856855
break;
857856

858-
case EVENT_TYPES::onNpcCmd:
859-
Event::NpcCmdEvent::subscribe([](const NpcCmdEvent& ev) {
860-
IF_LISTENED(EVENT_TYPES::onNpcCmd) {
861-
CallEvent(EVENT_TYPES::onNpcCmd, EntityClass::newEntity(ev.mNpc), PlayerClass::newPlayer(ev.mPlayer),
862-
String::newString(ev.mCommand));
863-
}
864-
IF_LISTENED_END(EVENT_TYPES::onNpcCmd);
865-
});
866-
break;
867-
868857
case EVENT_TYPES::onSpawnProjectile:
869858
Event::ProjectileSpawnEvent::subscribe([](const ProjectileSpawnEvent& ev) {
870859
IF_LISTENED(EVENT_TYPES::onSpawnProjectile) {

ScriptEngine/src/api/PlayerAPI.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ Local<Value> McClass::getPlayer(const Arguments& args) {
419419

420420
transform(target.begin(), target.end(), target.begin(), ::tolower); // lower case the string
421421
auto playerList = Level::getAllPlayers();
422-
int delta = 2147483647; // c++ int max
422+
int delta = 2147483647; // c++ int max
423423
Player* found = nullptr;
424424

425425
for (Player* p : playerList) {
@@ -805,7 +805,7 @@ Local<Value> PlayerClass::getInLava() {
805805
if (!player)
806806
return Local<Value>();
807807

808-
return Boolean::newBoolean(ActorMobilityUtils::shouldApplyLava(
808+
return Boolean::newBoolean(ActorMobilityUtils::shouldApplyLava(
809809
*(IConstBlockSource*)&player->getDimensionBlockSourceConst(), player->getEntityContext()));
810810
}
811811
CATCH("Fail in getInLava!")
@@ -1257,6 +1257,7 @@ Local<Value> PlayerClass::isOP(const Arguments& args) {
12571257
}
12581258

12591259
#include <llapi/mc/UpdateAbilitiesPacket.hpp>
1260+
12601261
Local<Value> PlayerClass::setPermLevel(const Arguments& args) {
12611262
CHECK_ARGS_COUNT(args, 1);
12621263
CHECK_ARG_TYPE(args[0], ValueKind::kNumber);
@@ -2790,7 +2791,10 @@ Local<Value> PlayerClass::getBlockFromViewVector(const Arguments& args) {
27902791

27912792
Local<Value> PlayerClass::isSimulatedPlayer(const Arguments& args) {
27922793
try {
2793-
return Boolean::newBoolean(get()->isSimulatedPlayer());
2794+
Player* actor = get();
2795+
if (!actor)
2796+
return Local<Value>();
2797+
return Boolean::newBoolean(actor->isSimulatedPlayer());
27942798
}
27952799
CATCH("Fail in isSimulatedPlayer!");
27962800
}

0 commit comments

Comments
 (0)