Skip to content

Commit

Permalink
support 1.18.2.03
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohengying committed Jan 3, 2022
1 parent 213763c commit cecf9dd
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 42 deletions.
2 changes: 1 addition & 1 deletion api/Offset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions api/graphics/Particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion api/graphics/Particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

- 支持1.18.2.03
- `self`群系显示恢复
- 修复下界无法显示hsa的问题
- 修复人在下界的时候显示为主世界的bug
- 调整了HSA线框的颜色使其更清晰

# 1.18.1.02-0.9.90
2021-12-05
Expand Down
10 changes: 5 additions & 5 deletions mod/spawn/HsaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions mod/spawn/SpawnHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
7 changes: 4 additions & 3 deletions mod/village/Village.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,21 @@ 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),
villageHelperConfig.centerParticle);
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();
}
Expand Down
57 changes: 30 additions & 27 deletions tools/package/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,75 @@

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')
exit(0)
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')

0 comments on commit cecf9dd

Please sign in to comment.