LeviLamina
Loading...
Searching...
No Matches
BlockGraphics.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/renderer/texture/IsotropicFaceData.h"
7#include "mc/world/level/block/BlockRenderLayer.h"
8#include "mc/world/level/block/BlockShape.h"
9#include "mc/world/phys/AABB.h"
10
11// auto generated forward declare list
12// clang-format off
14class Block;
15class BlockPos;
16class BlockSource;
17class Experiments;
18class HashedString;
22class Vec3;
23struct TextureItem;
25namespace BlockGeometry { struct Model; }
26namespace BlockTessellationFallbackUtils { struct TessellationConfigInfo; }
27namespace Json { class Value; }
28// clang-format on
29
30class BlockGraphics {
31public:
32 // BlockGraphics inner types declare
33 // clang-format off
34 struct ConstructorToken;
35 // clang-format on
36
37 // BlockGraphics inner types define
38 struct ConstructorToken {};
39
40 using BlockDataValuesMap = ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>;
41
42 using BlockTessellationInfoMap =
43 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>;
44
45public:
46 // member variables
47 // NOLINTBEGIN
48 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
49 ::ll::TypedStorage<4, 4, ::BlockShape> mBlockShape;
50 ::ll::TypedStorage<4, 4, float> mAmbientOcclusionExponent;
51 ::ll::TypedStorage<1, 1, bool> mFancy;
52 ::ll::TypedStorage<1, 1, bool> mAllowSame;
53 ::ll::TypedStorage<1, 1, ::BlockRenderLayer> mRenderLayer;
54 ::ll::TypedStorage<1, 1, ::IsotropicFaceData> mIsotropicFaceData;
55 ::ll::TypedStorage<8, 40, ::std::optional<::std::string>> mSoundType;
56 ::ll::TypedStorage<4, 24, ::AABB> mVisualShape;
57 ::ll::TypedStorage<8, 24, ::std::vector<::TextureItem>> mTextureItems;
58 ::ll::TypedStorage<8, 8, uint64> mIconTextureIndex;
59 // NOLINTEND
60
61public:
62 // virtual functions
63 // NOLINTBEGIN
64 virtual ~BlockGraphics() = default;
65
66 virtual ::BlockRenderLayer getRenderLayer(::BlockSource& region, ::BlockPos const& pos) const;
67
68 virtual int getColor(int auxData) const;
69
70 virtual int getColor(::BlockSource& region, ::BlockPos const& pos) const;
71
72 virtual bool isSeasonTinted(::BlockSource& region, ::BlockPos const& p) const;
73
74 virtual void onGraphicsModeChanged(bool fancy, bool fancyBubbles);
75
76 virtual int getExtraRenderLayers();
77
78 virtual ::TextureUVCoordinateSet const& getCarriedTexture(uint64 textureSlot, int blockVariant) const;
79
80 virtual void setVisualShape(::AABB const& shape);
81
82 virtual void setVisualShape(::Vec3 const& min, ::Vec3 const& max);
83 // NOLINTEND
84
85public:
86 // member functions
87 // NOLINTBEGIN
88 MCAPI void _logBlockTextureError(::fmt::v11::fstring<char const*> const& error) const;
89
90 MCAPI ::std::string const getDefaultTextureName(uint64 textureSlot) const;
91
92 MCAPI ::TextureUVCoordinateSet const& getTexture(uint64 textureSlot, int blockVariant) const;
93
94 MCAPI ::TextureUVCoordinateSet const& getTexture(::BlockPos const& p, uint64 textureSlot, int blockVariant) const;
95
96 MCAPI bool isFullAndOpaque() const;
97
98 MCAPI ::BlockGraphics& setCarriedTextureItem(
99 ::std::string const& nameUp,
100 ::std::string const& nameDown,
101 ::std::string const& nameNorth,
102 ::std::string const& nameSouth,
103 ::std::string const& nameWest,
104 ::std::string const& nameEast
105 );
106
107 MCAPI void setDefaultCarriedTextures();
108
109 MCAPI ::BlockGraphics& setTextureItem(
110 ::std::string const& nameUp,
111 ::std::string const& nameDown,
112 ::std::string const& nameNorth,
113 ::std::string const& nameSouth,
114 ::std::string const& nameWest,
115 ::std::string const& nameEast
116 );
117 // NOLINTEND
118
119public:
120 // static functions
121 // NOLINTBEGIN
122 MCAPI static void _initBlockModels(::ResourcePackManager& packManager);
123
124 MCAPI static ::BlockGraphics* createBlockGraphics(::HashedString const& name, ::BlockShape defaultBlockShape);
125
126 MCAPI static void extractBlockDataValuesFromFileContents(
127 ::Experiments const& experiments,
128 ::std::vector<::LoadedResourceData> const& contents,
129 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
130 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>&
131 blockTessellationInfoMap
132 );
133
134 MCAPI static ::BlockGraphics const* getForBlock(::Block const& block);
135
136 MCAPI static ::TextureAtlasItem const& getTextureItem(
137 ::std::string const& name,
138 ::std::weak_ptr<::AtlasItemManager> terrainTextureAtlas,
139 ::std::unordered_map<::std::string, ::TextureAtlasItem>& complexTextureItems
140 );
141
142 MCAPI static ::TextureUVCoordinateSet
143 getTextureUVCoordinateSet(::std::string const& name, int blockVariant, int textureVariant);
144
145 MCAPI static void initBlocks(::ResourcePackManager& packManager, ::Experiments const& experiments);
146
147 MCAPI static bool isFullAndOpaque(::Block const& block);
148
149 MCAPI static ::BlockGraphics& registerBlockGraphics(
150 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
151 ::HashedString const& name,
152 ::BlockShape defaultBlockShape
153 );
154
155 MCAPI static void reloadBlockTextures(::ResourcePackManager& packManager, ::Experiments const& experiments);
156
157 MCAPI static void teardownBlocks();
158 // NOLINTEND
159
160public:
161 // static variables
162 // NOLINTBEGIN
163 MCAPI static ::std::unordered_map<::std::string, ::BlockGraphics*>& mBlockLookupMap();
164
165 MCAPI static ::std::mutex& mBlockModelAccess();
166
167 MCAPI static ::std::unordered_map<uint, ::BlockGraphics*>& mBlocks();
168
169 MCAPI static ::std::unique_ptr<::BlockGraphics>& mDummyBlock();
170
171 MCAPI static bool& mInitialized();
172
173 MCAPI static ::std::map<::std::string, ::std::unique_ptr<::BlockGeometry::Model>>& mModels();
174
175 MCAPI static ::std::vector<::std::unique_ptr<::BlockGraphics>>& mOwnedBlocks();
176
177 MCAPI static ::std::weak_ptr<::AtlasItemManager>& mTerrainTextureAtlas();
178
179 MCAPI static ::std::unordered_set<uint>& mVanillaBlocksWithFallbackToOldTessellation();
180
181 MCAPI static ::std::unordered_map<::std::string, ::TextureAtlasItem>& sComplexTextureItems();
182 // NOLINTEND
183
184public:
185 // virtual function thunks
186 // NOLINTBEGIN
187 MCAPI ::BlockRenderLayer $getRenderLayer(::BlockSource& region, ::BlockPos const& pos) const;
188
189 MCFOLD int $getColor(int auxData) const;
190
191 MCFOLD int $getColor(::BlockSource& region, ::BlockPos const& pos) const;
192
193 MCFOLD bool $isSeasonTinted(::BlockSource& region, ::BlockPos const& p) const;
194
195 MCAPI void $onGraphicsModeChanged(bool fancy, bool fancyBubbles);
196
197 MCFOLD int $getExtraRenderLayers();
198
199 MCAPI ::TextureUVCoordinateSet const& $getCarriedTexture(uint64 textureSlot, int blockVariant) const;
200
201 MCAPI void $setVisualShape(::AABB const& shape);
202
203 MCAPI void $setVisualShape(::Vec3 const& min, ::Vec3 const& max);
204 // NOLINTEND
205};
Definition AtlasItemManager.h:5
Definition BlockGraphics.h:5
Definition BlockPos.h:17
Definition BlockSource.h:71
Definition Block.h:41
Definition Experiments.h:14
Definition HashedString.h:5
Definition Value.h:16
Definition LoadedResourceData.h:5
Definition ResourcePackManager.h:36
Definition TextureAtlasItem.h:5
Definition Vec3.h:10
Definition Model.h:7
Definition BlockGraphics.h:13
Definition TessellationConfigInfo.h:7
Definition TextureItem.h:5
Definition TextureUVCoordinateSet.h:5