Skip to content

Commit e894fa1

Browse files
committed
build: correct .clangd and fix some bugs
1 parent 54ec0c6 commit e894fa1

File tree

5 files changed

+32
-174
lines changed

5 files changed

+32
-174
lines changed

.clang-tidy

-145
This file was deleted.

.clangd

-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@ CompileFlags:
88
Add:
99
- "-ferror-limit=0"
1010
- '-D__FUNCTION__="dummy"'
11-
- "-Yusrc/ll/api/Global.h"
12-
- "-FIsrc/ll/api/Global.h" # clangd bug can't find pch file
13-
Remove:
14-
- "/YuGlobal.h"
15-
- "/FIGlobal.h"

src/api/EntityAPI.cpp

+15-12
Original file line numberDiff line numberDiff line change
@@ -1422,16 +1422,19 @@ Local<Value> EntityClass::getBlockFromViewVector(const Arguments& args) {
14221422
fullOnly = args[3].asBoolean().value();
14231423
}
14241424
HitResult res = actor->traceRay(maxDistance, false, true);
1425-
Block bl;
1426-
BlockPos bp;
1427-
if (includeLiquid && res.mIsHitLiquid) {
1428-
bp = res.mLiquidPos;
1429-
} else {
1430-
bp = res.mBlockPos;
1431-
}
1432-
actor->getDimensionBlockSource().getBlock(bp);
1433-
if (bl.isEmpty()) return Local<Value>();
1434-
return BlockClass::newBlock(std::move(&bl), &bp, actor->getDimensionId().id);
1425+
1426+
return Local<Value>(); // Temporary solution
1427+
// TODO: Fix this, block cannot be constructed.
1428+
// Block bl;
1429+
// BlockPos bp;
1430+
// if (includeLiquid && res.mIsHitLiquid) {
1431+
// bp = res.mLiquidPos;
1432+
// } else {
1433+
// bp = res.mBlockPos;
1434+
// }
1435+
// actor->getDimensionBlockSource().getBlock(bp);
1436+
// if (bl.isEmpty()) return Local<Value>();
1437+
// return BlockClass::newBlock(std::move(&bl), &bp, actor->getDimensionId().id);
14351438
}
14361439
CATCH("Fail in getBlockFromViewVector!");
14371440
}
@@ -1451,7 +1454,7 @@ Local<Value> EntityClass::getBiomeId() {
14511454
try {
14521455
Actor* actor = get();
14531456
if (!actor) return Local<Value>();
1454-
auto bio = actor->getDimensionBlockSource().getBiome(actor->getFeetBlockPos());
1457+
auto& bio = actor->getDimensionBlockSource().getBiome(actor->getFeetBlockPos());
14551458
return Number::newNumber(bio.getId());
14561459
}
14571460
CATCH("Fail in getBiomeId!");
@@ -1461,7 +1464,7 @@ Local<Value> EntityClass::getBiomeName() {
14611464
try {
14621465
Actor* actor = get();
14631466
if (!actor) return Local<Value>();
1464-
auto bio = actor->getDimensionBlockSource().getBiome(actor->getFeetBlockPos());
1467+
auto& bio = actor->getDimensionBlockSource().getBiome(actor->getFeetBlockPos());
14651468
return String::newString(bio.getName());
14661469
}
14671470
CATCH("Fail in getBiomeName!");

src/api/PlayerAPI.cpp

+15-12
Original file line numberDiff line numberDiff line change
@@ -2972,16 +2972,19 @@ Local<Value> PlayerClass::getBlockFromViewVector(const Arguments& args) {
29722972
fullOnly = args[3].asBoolean().value();
29732973
}
29742974
HitResult res = player->traceRay(maxDistance, false, true);
2975-
Block bl;
2976-
BlockPos bp;
2977-
if (includeLiquid && res.mIsHitLiquid) {
2978-
bp = res.mLiquidPos;
2979-
} else {
2980-
bp = res.mBlockPos;
2981-
}
2982-
player->getDimensionBlockSource().getBlock(bp);
2983-
if (bl.isEmpty()) return Local<Value>();
2984-
return BlockClass::newBlock(std::move(&bl), &bp, player->getDimensionId().id);
2975+
2976+
return Local<Value>();
2977+
// TODO
2978+
// Block bl;
2979+
// BlockPos bp;
2980+
// if (includeLiquid && res.mIsHitLiquid) {
2981+
// bp = res.mLiquidPos;
2982+
// } else {
2983+
// bp = res.mBlockPos;
2984+
// }
2985+
// player->getDimensionBlockSource().getBlock(bp);
2986+
// if (bl.isEmpty()) return Local<Value>();
2987+
// return BlockClass::newBlock(std::move(&bl), &bp, player->getDimensionId().id);
29852988
}
29862989
CATCH("Fail in getBlockFromViewVector!");
29872990
}
@@ -3354,7 +3357,7 @@ Local<Value> PlayerClass::getBiomeId() {
33543357
try {
33553358
Player* player = get();
33563359
if (!player) return Local<Value>();
3357-
Biome bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
3360+
Biome& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
33583361
return Number::newNumber(bio.getId());
33593362
}
33603363
CATCH("Fail in getBiomeId!");
@@ -3364,7 +3367,7 @@ Local<Value> PlayerClass::getBiomeName() {
33643367
try {
33653368
Player* player = get();
33663369
if (!player) return Local<Value>();
3367-
Biome bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
3370+
Biome& bio = player->getDimensionBlockSource().getBiome(player->getFeetBlockPos());
33683371
return String::newString(bio.getName());
33693372
}
33703373
CATCH("Fail in getBiomeName!");

xmake.lua

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_requires(
88
"legacyparticleapi 0.1.1",
99
"levilamina 0.5.1",
1010
"lightwebsocketclient 1.0.0",
11+
"magic_enum v0.9.0",
1112
"mariadb-connector-c 3.3.4",
1213
"simpleini v4.19",
1314
"sqlite3 3.43.0+200",
@@ -86,6 +87,7 @@ target("legacy-script-engine")
8687
"legacyparticleapi",
8788
"levilamina",
8889
"lightwebsocketclient",
90+
"magic_enum",
8991
"mariadb-connector-c",
9092
"scriptx",
9193
"simpleini",

0 commit comments

Comments
 (0)