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/level/block/ActorBlockBase.h"
8#include "mc/world/level/block/BlockSupportType.h"
9#include "mc/world/level/block/BlockType.h"
10
11// auto generated forward declare list
12// clang-format off
13class AABB;
14class Block;
15class BlockPos;
16class BlockSource;
17class Experiments;
20class Player;
21class ShelfBlockActor;
22class Vec3;
23namespace BlockEvents { class BlockPlaceEvent; }
24namespace BlockEvents { class BlockPlayerInteractEvent; }
25namespace BlockEvents { class BlockQueuedTickEvent; }
26// clang-format on
27
28class ShelfBlock : public ::ActorBlock {
29public:
30 // ShelfBlock inner types define
31 enum class SlotState : uchar {
32 Free = 0,
33 Occupied = 1,
34 Invalid = 2,
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 NeighborDirection : uchar {
46 Right = 0,
47 Left = 1,
48 };
49
50 enum class SwapItemResult : int {
51 NoItemsTransferred = 0,
52 SingleItemTransfer = 1,
53 TwoItemsSwapped = 2,
54 };
55
56public:
57 // virtual functions
58 // NOLINTBEGIN
59 // vIndex: 64
60 virtual void movedByPiston(::BlockSource& region, ::BlockPos const& pos) const /*override*/;
61
62 // vIndex: 87
63 virtual void neighborChanged(::BlockSource& region, ::BlockPos const& pos, ::BlockPos const& neighborPos) const
64 /*override*/;
65
66 // vIndex: 67
67 virtual void setupRedstoneComponent(::BlockSource& region, ::BlockPos const& pos) const /*override*/;
68
69 // vIndex: 61
70 virtual void onRedstoneUpdate(::BlockSource& region, ::BlockPos const& pos, int strength, bool isFirstTime) const
71 /*override*/;
72
73 // vIndex: 105
74 virtual bool hasComparatorSignal() const /*override*/;
75
76 // vIndex: 106
77 virtual int getComparatorSignal(::BlockSource& region, ::BlockPos const& pos, ::Block const& block, uchar dir) const
78 /*override*/;
79
80 // vIndex: 5
81 virtual ::AABB getCollisionShape(
82 ::Block const& block,
84 ::BlockPos const& pos,
86 ) const /*override*/;
87
88 // vIndex: 9
89 virtual ::AABB const&
90 getOutline(::Block const& block, ::IConstBlockSource const&, ::BlockPos const& pos, ::AABB& bufferValue) const
91 /*override*/;
92
93 // vIndex: 10
94 virtual ::AABB const& getVisualShapeInWorld(
95 ::Block const& block,
97 ::BlockPos const& pos,
98 ::AABB& bufferAABB
99 ) const /*override*/;
100
101 // vIndex: 136
102 virtual bool isInteractiveBlock() const /*override*/;
103
104 // vIndex: 132
105 virtual void onRemove(::BlockSource& region, ::BlockPos const& pos) const /*override*/;
106
107 // vIndex: 22
108 virtual bool canProvideSupport(::Block const&, uchar, ::BlockSupportType) const /*override*/;
109
110 // vIndex: 18
111 virtual bool liquidCanFlowIntoFromDirection(
112 uchar flowIntoFacing,
113 ::std::function<::Block const&(::BlockPos const&)> const& getBlock,
114 ::BlockPos const& pos
115 ) const /*override*/;
116
117 // vIndex: 131
118 virtual void _addHardCodedBlockComponents(::Experiments const&) /*override*/;
119
120 // vIndex: 0
121 virtual ~ShelfBlock() /*override*/ = default;
122 // NOLINTEND
123
124public:
125 // member functions
126 // NOLINTBEGIN
127 MCAPI bool
128 _blockHasPoweredShelfType(::BlockSource const& region, ::BlockPos const& pos, ::ShelfBlock::PoweredType type) const;
129
130 MCAPI ::std::tuple<::ShelfBlockActor*, ::ShelfBlockActor*, ::ShelfBlockActor*>
131 _getPoweredShelfBlockActors(::BlockPos const& pos, ::BlockSource& region) const;
132
133 MCAPI ::std::tuple<::ShelfBlockActor*, ::ShelfBlockActor*, ::ShelfBlockActor*>
134 _getPoweredShelfBlockActorsForDoubleShelf(
135 ::BlockSource& region,
136 ::BlockPos const& shelfLeft,
137 ::BlockPos const& shelfRight
138 ) const;
139
140 MCAPI ::std::tuple<::ShelfBlockActor*, ::ShelfBlockActor*, ::ShelfBlockActor*>
141 _getPoweredShelfBlockActorsForTripleShelf(
142 ::BlockSource& region,
143 ::BlockPos const& shelfLeft,
144 ::BlockPos const& shelfCenter,
145 ::BlockPos const& shelfRight
146 ) const;
147
148 MCAPI bool _isMatchingPoweredShelfInMatchingDirection(
149 ::BlockSource const& region,
150 ::BlockPos const& pos,
151 ::BlockPos const& neighbor
152 ) const;
153
154 MCAPI void _powerOnAndTryConnectNeighbors(::BlockSource& region, ::BlockPos const& pos) const;
155
156 MCAPI void
157 _setShelfData(::BlockSource& region, ::BlockPos const& pos, bool powered, ::ShelfBlock::PoweredType type) const;
158
159 MCAPI ::ShelfBlock::SwapItemResult
160 _swapItem(::ShelfBlockActor& shelfActor, int hitSlot, ::Player& player, ::BlockSource const& region) const;
161
162 MCAPI ::ShelfBlock::SwapItemResult _swapItem(
163 ::ShelfBlockActor& shelfActor,
164 int shelfSlot,
165 ::Player& player,
166 int inventorySlot,
167 ::BlockSource const& region
168 ) const;
169
170 MCAPI bool _swapItemsWithPoweredShelf(::Player& player, ::BlockPos const& pos, ::BlockSource& region) const;
171
172 MCAPI bool _swapItemsWithUnpoweredShelf(
173 ::Player& player,
174 ::BlockPos const& pos,
175 ::BlockSource& region,
176 ::ShelfBlockActor& blockActor,
177 ::Vec3 const& blockHit,
178 uchar hitFace
179 ) const;
180
181 MCAPI void _unpowerAndDisconnectFromNeighbors(::BlockSource& region, ::BlockPos const& pos) const;
182
183 MCAPI void _updatePoweredShelf(::BlockSource& region, ::BlockPos const& pos, bool isPowered) const;
184
185 MCAPI void _validatePoweredShelfCurrentStateFromNeighbors(::BlockSource& region, ::BlockPos const& pos) const;
186
187 MCFOLD void onPlace(::BlockEvents::BlockPlaceEvent& eventData) const;
188
189 MCAPI void tick(::BlockEvents::BlockQueuedTickEvent& eventData) const;
190
191 MCAPI void use(::BlockEvents::BlockPlayerInteractEvent& eventData) const;
192 // NOLINTEND
193
194public:
195 // static functions
196 // NOLINTBEGIN
197 MCAPI static ::AABB const& _getShape(::BlockPos const& pos, ::Block const& block, ::AABB& bufferValue);
198 // NOLINTEND
199
200public:
201 // virtual function thunks
202 // NOLINTBEGIN
203 MCFOLD void $movedByPiston(::BlockSource& region, ::BlockPos const& pos) const;
204
205 MCAPI void $neighborChanged(::BlockSource& region, ::BlockPos const& pos, ::BlockPos const& neighborPos) const;
206
207 MCFOLD void $setupRedstoneComponent(::BlockSource& region, ::BlockPos const& pos) const;
208
209 MCAPI void $onRedstoneUpdate(::BlockSource& region, ::BlockPos const& pos, int strength, bool isFirstTime) const;
210
211 MCFOLD bool $hasComparatorSignal() const;
212
213 MCAPI int $getComparatorSignal(::BlockSource& region, ::BlockPos const& pos, ::Block const& block, uchar dir) const;
214
215 MCAPI ::AABB $getCollisionShape(
216 ::Block const& block,
217 ::IConstBlockSource const&,
218 ::BlockPos const& pos,
220 ) const;
221
222 MCFOLD ::AABB const&
223 $getOutline(::Block const& block, ::IConstBlockSource const&, ::BlockPos const& pos, ::AABB& bufferValue) const;
224
225 MCFOLD ::AABB const& $getVisualShapeInWorld(
226 ::Block const& block,
227 ::IConstBlockSource const&,
228 ::BlockPos const& pos,
229 ::AABB& bufferAABB
230 ) const;
231
232 MCFOLD bool $isInteractiveBlock() const;
233
234 MCAPI void $onRemove(::BlockSource& region, ::BlockPos const& pos) const;
235
236 MCAPI bool $liquidCanFlowIntoFromDirection(
237 uchar flowIntoFacing,
238 ::std::function<::Block const&(::BlockPos const&)> const& getBlock,
239 ::BlockPos const& pos
240 ) const;
241
242 MCAPI void $_addHardCodedBlockComponents(::Experiments const&);
243 // NOLINTEND
244
245public:
246 // vftables
247 // NOLINTBEGIN
248 MCNAPI static void** $vftable();
249 // NOLINTEND
250};
Definition AABB.h:18
Definition ActorBlockBase.h:6
Definition BlockPlaceEvent.h:16
Definition BlockPlayerInteractEvent.h:17
Definition BlockQueuedTickEvent.h:16
Definition BlockPos.h:17
Definition BlockSource.h:66
Definition Block.h:37
Definition Experiments.h:14
Definition GetCollisionShapeInterface.h:13
Definition IConstBlockSource.h:24
Definition Player.h:123
Definition ShelfBlockActor.h:25
Definition ShelfBlock.h:28
static MCAPI void ** $vftable()
Definition Vec3.h:10
Definition optional_ref.h:10