Skip to content

Commit 098eb66

Browse files
committed
feat: adapt to LeviLamina 1.2.0-rc.1
1 parent 2d25b52 commit 098eb66

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

src/legacy/api/EntityAPI.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@
3030
#include "mc/world/actor/ActorDamageSource.h"
3131
#include "mc/world/actor/ActorDefinitionIdentifier.h"
3232
#include "mc/world/actor/ActorType.h"
33-
#include "mc/world/actor/BuiltInActorComponents.h"
3433
#include "mc/world/actor/Mob.h"
3534
#include "mc/world/actor/item/ItemActor.h"
3635
#include "mc/world/actor/player/Player.h"
3736
#include "mc/world/actor/provider/ActorAttribute.h"
3837
#include "mc/world/actor/provider/ActorEquipment.h"
3938
#include "mc/world/actor/provider/SynchedActorDataAccess.h"
40-
#include "mc/world/attribute/AttributeModificationContext.h"
4139
#include "mc/world/attribute/MutableAttributeWithContext.h"
4240
#include "mc/world/attribute/SharedAttributes.h"
4341
#include "mc/world/effect/EffectDuration.h"
@@ -46,7 +44,6 @@
4644
#include "mc/world/level/Spawner.h"
4745
#include "mc/world/level/biome/Biome.h"
4846
#include "mc/world/level/block/Block.h"
49-
#include "mc/world/level/block/CachedComponentData.h"
5047
#include "mc/world/level/block/VanillaBlockTypeIds.h"
5148
#include "mc/world/level/dimension/Dimension.h"
5249
#include "mc/world/level/material/Material.h"
@@ -550,7 +547,9 @@ Local<Value> EntityClass::getInClouds() {
550547
Actor* entity = get();
551548
if (!entity) return Local<Value>();
552549

553-
return Boolean::newBoolean(entity->isInClouds());
550+
short cloudHeight = entity->getDimension().getCloudHeight();
551+
float y = entity->getPosition().y;
552+
return Boolean::newBoolean(y > cloudHeight && y < cloudHeight + 4.0f);
554553
}
555554
CATCH("Fail in getInClouds!")
556555
}

src/legacy/api/PlayerAPI.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
#include "mc/world/level/block/Block.h"
100100
#include "mc/world/level/block/CachedComponentData.h"
101101
#include "mc/world/level/block/VanillaBlockTypeIds.h"
102+
#include "mc/world/level/dimension/Dimension.h"
102103
#include "mc/world/level/material/Material.h"
103104
#include "mc/world/level/storage/AdventureSettings.h"
104105
#include "mc/world/level/storage/DBStorage.h"
@@ -1128,7 +1129,9 @@ Local<Value> PlayerClass::getInClouds() {
11281129
return Local<Value>();
11291130
}
11301131

1131-
return Boolean::newBoolean(player->isInClouds());
1132+
short cloudHeight = player->getDimension().getCloudHeight();
1133+
float y = player->getPosition().y;
1134+
return Boolean::newBoolean(y > cloudHeight && y < cloudHeight + 4.0f);
11321135
}
11331136
CATCH("Fail in getInClouds!")
11341137
}

src/lse/events/BlockEvents.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "mc/world/level/block/FarmBlock.h"
3535
#include "mc/world/level/block/FenceGateBlock.h"
3636
#include "mc/world/level/block/HopperBlock.h"
37-
#include "mc/world/level/block/LiquidBlockDynamic.h"
37+
#include "mc/world/level/block/LiquidBlock.h"
3838
#include "mc/world/level/block/NoteBlock.h"
3939
#include "mc/world/level/block/PoweredRailBlock.h"
4040
#include "mc/world/level/block/RedStoneWireBlock.h"
@@ -337,8 +337,8 @@ REDSTONEHOOK(TntBlock)
337337
LL_TYPE_INSTANCE_HOOK(
338338
LiquidFlowHook,
339339
HookPriority::Normal,
340-
LiquidBlockDynamic,
341-
&LiquidBlockDynamic::_trySpreadTo,
340+
LiquidBlock,
341+
&LiquidBlock::_trySpreadTo,
342342
void,
343343
::BlockSource& region,
344344
::BlockPos const& pos,

src/lse/events/PlayerEvents.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "mc/world/level/block/actor/BarrelBlockActor.h"
4848
#include "mc/world/level/block/actor/ChestBlockActor.h"
4949
#include "mc/world/level/block/actor/PistonBlockActor.h"
50+
#include "mc/world/level/block/block_events/BlockPlayerInteractEvent.h"
5051
#include "mc/world/level/dimension/Dimension.h"
5152
#include "mc/world/level/material/Material.h"
5253
#include "mc/world/phys/AABB.h"
@@ -244,23 +245,22 @@ LL_TYPE_INSTANCE_HOOK(
244245
UseFrameHook1,
245246
HookPriority::Normal,
246247
ItemFrameBlock,
247-
&ItemFrameBlock::$use,
248-
bool,
249-
Player& player,
250-
BlockPos const& pos,
251-
uchar face
248+
&ItemFrameBlock::use,
249+
void,
250+
BlockEvents::BlockPlayerInteractEvent& eventData
252251
) {
253252
IF_LISTENED(EVENT_TYPES::onUseFrameBlock) {
253+
Player& player = eventData.mUnk765a41.as<Player&>();
254254
if (!CallEvent(
255255
EVENT_TYPES::onUseFrameBlock,
256256
PlayerClass::newPlayer(&player),
257-
BlockClass::newBlock(pos, player.getDimensionId())
257+
BlockClass::newBlock(eventData.mUnkd82caf.as<BlockPos>(), player.getDimensionId())
258258
)) {
259-
return false;
259+
return;
260260
}
261261
}
262262
IF_LISTENED_END(EVENT_TYPES::onUseFrameBlock);
263-
return origin(player, pos, face);
263+
return origin(eventData);
264264
}
265265

266266
LL_TYPE_INSTANCE_HOOK(

xmake.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ add_rules("mode.debug", "mode.release")
33
add_repositories("levimc-repo https://github.com/LiteLDev/xmake-repo.git")
44

55
if is_config("target_type", "server") then
6-
add_requires("levilamina c59145f8bd574cfd181343590a56f0b30462764c", {configs = {target_type = "server"}})
6+
add_requires("levilamina 1.2.0-rc.1", {configs = {target_type = "server"}})
77
else
8-
add_requires("levilamina c59145f8bd574cfd181343590a56f0b30462764c", {configs = {target_type = "client"}})
8+
add_requires("levilamina 1.2.0-rc.1", {configs = {target_type = "client"}})
99
end
1010

1111
add_requires("levibuildscript")

0 commit comments

Comments
 (0)