Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
2.0.4更新
Browse files Browse the repository at this point in the history
适配LL2.4.0
  • Loading branch information
twoone3 committed Jul 16, 2022
1 parent 2c337aa commit b40d42e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions API/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ void EnableEventListener(EventCode event_code) {
Event::WitherBossDestroyEvent::subscribe([](const WitherBossDestroyEvent& ev) {
EVENT_BEGIN(EventCode::onWitherBossDestroy);
EVENT_INSERT_EX(WitherBoss, EntityClass((Actor*)ev.mWitherBoss));
EVENT_INSERT_EX(PointA, ev.mDestroyRange.pointA);
EVENT_INSERT_EX(PointB, ev.mDestroyRange.pointB);
EVENT_INSERT_EX(Min, ev.mDestroyRange.min);
EVENT_INSERT_EX(Max, ev.mDestroyRange.max);
EVENT_END;
});
break;
Expand Down
10 changes: 5 additions & 5 deletions API/PlayerAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <MC/Level.hpp>
#include <MC/Packet.hpp>

py::dict NavigateResultToObject(const ScriptNavigationResult& res) {
py::dict NavigateResultToObject(const ScriptModuleMinecraft::ScriptNavigationResult& res) {
py::dict obj;
obj["isFullPath"] = res.mIsFullPath;
obj["path"] = res.mPath;
Expand Down Expand Up @@ -749,14 +749,14 @@ bool PlayerClass::simulateUseItem(const ItemClass& item) {
return sp->simulateUseItem(*item.thiz);
}

bool PlayerClass::simulateUseItem(const ItemClass& item, const BlockPos& pos, ScriptFacing face, const Vec3& relativePos) {
bool PlayerClass::simulateUseItem(const ItemClass& item, const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face, const Vec3& relativePos) {
SimulatedPlayer* sp = asSimulatedPlayer();
if (!sp)
return {};
return sp->simulateUseItemOnBlock(*item.thiz, pos, face, relativePos);
}

bool PlayerClass::simulateUseItem(int slot, const BlockPos& pos, ScriptFacing face, const Vec3& relativePos) {
bool PlayerClass::simulateUseItem(int slot, const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face, const Vec3& relativePos) {
SimulatedPlayer* sp = asSimulatedPlayer();
if (!sp)
return {};
Expand Down Expand Up @@ -802,14 +802,14 @@ bool PlayerClass::simulateStopSneaking() {
return sp->simulateStopSneaking();
}

bool PlayerClass::simulateInteract(const BlockPos& pos, ScriptFacing face) {
bool PlayerClass::simulateInteract(const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face) {
SimulatedPlayer* sp = asSimulatedPlayer();
if (!sp)
return {};
return sp->simulateInteract(pos, face);
}

bool PlayerClass::simulateDestory(const BlockPos& pos, ScriptFacing face) {
bool PlayerClass::simulateDestory(const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face) {
SimulatedPlayer* sp = asSimulatedPlayer();
if (!sp)
return {};
Expand Down
9 changes: 5 additions & 4 deletions API/PlayerAPI.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <Global.hpp>
#include <MC/ScriptModuleMinecraft.hpp>

class SimulatedPlayer;
class Player;
Expand Down Expand Up @@ -114,11 +115,11 @@ struct PlayerClass {
bool simulateAttack();
bool simulateAttack(const EntityClass& target);
bool simulateDestory();
bool simulateDestory(const BlockPos& pos, ScriptFacing face);
bool simulateDestory(const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face);
bool simulateDisconnect();
bool simulateInteract();
bool simulateInteract(const EntityClass& target);
bool simulateInteract(const BlockPos& pos, ScriptFacing face);
bool simulateInteract(const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face);
bool simulateJump();
bool simulateLocalMove(const Vec3& target, float speed = 1.0f);
bool simulateWorldMove(const Vec3& target, float speed = 1.0f);
Expand All @@ -133,8 +134,8 @@ struct PlayerClass {
bool simulateUseItem();
bool simulateUseItem(int slot);
bool simulateUseItem(const ItemClass& item);
bool simulateUseItem(const ItemClass& item, const BlockPos& pos, ScriptFacing face = ScriptFacing::Down, const Vec3& relativePos = {0.5, 0.5, 0.5});
bool simulateUseItem(int slot, const BlockPos& pos, ScriptFacing face = ScriptFacing::Down, const Vec3& relativePos = {0.5, 0.5, 0.5});
bool simulateUseItem(const ItemClass& item, const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face = ScriptModuleMinecraft::ScriptFacing::Down, const Vec3& relativePos = {0.5, 0.5, 0.5});
bool simulateUseItem(int slot, const BlockPos& pos, ScriptModuleMinecraft::ScriptFacing face = ScriptModuleMinecraft::ScriptFacing::Down, const Vec3& relativePos = {0.5, 0.5, 0.5});
bool simulateStopDestroyingBlock();
bool simulateStopInteracting();
bool simulateStopMoving();
Expand Down
4 changes: 2 additions & 2 deletions Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ using namespace std;

constexpr unsigned PYR_VERSION_MAJOR = 2;
constexpr unsigned PYR_VERSION_MINOR = 0;
constexpr unsigned PYR_VERSION_MICRO = 3;
constexpr const char* PYR_VERSION = "v2.0.3";
constexpr unsigned PYR_VERSION_MICRO = 4;
constexpr const char* PYR_VERSION = "v2.0.4";

void entry() {
PY_TRY;
Expand Down
10 changes: 5 additions & 5 deletions ModuleDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {
DEF_ENUM_SIMPLE(SnbtFormat);
DEF_ENUM_SIMPLE(ObjectiveSortOrder);
DEF_ENUM_SIMPLE(BossEventColour);
DEF_ENUM_SIMPLE(ScriptFacing);
DEF_ENUM("ScriptFacing", ScriptModuleMinecraft::ScriptFacing);
DEF_ENUM("TagType", Tag::Type);

#pragma endregion
Expand Down Expand Up @@ -319,11 +319,11 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {
.def("simulateAttack", py::overload_cast<>(&PlayerClass::simulateAttack))
.def("simulateAttack", py::overload_cast<const EntityClass&>(&PlayerClass::simulateAttack))
.def("simulateDestory", py::overload_cast<>(&PlayerClass::simulateDestory))
.def("simulateDestory", py::overload_cast<const BlockPos&, ScriptFacing>(&PlayerClass::simulateDestory))
.def("simulateDestory", py::overload_cast<const BlockPos&, ScriptModuleMinecraft::ScriptFacing>(&PlayerClass::simulateDestory))
.def("simulateDisconnect", &PlayerClass::simulateDisconnect)
.def("simulateInteract", py::overload_cast<>(&PlayerClass::simulateInteract))
.def("simulateInteractEntity", py::overload_cast<const EntityClass&>(&PlayerClass::simulateInteract))
.def("simulateInteractBlock", py::overload_cast<const BlockPos&, ScriptFacing>(&PlayerClass::simulateInteract))
.def("simulateInteractBlock", py::overload_cast<const BlockPos&, ScriptModuleMinecraft::ScriptFacing>(&PlayerClass::simulateInteract))
.def("simulateJump", &PlayerClass::simulateJump)
.def("simulateLocalMove", &PlayerClass::simulateLocalMove, "target"_a, "speed"_a = 1.0f)
.def("simulateWorldMove", &PlayerClass::simulateWorldMove, "target"_a, "speed"_a = 1.0f)
Expand All @@ -338,9 +338,9 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {
.def("simulateUseItem", py::overload_cast<>(&PlayerClass::simulateUseItem))
.def("simulateUseItem2", py::overload_cast<int>(&PlayerClass::simulateUseItem))
.def("simulateUseItem3", py::overload_cast<const ItemClass&>(&PlayerClass::simulateUseItem))
.def("simulateUseItem4", py::overload_cast<const ItemClass&, const BlockPos&, ScriptFacing, const Vec3&>(&PlayerClass::simulateUseItem),
.def("simulateUseItem4", py::overload_cast<const ItemClass&, const BlockPos&, ScriptModuleMinecraft::ScriptFacing, const Vec3&>(&PlayerClass::simulateUseItem),
"item"_a, "pos"_a, "face"_a, "relativePos"_a = Vec3(0.5, 0.5, 0.5))
.def("simulateUseItem5", py::overload_cast<int, const BlockPos&, ScriptFacing, const Vec3&>(&PlayerClass::simulateUseItem),
.def("simulateUseItem5", py::overload_cast<int, const BlockPos&, ScriptModuleMinecraft::ScriptFacing, const Vec3&>(&PlayerClass::simulateUseItem),
"slot"_a, "pos"_a, "face"_a, "relativePos"_a = Vec3(0.5, 0.5, 0.5))
.def("simulateStopDestroyingBlock", &PlayerClass::simulateStopDestroyingBlock)
.def("simulateStopInteracting", &PlayerClass::simulateStopInteracting)
Expand Down
2 changes: 1 addition & 1 deletion SDK
Submodule SDK updated from 1ba63d to 76b81a

0 comments on commit b40d42e

Please sign in to comment.