Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加工作台项合成表崩服 #1150

Closed
EpsilonZunsat opened this issue Mar 23, 2023 · 3 comments
Closed

添加工作台项合成表崩服 #1150

EpsilonZunsat opened this issue Mar 23, 2023 · 3 comments
Labels
bug Related to software malfunction priority: medium Needs attention

Comments

@EpsilonZunsat
Copy link

异常模块

LiteLoader (本体)

操作系统

Windows 11

LiteLoader 版本

LiteLoaderBDS 2.12.0-dev.0+954a36b

BDS 版本

Version 1.19.72.01(ProtocolVersion 575)

发生了什么?

THook(void, "?_loadHardcodedRecipes@Recipes@@AEAAXXZ", Recipes& recipes) {
    original(recipes);
    vector<string> shapeMatrix{ "ABB","BBB","BBB", };
    vector<Recipes::Type> types{ Recipes::Type("minecraft:apple", 'B', 1, 0) };
    vector<HashedString> craftingTags{ "crafting_table" };
    auto item = ItemStack::create("minecraft:reinforced_deepslate");
    recipes.addShapedRecipe("强化的深板岩", ItemInstance(*item), shapeMatrix, types, craftingTags, 2, nullptr,std::nullopt);

}

这是一段可以运行的测试代码,将8个苹果合成强化的深版岩。
此时对A的类型并未定义,如果加一条Recipes::Type("minecraft:cobbled_deepslate", 'A', 1, 0)
这时就会造成崩服。(编译无错误,但是要注释未定义)

THook(void, "?_loadHardcodedRecipes@Recipes@@AEAAXXZ", Recipes& recipes) {
    original(recipes);
    vector<string> shapeMatrix{ "ABB","BBB","BBB", };
    vector<Recipes::Type> types{ Recipes::Type("minecraft:cobbled_deepslate", 'A', 1, 0),Recipes::Type("minecraft:apple", 'B', 1, 0) };
    vector<HashedString> craftingTags{ "crafting_table" };
    auto item = ItemStack::create("minecraft:reinforced_deepslate");
    recipes.addShapedRecipe("强化的深板岩", ItemInstance(*item), shapeMatrix, types, craftingTags, 2, nullptr,std::nullopt);

}

复现此问题的步骤

注释掉RecipeUnlockingRequirement.hpp的未定义行,再进行编译。
CrashDump_20230323_11-05-47.zip

有关的日志/输出

[Crashed!]
-- Unhandled Exception in -> ucrtbase.dll
-- Exception Code: 0xC0000409
-- Minidump generated in Directory ./logs/Crash

[StackTrace] Function invoke_watson at 0x7FF9F5F6DF10  [ucrtbase.dll<6.2.22621.608>]
[StackTrace] Function invalid_parameter_noinfo_noreturn at 0x7FF9F5F6DEE0  [ucrtbase.dll<6.2.22621.608>]
[StackTrace] Function std::vector<std::pair<AutomaticID<Dimension,int>,Bedrock::NonOwnerPointer<IVillageManager> >,std::allocator<std::pair<AutomaticID<Dimension,int>,Bedrock::NonOwnerPointer<IVillageManager> > > >::_Buy_raw at 0x7FF7677C9B60  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function std::vector<RecipeIngredient,std::allocator<RecipeIngredient> >::vector<RecipeIngredient,std::allocator<RecipeIngredient> > at 0x7FF767EA3870  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function Recipes::addShapedRecipe at 0x7FF768B2D000  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function THookTemplate<648026052005880084,-4284869053304590754>::_hook at 0x7FF9AF764A30  [plugin.dll]
-- At File C:\Users\alienware\Desktop\[StackTrace] Function Recipes::init at 0x7FF768B2E030  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function ServerLevel::initialize at 0x7FF767FE9FB0  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function ServerInstance::initializeServer at 0x7FF767F6C5F0  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function DedicatedServer::runDedicatedServerLoop at 0x7FF7676E9ED0  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function DedicatedServer::start at 0x7FF7676EDAF0  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function main at 0x7FF767726E60  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function __scrt_common_main_seh at 0x7FF76944B97C  [bedrock_server_mod.exe<1.19.72.01>]
[StackTrace] Function BaseThreadInitThunk at 0x7FF9F77A26A0  [KERNEL32.DLL<6.2.22621.1344>]
[StackTrace] Function RtlUserThreadStart at 0x7FF9F876A9D0  [ntdll.dll<6.2.22621.1344>]

插件列表

无干扰插件
@KawaiiNahida
Copy link
Member

THook(void, "?_loadHardcodedRecipes@Recipes@@AEAAXXZ", Recipes& recipes) {
    original(recipes);
    vector<string> shapeMatrix{"AAA","ABA","AAA",};
    vector<Recipes::Type> types{ 
        Recipes::Type("minecraft:stick", 'A', 1, 0),
        Recipes::Type("minecraft:diamond", 'B', 1, 0)
    };
    vector<HashedString> craftingTags{ "crafting_table" };
    auto item = ItemStack::create("minecraft:reinforced_deepslate");
    recipes.addShapedRecipe("test::recipe", ItemInstance(*item), shapeMatrix, types, craftingTags, 2, nullptr);
}

