LeviLamina
Loading...
Searching...
No Matches
PlayerPlaceBlockEvent.h
1#pragma once
2
3#include "ll/api/event/Cancellable.h"
4#include "ll/api/event/player/PlayerClickEvent.h"
5
6#include "mc/world/actor/player/Player.h"
7#include "mc/world/level/BlockPos.h"
8#include "mc/world/level/block/Block.h"
9
10namespace ll::event::inline player {
11
13 BlockPos const& mPos;
14
15protected:
16 constexpr explicit PlayerPlaceBlockEvent(Player& player, BlockPos const& pos)
17 : PlayerRightClickEvent(player),
18 mPos(pos) {}
19
20public:
21 LLAPI void serialize(CompoundTag&) const override;
22
23 LLNDAPI BlockPos const& pos() const;
24};
25
26class PlayerPlacingBlockEvent final : public Cancellable<PlayerPlaceBlockEvent> {
27 uchar const& mFace;
28
29public:
30 constexpr explicit PlayerPlacingBlockEvent(Player& player, BlockPos const& pos, uchar const& face)
31 : Cancellable(player, pos),
32 mFace(face) {}
33
34 LLAPI void serialize(CompoundTag&) const override;
35
36 LLNDAPI uchar const& face() const;
37};
38
40 Block const& mPlacedBlock;
41
42public:
43 constexpr explicit PlayerPlacedBlockEvent(Player& player, BlockPos const& pos, Block const& placedBlock)
44 : PlayerPlaceBlockEvent(player, pos),
45 mPlacedBlock(placedBlock) {}
46
47 LLAPI void serialize(CompoundTag&) const override;
48
49 LLNDAPI Block const& placedBlock() const;
50};
51} // namespace ll::event::inline player
Definition BlockPos.h:18
Definition Block.h:36
Definition CompoundTag.h:13
Definition Player.h:119
Definition PlayerPlaceBlockEvent.h:12
Definition PlayerPlaceBlockEvent.h:39
Definition PlayerPlaceBlockEvent.h:26
Definition PlayerClickEvent.h:11
Definition serialize.h:11