Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
ShelfBlock.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/optional_ref.h"
7#include "mc/world/item/HandSlot.h"
8#include "mc/world/level/block/ActorBlockBase.h"
9#include "mc/world/level/block/BlockSupportType.h"
10#include "mc/world/level/block/BlockType.h"
11
12// auto generated forward declare list
13// clang-format off
14class AABB;
15class Block;
16class BlockPos;
17class BlockSource;
18class Experiments;
21class Player;
22class ShelfBlockActor;
23class Vec3;
24namespace BlockEvents { class BlockPlayerInteractEvent; }
25namespace BlockEvents { class BlockQueuedTickEvent; }
26namespace BlockEvents { class BlockRedstoneUpdateEvent; }
27// clang-format on
28
29class ShelfBlock : public ::ActorBlock {
30public:
31 // ShelfBlock inner types define
32 enum class NeighborDirection : uchar {
33 Right = 0,
34 Left = 1,
35 };
36
37 enum class PoweredType : int {
38 Unconnected = 0,
39 Right = 1,
40 Center = 2,
41 Left = 3,
42 Count = 4,
43 };
44
45 enum class SlotState : uchar {
46 Free = 0,
47 Occupied = 1,
48 Invalid = 2,
49 };
50
51 enum class SwapItemResult : int {
52 NoItemsTransferred = 0,
53 SingleItemTransfer = 1,
54 TwoItemsSwapped = 2,
55 };
56
57public:
58 // prevent constructor by default
59 ShelfBlock();
60
61public:
62 // virtual functions
63 // NOLINTBEGIN
64 virtual void movedByPiston(::BlockSource& region, ::BlockPos const& pos) const /*override*/;
65
66 virtual void neighborChanged(::BlockSource& region, ::BlockPos const& pos, ::BlockPos const& neighborPos) const
67 /*override*/;
68
69 virtual bool hasComparatorSignal() const /*override*/;
70
71 virtual int getComparatorSignal(::BlockSource& region, ::BlockPos const& pos, ::Block const& block, uchar dir) const
72 /*override*/;
73
74 virtual ::AABB getCollisionShape(
75 ::Block const& block,
77 ::BlockPos const& pos,
79 ) const /*override*/;
80
81 virtual ::AABB const&
82 getOutline(::Block const& block, ::IConstBlockSource const&, ::BlockPos const& pos, ::AABB& bufferValue) const
83 /*override*/;
84
85 virtual ::AABB const& getVisualShapeInWorld(
86 ::Block const& block,
88 ::BlockPos const& pos,
89 ::AABB& bufferAABB
90 ) const /*override*/;
91
92 virtual bool isInteractiveBlock() const /*override*/;
93
94 virtual void onRemove(::BlockSource& region, ::BlockPos const& pos) const /*override*/;
95
96 virtual bool canProvideSupport(::Block const& block, uchar face, ::BlockSupportType) const /*override*/;
97
98 virtual bool liquidCanFlowIntoFromDirection(
99 uchar flowIntoFacing,
100 ::std::function<::Block const&(::BlockPos const&)> const& getBlock,
101 ::BlockPos const& pos
102 ) const /*override*/;
103
104 virtual void _addHardCodedBlockComponents(::Experiments const&) /*override*/;
105 // NOLINTEND
106
107public:
108 // member functions
109 // NOLINTBEGIN
110 MCNAPI ShelfBlock(::std::string const& nameId, int id);
111
112 MCNAPI ::std::tuple<::ShelfBlockActor*, ::ShelfBlockActor*, ::ShelfBlockActor*>
114 ::BlockSource& region,
115 ::BlockPos const& shelfLeft,
116 ::BlockPos const& shelfRight
117 ) const;
118
119 MCNAPI ::std::tuple<::ShelfBlockActor*, ::ShelfBlockActor*, ::ShelfBlockActor*>
121 ::BlockSource& region,
122 ::BlockPos const& shelfLeft,
123 ::BlockPos const& shelfCenter,
124 ::BlockPos const& shelfRight
125 ) const;
126
128
129 MCNAPI void
130 _setShelfData(::BlockSource& region, ::BlockPos const& pos, bool powered, ::ShelfBlock::PoweredType type) const;
131
132 MCNAPI void tick(::BlockEvents::BlockQueuedTickEvent& eventData) const;
133
134 MCAPI void use(::BlockEvents::BlockPlayerInteractEvent& eventData) const;
135 // NOLINTEND
136
137public:
138 // static functions
139 // NOLINTBEGIN
140 MCNAPI static bool
141 _blockHasPoweredShelfType(::BlockSource const& region, ::BlockPos const& pos, ::ShelfBlock::PoweredType type);
142
143 MCNAPI static ::AABB const& _getShape(::BlockPos const& pos, ::Block const& block, ::AABB& bufferValue);
144
146 ::BlockSource const& region,
147 ::BlockPos const& pos,
148 ::BlockPos const& neighbor
149 );
150
152 ::Player& player,
153 ::BlockPos const& pos,
154 ::BlockSource& region,
155 ::ShelfBlockActor& blockActor,
156 ::Vec3 const& blockHit,
157 uchar hitFace,
158 ::HandSlot handSlot
159 );
160
162
163#ifdef LL_PLAT_C
164 MCNAPI static ::ShelfBlock::SlotState
165 getBlockSlotState(::BlockPos const& blockPos, ::Vec3 const& blockHit, uchar faceHit, ::BlockSource const& region);
166#endif
167 // NOLINTEND
168
169public:
170 // constructor thunks
171 // NOLINTBEGIN
172 MCNAPI void* $ctor(::std::string const& nameId, int id);
173 // NOLINTEND
174
175public:
176 // virtual function thunks
177 // NOLINTBEGIN
178 MCNAPI void $movedByPiston(::BlockSource& region, ::BlockPos const& pos) const;
179
180 MCNAPI void $neighborChanged(::BlockSource& region, ::BlockPos const& pos, ::BlockPos const& neighborPos) const;
181
182 MCNAPI bool $hasComparatorSignal() const;
183
184 MCNAPI int
185 $getComparatorSignal(::BlockSource& region, ::BlockPos const& pos, ::Block const& block, uchar dir) const;
186
187 MCNAPI ::AABB $getCollisionShape(
188 ::Block const& block,
189 ::IConstBlockSource const&,
190 ::BlockPos const& pos,
192 ) const;
193
194 MCNAPI ::AABB const&
195 $getOutline(::Block const& block, ::IConstBlockSource const&, ::BlockPos const& pos, ::AABB& bufferValue) const;
196
197 MCNAPI ::AABB const& $getVisualShapeInWorld(
198 ::Block const& block,
199 ::IConstBlockSource const&,
200 ::BlockPos const& pos,
201 ::AABB& bufferAABB
202 ) const;
203
204 MCNAPI bool $isInteractiveBlock() const;
205
206 MCNAPI void $onRemove(::BlockSource& region, ::BlockPos const& pos) const;
207
208 MCNAPI bool $canProvideSupport(::Block const& block, uchar face, ::BlockSupportType) const;
209
211 uchar flowIntoFacing,
212 ::std::function<::Block const&(::BlockPos const&)> const& getBlock,
213 ::BlockPos const& pos
214 ) const;
215
217
218
219 // NOLINTEND
220
221public:
222 // vftables
223 // NOLINTBEGIN
224 MCNAPI static void** $vftable();
225 // NOLINTEND
226};
Definition AABB.h:18
Definition BlockPlayerInteractEvent.h:18
Definition BlockQueuedTickEvent.h:16
Definition BlockRedstoneUpdateEvent.h:15
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition Block.h:42
Definition Experiments.h:14
Definition GetCollisionShapeInterface.h:13
Definition IConstBlockSource.h:25
Definition Player.h:131
Definition ShelfBlockActor.h:25
MCAPI bool $hasComparatorSignal() const
MCAPI ::std::tuple<::ShelfBlockActor *, ::ShelfBlockActor *, ::ShelfBlockActor * > _getPoweredShelfBlockActorsForDoubleShelf(::BlockSource &region, ::BlockPos const &shelfLeft, ::BlockPos const &shelfRight) const
static MCAPI bool _isMatchingPoweredShelfInMatchingDirection(::BlockSource const &region, ::BlockPos const &pos, ::BlockPos const &neighbor)
MCAPI void _setShelfData(::BlockSource &region, ::BlockPos const &pos, bool powered, ::ShelfBlock::PoweredType type) const
MCAPI void tick(::BlockEvents::BlockQueuedTickEvent &eventData) const
MCAPI::AABB const & $getVisualShapeInWorld(::Block const &block, ::IConstBlockSource const &, ::BlockPos const &pos, ::AABB &bufferAABB) const
static MCAPI bool _blockHasPoweredShelfType(::BlockSource const &region, ::BlockPos const &pos, ::ShelfBlock::PoweredType type)
MCAPI void $neighborChanged(::BlockSource &region, ::BlockPos const &pos, ::BlockPos const &neighborPos) const
MCAPI void * $ctor(::std::string const &nameId, int id)
MCAPI void _onRedstoneUpdate(::BlockEvents::BlockRedstoneUpdateEvent &blockEvent) const
MCAPI void $movedByPiston(::BlockSource &region, ::BlockPos const &pos) const
MCAPI::AABB const & $getOutline(::Block const &block, ::IConstBlockSource const &, ::BlockPos const &pos, ::AABB &bufferValue) const
MCAPI::AABB $getCollisionShape(::Block const &block, ::IConstBlockSource const &, ::BlockPos const &pos, ::optional_ref<::GetCollisionShapeInterface const >) const
static MCAPI void _validatePoweredShelfCurrentStateFromNeighbors(::BlockSource &region, ::BlockPos const &pos)
static MCAPI bool _swapItemsWithUnpoweredShelf(::Player &player, ::BlockPos const &pos, ::BlockSource &region, ::ShelfBlockActor &blockActor, ::Vec3 const &blockHit, uchar hitFace, ::HandSlot handSlot)
MCAPI void $onRemove(::BlockSource &region, ::BlockPos const &pos) const
MCAPI bool $isInteractiveBlock() const
MCAPI int $getComparatorSignal(::BlockSource &region, ::BlockPos const &pos, ::Block const &block, uchar dir) const
static MCAPI ::AABB const & _getShape(::BlockPos const &pos, ::Block const &block, ::AABB &bufferValue)
MCAPI void $_addHardCodedBlockComponents(::Experiments const &)
MCAPI bool $canProvideSupport(::Block const &block, uchar face, ::BlockSupportType) const
static MCAPI void ** $vftable()
MCAPI bool $liquidCanFlowIntoFromDirection(uchar flowIntoFacing, ::std::function<::Block const &(::BlockPos const &)> const &getBlock, ::BlockPos const &pos) const
MCAPI ShelfBlock(::std::string const &nameId, int id)
MCAPI ::std::tuple<::ShelfBlockActor *, ::ShelfBlockActor *, ::ShelfBlockActor * > _getPoweredShelfBlockActorsForTripleShelf(::BlockSource &region, ::BlockPos const &shelfLeft, ::BlockPos const &shelfCenter, ::BlockPos const &shelfRight) const
Definition Vec3.h:10
Definition optional_ref.h:10