From cecf9dd88ed9922bd7822356be00fdcc8cde9094 Mon Sep 17 00:00:00 2001 From: xiaohengying <2602645221@qq.com> Date: Mon, 3 Jan 2022 16:42:26 +0800 Subject: [PATCH] support 1.18.2.03 --- api/Offset.h | 2 +- api/graphics/Particle.cpp | 10 ++++--- api/graphics/Particle.h | 2 +- changelog.md | 3 +++ mod/spawn/HsaManager.cpp | 10 +++---- mod/spawn/SpawnHelper.cpp | 4 +-- mod/village/Village.cpp | 7 ++--- tools/package/pack.py | 57 ++++++++++++++++++++------------------- 8 files changed, 53 insertions(+), 42 deletions(-) diff --git a/api/Offset.h b/api/Offset.h index f8a703d..84971b5 100644 --- a/api/Offset.h +++ b/api/Offset.h @@ -32,7 +32,7 @@ namespace off { // OK // Actor::getDimensionId - constexpr uint64_t ACTOR_GET_DIMENSION_ID = 0xEC; + constexpr uint64_t ACTOR_GET_DIMENSION_ID = 0xE4; // OK // from ServerPlayer::isHostingPlayer diff --git a/api/graphics/Particle.cpp b/api/graphics/Particle.cpp index 34ef6e6..facddb7 100644 --- a/api/graphics/Particle.cpp +++ b/api/graphics/Particle.cpp @@ -192,16 +192,20 @@ namespace trapdoor { player->getDimension()); } - void spawnRectangleParticle(const AABB &aabb, GRAPHIC_COLOR color, - int dimType) { + bool mark, int dimType) { auto p1 = aabb.p1, p2 = aabb.p2; auto dx = p2.x - p1.x; auto dy = p2.y - p1.y; auto dz = p2.z - p1.z; drawLine(p1, FACING::POS_X, dx, color, dimType); - drawLine(p1, FACING::POS_Y, dy, color, dimType); + if (mark) { + drawLine(p1, FACING::POS_Y, dy, GRAPH_COLOR::WHITE, dimType); + } else { + drawLine(p1, FACING::POS_Y, dy, color, dimType); + } drawLine(p1, FACING::POS_Z, dz, color, dimType); + Vec3 p3{p2.x, p1.y, p2.z}; drawLine(p3, FACING::NEG_X, dx, color, dimType); drawLine(p3, FACING::POS_Y, dy, color, dimType); diff --git a/api/graphics/Particle.h b/api/graphics/Particle.h index e3df6a7..60a13b5 100644 --- a/api/graphics/Particle.h +++ b/api/graphics/Particle.h @@ -25,7 +25,7 @@ namespace trapdoor { void spawnParticle(Vec3 p, std::string &type, int dimType = 0); void spawnRectangleParticle(const AABB &aabb, GRAPHIC_COLOR color, - int dimType = 0); + bool mark, int dimType = 0); void spawnChunkSurfaceParticle(const ChunkPos &pos, int dimID); diff --git a/changelog.md b/changelog.md index 0b55aad..3f3fb10 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,9 @@ - 支持1.18.2.03 - `self`群系显示恢复 +- 修复下界无法显示hsa的问题 +- 修复人在下界的时候显示为主世界的bug +- 调整了HSA线框的颜色使其更清晰 # 1.18.1.02-0.9.90 2021-12-05 diff --git a/mod/spawn/HsaManager.cpp b/mod/spawn/HsaManager.cpp index 5918e1d..64b3374 100644 --- a/mod/spawn/HsaManager.cpp +++ b/mod/spawn/HsaManager.cpp @@ -97,22 +97,22 @@ namespace mod { for (const auto &hsa : this->hsaList) { switch (hsa.type) { case PillagerOutpost: - color = trapdoor::GRAPHIC_COLOR::YELLOW; + color = trapdoor::GRAPHIC_COLOR::BLUE; break; case SwampHut: - color = trapdoor::GRAPHIC_COLOR::GREEN; + color = trapdoor::GRAPHIC_COLOR::RED; break; case NetherFortress: - color = trapdoor::GRAPHIC_COLOR::RED; + color = trapdoor::GRAPHIC_COLOR::GREEN; break; case OceanMonument: - color = trapdoor::GRAPHIC_COLOR::BLUE; + color = trapdoor::GRAPHIC_COLOR::YELLOW; break; default: break; } trapdoor::spawnRectangleParticle(hsa.boundingBox.getSpawnArea(), - color, hsa.dimensionID); + color, true, hsa.dimensionID); } } this->gameTick = (this->gameTick + 1) % 80; diff --git a/mod/spawn/SpawnHelper.cpp b/mod/spawn/SpawnHelper.cpp index c8c77f8..b396e78 100644 --- a/mod/spawn/SpawnHelper.cpp +++ b/mod/spawn/SpawnHelper.cpp @@ -38,14 +38,14 @@ namespace mod { verticalSpawnPositions[0]}; trapdoor::spawnRectangleParticle(boundingBox.toAABB(), trapdoor::GRAPHIC_COLOR::GREEN, - dimensionID); + false, dimensionID); } for (auto i = 1; i < verticalSpawnPositions.size(); i++) { trapdoor::BoundingBox boundingBox{verticalSpawnPositions[i], verticalSpawnPositions[i]}; trapdoor::spawnRectangleParticle(boundingBox.toAABB(), trapdoor::GRAPHIC_COLOR::RED, - dimensionID); + false, dimensionID); } } diff --git a/mod/village/Village.cpp b/mod/village/Village.cpp index cc15347..ca7cd31 100644 --- a/mod/village/Village.cpp +++ b/mod/village/Village.cpp @@ -303,7 +303,8 @@ namespace mod { if (village) { if (this->showBounds) trapdoor::spawnRectangleParticle( - village->getBounds(), villageHelperConfig.boundColor); + village->getBounds(), villageHelperConfig.boundColor, + false); if (this->showVillageCenter) trapdoor::spawnParticle( village->getCenter() + Vec3(0.5f, 0.9f, 0.5f), @@ -311,12 +312,12 @@ namespace mod { if (this->showGolemSpawnArea) trapdoor::spawnRectangleParticle( village->getGolemSpawnArea(), - villageHelperConfig.spawnColor); + villageHelperConfig.spawnColor, false); if (this->showPOIRange) trapdoor::spawnRectangleParticle( village->getPOIRange(), - villageHelperConfig.poiQueryColor); + villageHelperConfig.poiQueryColor, false); if (this->showDwellerStatus) this->showVillagerStatus(); } diff --git a/tools/package/pack.py b/tools/package/pack.py index 0dfd64c..4719a1d 100644 --- a/tools/package/pack.py +++ b/tools/package/pack.py @@ -6,17 +6,18 @@ relative_dir = '../../' build_dir_name = 'build' -build_dir = relative_dir+build_dir_name +build_dir = relative_dir+build_dir_name lang_folders = 'lang/' config_file = 'trapdoor-config.json' -other_files = ['../../changelog.md','../../README.md','../../README_zh.md','../../trapdoor-disclaimer.md','../../LICENSE'] +other_files = ['../../changelog.md', '../../README.md', + '../../README_zh.md', '../../trapdoor-disclaimer.md', '../../LICENSE'] -#get dll files +# get dll files dll_files = [] -for file in os.listdir(build_dir): - if file.endswith('.dll'): - dll_files.append(file) +for file in os.listdir(build_dir): + if file.endswith('.dll'): + dll_files.append(file) if len(dll_files) == 0: input('warning: no valid files') @@ -24,54 +25,56 @@ dll_files.sort() tips = 'choose one to pack\n' index = 0 -for file in reversed(dll_files): - tips += '['+ str(index)+ '] : '+ file+'\n' +for file in reversed(dll_files): + tips += '[' + str(index) + '] : ' + file+'\n' index += 1 -#choose version +# choose version idx = 0 -if len(dll_files) > 1: - idx = input(tips) +if len(dll_files) > 1: + idx = input(tips) idx = int(idx) - if idx <0 or idx >= len(dll_files): + if idx < 0 or idx >= len(dll_files): input('invalid files\n') exit(0) dll_file = dll_files[len(dll_files)-1-idx] -full_dll_file_path = build_dir+'/'+ dll_file -os.system('upx '+full_dll_file_path) -## check lang and config.json -if not (path.exists(lang_folders) and path.exists(config_file)): +full_dll_file_path = build_dir+'/' + dll_file +#os.system('upx '+full_dll_file_path) +# check lang and config.json +if not (path.exists(lang_folders) and path.exists(config_file)): input('can not find land folder or config_file') exit(0) -## check other files +# check other files for other_file in other_files: if not path.exists(other_file): input('can not find file'+other_file+'\n') exit(0) -#get version +# get version version = dll_file[:-4] print('version is '+version) print('begin packing...') -#begin pack -#zip.write 第一个参数是要打包的文件,第二个参数是该文件在压缩包中的相对路径 -release_zip_file = zipfile.ZipFile(version +'.zip','w') -zip_root_path='./plugins/trapdoor/' -release_zip_file.write(build_dir+'/'+ dll_file,arcname= './plugins/'+dll_file) +# begin pack +# zip.write 第一个参数是要打包的文件,第二个参数是该文件在压缩包中的相对路径 +release_zip_file = zipfile.ZipFile(version + '.zip', 'w') +zip_root_path = './plugins/trapdoor/' +release_zip_file.write(build_dir+'/' + dll_file, arcname='./plugins/'+dll_file) print('pack: ' + dll_file) -for file in os.listdir(lang_folders): +for file in os.listdir(lang_folders): if file.endswith('.json'): print('pack: ' + file) - release_zip_file.write(lang_folders+file,arcname=zip_root_path+lang_folders+file) + release_zip_file.write( + lang_folders+file, arcname=zip_root_path+lang_folders+file) for other_file in other_files: other_file_name = other_file[5:] print('pack: ' + other_file_name) - release_zip_file.write(other_file,arcname=zip_root_path+'others/'+other_file_name) -release_zip_file.write(config_file,zip_root_path+config_file) + release_zip_file.write( + other_file, arcname=zip_root_path+'others/'+other_file_name) +release_zip_file.write(config_file, zip_root_path+config_file) release_zip_file.close() input('success pack release:' + version+'.zip\n')