LeviLamina
Loading...
Searching...
No Matches
IBlockSource.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/game_refs/WeakRef.h"
7#include "mc/deps/vanilla_components/IConstBlockSource.h"
8#include "mc/platform/brstd/function_ref.h"
9#include "mc/world/actor/ActorType.h"
10#include "mc/world/level/BlockChangedEventTarget.h"
11#include "mc/world/level/ShapeType.h"
12
13// auto generated forward declare list
14// clang-format off
15class AABB;
16class Actor;
17class Block;
19class BlockPos;
20class BlockSource;
22class ChunkPos;
23class ChunkSource;
24class Dimension;
25class EntityContext;
26class GameEvent;
27class HitResult;
28class ILevel;
29class ItemStackBase;
30class Level;
31class LevelChunk;
32class LevelSeed64;
33class Vec3;
35struct ClipParameters;
36// clang-format on
37
39public:
40 // IBlockSource inner types define
41 using Listener = ::BlockSourceListener;
42
43 using ListenerVector = ::std::vector<::BlockSourceListener*>;
44
45public:
46 // virtual functions
47 // NOLINTBEGIN
48 virtual ::WeakRef<::BlockSource> getWeakRef() = 0;
49
50 virtual void addListener(::BlockSourceListener& l) = 0;
51
52 virtual void removeListener(::BlockSourceListener& l) = 0;
53
54 virtual ::gsl::span<::gsl::not_null<::Actor*>>
55 fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities) = 0;
56
57 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
58 ::ActorType entityTypeId,
59 ::AABB const& bb,
60 ::Actor const* except,
61 ::std::function<bool(::Actor*)> selector
62 ) = 0;
63
64 virtual bool setBlock(
65 ::BlockPos const& pos,
66 ::Block const& block,
67 int updateFlags,
68 ::ActorBlockSyncMessage const* syncMsg,
69 ::BlockChangeContext const& changeSourceContext
70 ) = 0;
71
72 virtual bool setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags) = 0;
73
74 virtual bool removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext) = 0;
75
76 virtual short getMinHeight() const = 0;
77
78 virtual short getMaxHeight() const = 0;
79
80 virtual ::Dimension& getDimension() const = 0;
81
82 virtual ::Dimension& getDimension() = 0;
83
84 virtual ::Dimension const& getDimensionConst() const = 0;
85
86 virtual ::LevelChunk* getChunkAt(::BlockPos const& pos) const = 0;
87
88 virtual ::LevelChunk* getChunk(int x, int z) const = 0;
89
90 virtual ::LevelChunk* getChunk(::ChunkPos const& pos) const = 0;
91
92 virtual ::Level& getLevel() = 0;
93
94 virtual ::ILevel& getILevel() const = 0;
95
96 virtual ::LevelSeed64 getLevelSeed64() const = 0;
97
98 virtual short getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const = 0;
99
100 virtual short getAboveTopSolidBlock(
101 ::BlockPos const& pos,
102 bool includeWater,
103 bool includeLeaves,
104 bool iteratePastInitialBlocking
105 ) const = 0;
106
107 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, ::BlockPos const& pos) const = 0;
108
109 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, int x, int z) const = 0;
110
111 virtual ::std::vector<::AABB>& fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks) = 0;
112
113 virtual ::std::vector<::AABB>& fetchCollisionShapes(
114 ::AABB const& intersectTestBox,
115 bool withUnloadedChunks,
116 ::std::optional<::EntityContext const> entity,
117 ::std::vector<::AABB>* tempShapes
118 ) = 0;
119
120 virtual ::HitResult clip(
121 ::Vec3 const& A,
122 ::Vec3 const& B,
123 bool checkAgainstLiquid,
124 ::ShapeType shapeType,
125 int maxDistance,
126 bool ignoreBorderBlocks,
127 bool fullOnly,
128 ::Actor* actor,
129 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
130 bool stopOnFirstLiquidHit
131 ) const = 0;
132
133 virtual ::HitResult clip(::ClipParameters const& parameters) const = 0;
134
135 virtual ::ChunkSource& getChunkSource() = 0;
136
137 virtual bool isSolidBlockingBlock(::BlockPos const& p) const = 0;
138
139 virtual bool isSolidBlockingBlock(int x, int y, int z) const = 0;
140
141 virtual bool areChunksFullyLoaded(::BlockPos const& pos, int r) const = 0;
142
143 virtual bool mayPlace(
144 ::Block const& block,
145 ::BlockPos const& pos,
146 uchar face,
147 ::Actor* placer,
148 bool ignoreEntities,
149 ::Vec3 clickPos
150 ) = 0;
151
152 virtual bool canDoBlockDrops() const = 0;
153
154 virtual bool canDoContainedItemDrops() const = 0;
155
156 virtual bool isInstaticking(::BlockPos const& pos) const = 0;
157
158 virtual bool checkBlockDestroyPermissions(
159 ::Actor& entity,
160 ::BlockPos const& pos,
161 ::ItemStackBase const& item,
162 bool generateParticle
163 ) = 0;
164
165 virtual bool checkBlockPermissions(
166 ::Actor& entity,
167 ::BlockPos const& blockPos,
168 uchar face,
169 ::ItemStackBase const& item,
170 bool generateParticle
171 ) = 0;
172
173 virtual void postGameEvent(
174 ::Actor* source,
175 ::GameEvent const& gameEvent,
176 ::BlockPos const& originPos,
177 ::Block const* affectedBlock
178 ) = 0;
179
180 virtual void fireBlockChanged(
181 ::BlockPos const& pos,
182 uint layer,
183 ::Block const& block,
184 ::Block const& oldBlock,
185 int flags,
186 ::BlockChangedEventTarget eventTarget,
187 ::ActorBlockSyncMessage const* syncMsg,
188 ::Actor* source
189 ) = 0;
190
191 virtual void blockEvent(::BlockPos const& pos, int b0, int b1) = 0;
192 // NOLINTEND
193
194public:
195 // virtual function thunks
196 // NOLINTBEGIN
197
198 // NOLINTEND
199};
Definition AABB.h:18
Definition Actor.h:123
Definition BlockChangeContext.h:16
Definition BlockPos.h:21
Definition BlockSourceListener.h:18
Definition BlockSource.h:72
Definition Block.h:69
Definition ChunkPos.h:11
Definition ChunkSource.h:37
Definition Dimension.h:88
Definition EntityContext.h:17
Definition GameEvent.h:9
Definition HitResult.h:19
Definition IBlockSource.h:38
Definition IConstBlockSource.h:23
Definition ILevel.h:218
Definition ItemStackBase.h:52
Definition LevelChunk.h:87
Definition LevelSeed64.h:5
Definition Level.h:254
Definition Vec3.h:10
Definition function_ref.h:60
Definition ActorBlockSyncMessage.h:8
Definition ClipParameters.h:16