虽然是BDS API问题,但是还是建议你可以试试以上代码是否工作
原因大致是因为vector构造时出错

@EpsilonZunsat
Copy link
Author

依旧不行,而且由于addShapedRecipeAPI变更,必须多放入一个参数

@ShrBox ShrBox added bug Related to software malfunction module: LiteLoader priority: medium Needs attention labels Mar 23, 2023
dreamguxiang added a commit that referenced this issue Mar 24, 2023
@dreamguxiang
Copy link
Member

dreamguxiang commented Mar 24, 2023

简单还原了一下RecipeUnlockingRequirement大小,自行查看bds新的注册逻辑,有问题重新打开

yqs112358 added a commit that referenced this issue Mar 24, 2023
* add templates and update StaticVanillaBlocks (#1116)

* fix queryEntities (#1123)

* feat: adapt to 1.19.70 (#1126)

* adapt to 1.19.70

* refactor: replace some direct offset with dAccess

* fix: fix missing tick address

* fix: fix crash caused by autoGenerate

* fix: fix crash caused by autoGenerate

* fix: static vanilla blocks (#1127)

* Add nodiscard and tryUnwrap (#1128)

* add defines

* add tryUnwrap

* Update OwnerStorageEntity.hpp

* Update WeakStorageEntity.hpp

* update

* add nodiscard

* update

* fix: sendTextPacket, sendRawFormPacket and so on

* refactor: replace PacketId which is using int with MinecraftPacketIds

* refactor: remove built-in packet filter

* fix: fix crash #1130

* chore: fix actions sha_short

* refactor: add repository link

* fix: fix `OwnerStorageEntity::tryUnwrap` crash

* chore: fix actions sha_short

* fix: fix some packet api bugs

* fix: fix `ItemActor::getItemStack` crash

* refactor: update MinecraftPacketIds

* feat: #1112 (#1118)

Co-authored-by: WangYneos <[email protected]>
Co-authored-by: ShrBox <[email protected]>

* feat: Python support for LLSE (#1134)

* Add python source code and update ScriptX

* Add some adaption code for python

* Fix ScriptX cmakelist

* Finish general python plugin package loader

* Some fix about package loader

* Finish baselib loading

* Finish pydebug

* Add crowdin processor

* Update langpack

* Fix compile

* Update ScriptX

* Update ScriptX

* Finish python runtime configurations

* No need to create site-packages in python root dir

* Fix binary assets and uncompress code

* Update langpack

* Fix LiteLoaderBDS-CUI (misunderstand before)

* Fix a crash in ScriptX

* Update ScriptX to fix crash

* Fix pydebug

* Update ScriptX

* Update ScriptX

* Fix py debug

* Add product files auto-copy

* Finish pip install support

* Fix plugin load in py

* Add missing python libs

* Fix python module search path

* Small fix to loader

* Update docs

* feat: complete Ref.hpp & EntityId (#1133)

* feat: add tryGetComponent
* feat: complete MojangStyle smart pointers
* feat: complete EntityId
* fix: tryGetComponent

* feat: support signal-file plugin of Py

* build: fix ci not uploading LLSE Python

* refactor: rollback sendTextPacket & sendRawFormPacket because not working

* fix: add plugin source dir to sys.path

* fix: fix added sys.path

* fix: add __file__ to py env

* fix: rename ll.export/import to ll.exports/imports

* fix: update ScriptX to fix custom class registered scope

* feat: add some common functions (#1138)

* feat: add Hopper::isEntity & getCountNoCheck

* feat: add Color::lerp & mix

* refactor: release_notes

* feat: adapt to 1.19.72 (#1143)

* update header

* Revert "refactor: rollback sendTextPacket & sendRawFormPacket because not working"

This reverts commit fba5c4d.

* Update Player.hpp

* fix: try fix NetworkPacket

---------

Co-authored-by: ShrBox <[email protected]>
Co-authored-by: OEOTYAN <[email protected]>

* chore: fix github actions on Create pre-release

* chore: correct release notes

* fix: fix nodejs & python's loader

* fix: fix #1144

* fix: fix some small bugs in loader logic of py

* fix: update scriptx to fix a problem

* fix: fix tick event of LLSE

* feat: add SetCurrentThreadDescriptions to help debug

* fix: update ScriptX to fix main interpreter problem

* fix: fix ScriptEngine linking error

* fix: update ScriptX to fix random crash

* fix: try fix #1150

* chore: update RELEASE_NOTES

* fix Entity functions (#1148)

* fix: fix enum error (#1145)

* fix enum error
* fix a logical error

---------

Co-authored-by: OEOTYAN <[email protected]>
Co-authored-by: qingyu <[email protected]>
Co-authored-by: ShrBox <[email protected]>
Co-authored-by: ShrBox <[email protected]>
Co-authored-by: Tsubasa6848 <[email protected]>
Co-authored-by: WangYneos <[email protected]>
Co-authored-by: student_2333 <[email protected]>
Co-authored-by: starkc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Related to software malfunction priority: medium Needs attention
Development

No branches or pull requests

4 participants