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

Commit

Permalink
2.0.5更新
Browse files Browse the repository at this point in the history
- 适配LL2.4.2
- 更新clang-format
  • Loading branch information
twoone3 committed Jul 22, 2022
1 parent b40d42e commit ed4b68e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 47 deletions.
56 changes: 33 additions & 23 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
# Visual Studio 生成的 .clang-format 文件

# 此文件中的样式选项是通过“工具”>“选项”
# 复制当前 IDE 格式配置的最佳尝试
# Author: twoone-3
# Reference: https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormatStyleOptions.html

AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AllowShortBlocksOnASingleLine: true
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BasedOnStyle: LLVM
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
BreakBeforeBraces: Custom
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
ColumnLimit: 0
Cpp11BracedListStyle: true
FixNamespaceComments: false
IndentCaseLabels: false
FixNamespaceComments: true
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
MaxEmptyLinesToKeep: 10
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PointerAlignment: Left
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
UseTab: true
UseTab: Always
3 changes: 1 addition & 2 deletions Global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
fifo_json StrToJson(std::string_view str) {
try {
return fifo_json::parse(str);
}
catch (const std::exception& e) {
} catch (const std::exception& e) {
logger.error("\nParsing JSON failed! {}", e.what());
return nullptr;
}
Expand Down
10 changes: 5 additions & 5 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 = 4;
constexpr const char* PYR_VERSION = "v2.0.4";
constexpr unsigned PYR_VERSION_MICRO = 5;
constexpr const char* PYR_VERSION = "v2.0.5";

void entry() {
PY_TRY;
Expand Down Expand Up @@ -45,8 +45,7 @@ void entry() {
if (name.front() == '_') {
logger.debug("Ignoring {}", name);
continue;
}
else {
} else {
PY_TRY;
logger.info("Loading {}", name);
py::module_::import(name.c_str());
Expand All @@ -73,5 +72,6 @@ extern "C" _declspec(dllexport) void onPostInit() {
PYR_VERSION_MINOR,
PYR_VERSION_MICRO,
LL::Version::Release),
{{"Author", "twoone3"}});
"https://github.com/twoone-3/BDSpyrunner.git",
"GPL v3.0");
}
24 changes: 8 additions & 16 deletions ModuleDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,10 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {

.def("setEnum", &CommandClass::setEnum)
.def("setAlias", &CommandClass::setAlias)
.def("mandatory2", py::overload_cast<const string&, DynamicCommand::ParameterType, string, string, CommandParameterOption>(&CommandClass::mandatory),
"name"_a, "type"_a, "description"_a = "", "identifier"_a = "", "option"_a = None)
.def("mandatory", py::overload_cast<const string&, DynamicCommand::ParameterType, string, CommandParameterOption>(&CommandClass::mandatory),
"name"_a, "type"_a, "description"_a = "", "option"_a = None)
.def("optional2", py::overload_cast<const string&, DynamicCommand::ParameterType, string, string, CommandParameterOption>(&CommandClass::optional),
"name"_a, "type"_a, "description"_a = "", "identifier"_a = "", "option"_a = None)
.def("optional", py::overload_cast<const string&, DynamicCommand::ParameterType, string, CommandParameterOption>(&CommandClass::optional),
"name"_a, "type"_a, "description"_a = "", "option"_a = None)
.def("mandatory2", py::overload_cast<const string&, DynamicCommand::ParameterType, string, string, CommandParameterOption>(&CommandClass::mandatory), "name"_a, "type"_a, "description"_a = "", "identifier"_a = "", "option"_a = None)
.def("mandatory", py::overload_cast<const string&, DynamicCommand::ParameterType, string, CommandParameterOption>(&CommandClass::mandatory), "name"_a, "type"_a, "description"_a = "", "option"_a = None)
.def("optional2", py::overload_cast<const string&, DynamicCommand::ParameterType, string, string, CommandParameterOption>(&CommandClass::optional), "name"_a, "type"_a, "description"_a = "", "identifier"_a = "", "option"_a = None)
.def("optional", py::overload_cast<const string&, DynamicCommand::ParameterType, string, CommandParameterOption>(&CommandClass::optional), "name"_a, "type"_a, "description"_a = "", "option"_a = None)
.def("setSoftEnum", &CommandClass::setSoftEnum)
.def("addSoftEnumValues", &CommandClass::addSoftEnumValues)
.def("removeSoftEnumValues", &CommandClass::removeSoftEnumValues)
Expand Down Expand Up @@ -307,8 +303,7 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {
.def("hasTag", &PlayerClass::hasTag)
.def("getAllTags", &PlayerClass::getAllTags)
.def("getEntityFromViewVector", &PlayerClass::getEntityFromViewVector, "max_distance"_a = 5.25f)
.def("getBlockFromViewVector", &PlayerClass::getBlockFromViewVector,
"includeLiquid"_a = false, "solidOnly"_a = false, "maxDistance"_a = 5.25f, "ignoreBorderBlocks"_a = true, "fullOnly"_a = false)
.def("getBlockFromViewVector", &PlayerClass::getBlockFromViewVector, "includeLiquid"_a = false, "solidOnly"_a = false, "maxDistance"_a = 5.25f, "ignoreBorderBlocks"_a = true, "fullOnly"_a = false)

.def("removeItem", &PlayerClass::removeItem)
.def("setHeadShow", &PlayerClass::setHeadShow)
Expand Down Expand Up @@ -338,17 +333,14 @@ 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&, 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&, ScriptModuleMinecraft::ScriptFacing, const Vec3&>(&PlayerClass::simulateUseItem),
"slot"_a, "pos"_a, "face"_a, "relativePos"_a = Vec3(0.5, 0.5, 0.5))
.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&, 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)
.def("simulateStopMoving", &PlayerClass::simulateStopMoving)
.def("simulateStopUsingItem", &PlayerClass::simulateStopUsingItem)
.def("simulateStopSneaking", &PlayerClass::simulateStopSneaking);


py::class_<EntityClass>(mc_module, "Entity")
.def_property("name", &EntityClass::getName, nullptr)
.def_property("type", &EntityClass::getType, nullptr)
Expand Down Expand Up @@ -398,7 +390,7 @@ PYBIND11_EMBEDDED_MODULE(mc, mc_module) {
.def_property("name", &ObjectiveClass::getName, nullptr)
.def_property("display_name", &ObjectiveClass::getDisplayName, nullptr)

.def("setDisplay", &ObjectiveClass::setDisplay, "slot"_a, "sort"_a=0)
.def("setDisplay", &ObjectiveClass::setDisplay, "slot"_a, "sort"_a = 0)
.def("setScore", &ObjectiveClass::setScore)
.def("addScore", &ObjectiveClass::addScore)
.def("reduceScore", &ObjectiveClass::reduceScore)
Expand Down
2 changes: 1 addition & 1 deletion SDK
Submodule SDK updated from 76b81a to 1c9392

0 comments on commit ed4b68e

Please sign in to comment.