Skip to content

Commit

Permalink
feat: adapt to LeviLamina 1.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jun 16, 2024
1 parent b39d233 commit 5df72de
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "native",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
"author": "LiteLDev",
"version": "0.7.12",
"version": "0.8.0",
"dependencies": [
{
"name": "LegacyMoney"
Expand Down
6 changes: 2 additions & 4 deletions src/legacy/api/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "ll/api/event/player/PlayerSprintEvent.h"
#include "ll/api/event/player/PlayerSwingEvent.h"
#include "ll/api/event/player/PlayerUseItemEvent.h"
#include "ll/api/event/player/PlayerUseItemOnEvent.h"
#include "ll/api/event/server/ServerStartedEvent.h"
#include "ll/api/event/world/BlockChangedEvent.h"
#include "ll/api/event/world/FireSpreadEvent.h"
Expand Down Expand Up @@ -349,7 +348,7 @@ void EnableEventListener(int eventId) {
break;

case EVENT_TYPES::onUseItemOn:
bus.emplaceListener<PlayerUseItemOnEvent>([](PlayerUseItemOnEvent& ev) {
bus.emplaceListener<PlayerInteractBlockEvent>([](PlayerInteractBlockEvent& ev) {
IF_LISTENED(EVENT_TYPES::onUseItemOn) {
CallEvent(
EVENT_TYPES::onUseItemOn,
Expand Down Expand Up @@ -615,13 +614,12 @@ void EnableEventListener(int eventId) {
break;

case EVENT_TYPES::onBlockInteracted:

bus.emplaceListener<PlayerInteractBlockEvent>([](PlayerInteractBlockEvent& ev) {
IF_LISTENED(EVENT_TYPES::onBlockInteracted) {
CallEvent(
EVENT_TYPES::onBlockInteracted,
PlayerClass::newPlayer(&ev.self()),
BlockClass::newBlock(ev.pos(), ev.self().getDimensionId())
BlockClass::newBlock(ev.blockPos(), ev.self().getDimensionId())
);
}
IF_LISTENED_END(EVENT_TYPES::onBlockInteracted);
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/api/ItemAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Local<Value> ItemClass::isStackable() {

Local<Value> ItemClass::isWearableItem() {
try {
return Boolean::newBoolean(get()->isWearableItem());
return Boolean::newBoolean(get()->isHumanoidWearableItem());
}
CATCH("Fail in isWearableItem!");
}
Expand Down
15 changes: 8 additions & 7 deletions src/legacy/api/PlayerAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ Local<Value> McClass::deletePlayerScore(const Arguments& args) {
if (!id.isValid()) {
return Boolean::newBoolean(true);
}
return Boolean::newBoolean(scoreboard.getScoreboardIdentityRef(id)->removeFromObjective(scoreboard, *objective)
);
objective->_resetPlayer(id);
return Boolean::newBoolean(true);
}
CATCH("Fail in deletePlayerScore!")
}
Expand Down Expand Up @@ -1553,7 +1553,7 @@ Local<Value> PlayerClass::talkAs(const Arguments& args) {
if (!player) return Local<Value>();

TextPacket pkt =
TextPacket::createChat(player->getName(), args[0].asString().toString(), player->getXuid(), "");
TextPacket::createChat(player->getName(), args[0].asString().toString(), player->getXuid(), "", "");
if (ll::service::getLevel().has_value()) {
IF_LISTENED(EVENT_TYPES::onChat) {
CallEventRtnValue(
Expand Down Expand Up @@ -1587,7 +1587,7 @@ Local<Value> PlayerClass::talkTo(const Arguments& args) {
if (!player) return Local<Value>();

TextPacket pkt =
TextPacket::createChat(player->getRealName(), args[0].asString().toString(), player->getXuid(), "");
TextPacket::createChat(player->getRealName(), args[0].asString().toString(), player->getXuid(), "", "");
target->sendNetworkPacket(pkt);
return Boolean::newBoolean(true);
}
Expand Down Expand Up @@ -2084,7 +2084,8 @@ Local<Value> PlayerClass::deleteScore(const Arguments& args) {
if (!id.isValid()) {
return Boolean::newBoolean(true);
}
return Boolean::newBoolean(scoreboard.getScoreboardIdentityRef(id)->removeFromObjective(scoreboard, *obj));
obj->_resetPlayer(id);
return Boolean::newBoolean(true);
}
CATCH("Fail in deleteScore!");
}
Expand Down Expand Up @@ -3470,7 +3471,7 @@ Local<Value> PlayerClass::getBiomeId() {
try {
Player* player = get();
if (!player) return Local<Value>();
Biome& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
Biome const& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
return Number::newNumber(ll::memory::dAccess<int>(&bio, 0x80));
}
CATCH("Fail in getBiomeId!");
Expand All @@ -3480,7 +3481,7 @@ Local<Value> PlayerClass::getBiomeName() {
try {
Player* player = get();
if (!player) return Local<Value>();
Biome& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
Biome const& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
return String::newString(ll::memory::dAccess<HashedString>(&bio, 0x08).getString());
}
CATCH("Fail in getBiomeName!");
Expand Down
6 changes: 4 additions & 2 deletions src/legacy/api/ScoreboardAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ Local<Value> ObjectiveClass::deleteScore(const Arguments& args) {
if (!id.isValid()) {
return Boolean::newBoolean(true);
}
return Boolean::newBoolean(scoreboard.getScoreboardIdentityRef(id)->removeFromObjective(scoreboard, *obj));
obj->_resetPlayer(id);
return Boolean::newBoolean(true);
} else if (IsInstanceOf<PlayerClass>(args[0])) {
Player* player = PlayerClass::extract(args[0]);
Scoreboard& scoreboard = ll::service::getLevel()->getScoreboard();
Expand All @@ -253,7 +254,8 @@ Local<Value> ObjectiveClass::deleteScore(const Arguments& args) {
if (!id.isValid()) {
return Boolean::newBoolean(true);
}
return Boolean::newBoolean(scoreboard.getScoreboardIdentityRef(id)->removeFromObjective(scoreboard, *obj));
obj->_resetPlayer(id);
return Boolean::newBoolean(true);
} else {
LOG_WRONG_ARG_TYPE();
return Local<Value>();
Expand Down
6 changes: 3 additions & 3 deletions src/legacy/api/SimulatedPlayerAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
auto pos = IntPos::extractPos(args[0]);
auto did = pos->getDimensionId();
if (dimid == did || did < 0 || did > 2) {
sp->simulateLookAt(pos->getBlockPos());
sp->simulateLookAt(pos->getBlockPos(), (sim::LookDuration)0);
return Boolean::newBoolean(true);
}
lse::getSelfPluginInstance().getLogger().debug("Can't simulate look at other dimension!");
Expand All @@ -401,7 +401,7 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
auto pos = FloatPos::extractPos(args[0]);
auto did = pos->getDimensionId();
if (dimid == did || did < 0 || did > 2) {
sp->simulateLookAt(pos->getVec3());
sp->simulateLookAt(pos->getVec3(), (sim::LookDuration)0);
return Boolean::newBoolean(true);
}
lse::getSelfPluginInstance().getLogger().debug("Can't simulate look at other dimension!");
Expand All @@ -411,7 +411,7 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
auto pos = IntPos::extractPos(block->getPos());
auto did = pos->getDimensionId();
if (dimid == did || did < 0 || did > 2) {
sp->simulateLookAt(pos->getBlockPos());
sp->simulateLookAt(pos->getBlockPos(), (sim::LookDuration)0);
return Boolean::newBoolean(true);
}
lse::getSelfPluginInstance().getLogger().debug("Can't simulate look at other dimension!");
Expand Down
6 changes: 3 additions & 3 deletions tooth.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "github.com/LiteLDev/LegacyScriptEngine",
"version": "0.7.12",
"version": "0.8.0",
"info": {
"name": "LegacyScriptEngine",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
Expand All @@ -12,7 +12,7 @@
]
},
"dependencies": {
"gitea.litebds.com/LiteLDev/legacy-script-engine-lua": "0.7.12",
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": "0.7.12"
"gitea.litebds.com/LiteLDev/legacy-script-engine-lua": "0.8.0",
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": "0.8.0"
}
}
10 changes: 5 additions & 5 deletions tooth.lua.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-lua",
"version": "0.7.12",
"version": "0.8.0",
"info": {
"name": "LegacyScriptEngine with Lua backend",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
Expand All @@ -12,12 +12,12 @@
]
},
"dependencies": {
"github.com/LiteLDev/LegacyRemoteCall": "0.7.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.7.x",
"github.com/LiteLDev/LegacyMoney": "0.7.x"
"github.com/LiteLDev/LegacyRemoteCall": "0.8.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.8.x",
"github.com/LiteLDev/LegacyMoney": "0.8.x"
},
"prerequisites": {
"github.com/LiteLDev/LeviLamina": "0.12.x"
"github.com/LiteLDev/LeviLamina": "1.0.x"
},
"files": {
"place": [
Expand Down
10 changes: 5 additions & 5 deletions tooth.nodejs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-nodejs",
"version": "0.7.12",
"version": "0.8.0",
"info": {
"name": "LegacyScriptEngine with NodeJs backend",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
Expand All @@ -12,14 +12,14 @@
]
},
"dependencies": {
"github.com/LiteLDev/LegacyRemoteCall": "0.7.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.7.x",
"github.com/LiteLDev/LegacyMoney": "0.7.x",
"github.com/LiteLDev/LegacyRemoteCall": "0.8.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.8.x",
"github.com/LiteLDev/LegacyMoney": "0.8.x",
"gitea.litebds.com/ShrBox/7-zip": "23.x",
"gitea.litebds.com/LiteLDev/node-binaries": "16.16.0"
},
"prerequisites": {
"github.com/LiteLDev/LeviLamina": "0.12.x"
"github.com/LiteLDev/LeviLamina": "1.0.x"
},
"files": {
"place": [
Expand Down
10 changes: 5 additions & 5 deletions tooth.python.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-python",
"version": "0.7.12",
"version": "0.8.0",
"info": {
"name": "LegacyScriptEngine with Python backend",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
Expand All @@ -12,13 +12,13 @@
]
},
"dependencies": {
"github.com/LiteLDev/LegacyRemoteCall": "0.7.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.7.x",
"github.com/LiteLDev/LegacyMoney": "0.7.x",
"github.com/LiteLDev/LegacyRemoteCall": "0.8.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.8.x",
"github.com/LiteLDev/LegacyMoney": "0.8.x",
"gitea.litebds.com/LiteLDev/python-binaries": "3.10.11"
},
"prerequisites": {
"github.com/LiteLDev/LeviLamina": "0.12.x"
"github.com/LiteLDev/LeviLamina": "1.0.x"
},
"files": {
"place": [
Expand Down
10 changes: 5 additions & 5 deletions tooth.quickjs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs",
"version": "0.7.12",
"version": "0.8.0",
"info": {
"name": "LegacyScriptEngine with QuickJs backend",
"description": "A plugin engine for running LLSE plugins on LeviLamina",
Expand All @@ -12,12 +12,12 @@
]
},
"dependencies": {
"github.com/LiteLDev/LegacyRemoteCall": "0.7.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.7.x",
"github.com/LiteLDev/LegacyMoney": "0.7.x"
"github.com/LiteLDev/LegacyRemoteCall": "0.8.x",
"github.com/LiteLDev/LegacyParticleAPI": "0.8.x",
"github.com/LiteLDev/LegacyMoney": "0.8.x"
},
"prerequisites": {
"github.com/LiteLDev/LeviLamina": "0.12.x"
"github.com/LiteLDev/LeviLamina": "1.0.x"
},
"files": {
"place": [
Expand Down
8 changes: 4 additions & 4 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ add_requires(
"demangler",
"dyncall",
"fmt",
"legacymoney 0.7.0",
"legacyparticleapi 0.7.0",
"legacyremotecall 0.7.0",
"levilamina 0.12.3",
"legacymoney 0.8.0",
"legacyparticleapi 0.8.0",
"legacyremotecall 0.8.0",
"levilamina develop",
"lightwebsocketclient",
"magic_enum",
"nlohmann_json",
Expand Down

0 comments on commit 5df72de

Please sign in to comment.