Skip to content
LeviMC
English
AutoLightDark
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 MCNAPI void _logBlockTextureError(::fmt::v11::fstring<char const*> const& error) const;
89
90 MCNAPI ::std::string const getDefaultTextureName(uint64 textureSlot) const;
91
92 MCNAPI ::BlockRenderLayer getRenderLayer() const;
93
94 MCAPI ::TextureUVCoordinateSet const& getTexture(uint64 textureSlot, int blockVariant) const;
95
96 MCAPI ::TextureUVCoordinateSet const& getTexture(::BlockPos const& p, uint64 textureSlot, int blockVariant) const;
97
98 MCNAPI bool isFullAndOpaque() const;
99
100 MCAPI ::BlockGraphics& setCarriedTextureItem(
101 ::std::string const& nameUp,
102 ::std::string const& nameDown,
103 ::std::string const& nameNorth,
104 ::std::string const& nameSouth,
105 ::std::string const& nameWest,
106 ::std::string const& nameEast
107 );
108
110
111 MCAPI ::BlockGraphics& setTextureItem(
112 ::std::string const& nameUp,
113 ::std::string const& nameDown,
114 ::std::string const& nameNorth,
115 ::std::string const& nameSouth,
116 ::std::string const& nameWest,
117 ::std::string const& nameEast
118 );
119 // NOLINTEND
120
121public:
122 // static functions
123 // NOLINTBEGIN
124 MCNAPI static void _initBlockModels(::ResourcePackManager& packManager);
125
126 MCNAPI static ::BlockGraphics* createBlockGraphics(::HashedString const& name, ::BlockShape defaultBlockShape);
127
129 ::Experiments const& experiments,
130 ::std::vector<::LoadedResourceData> const& contents,
131 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
132 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>&
133 blockTessellationInfoMap
134 );
135
136 MCAPI static ::BlockGraphics const* getForBlock(::Block const& block);
137
138 MCNAPI static ::TextureAtlasItem const& getTextureItem(
139 ::std::string const& name,
140 ::std::weak_ptr<::AtlasItemManager> terrainTextureAtlas,
141 ::std::unordered_map<::std::string, ::TextureAtlasItem>& complexTextureItems
142 );
143
144 MCAPI static ::TextureUVCoordinateSet
145 getTextureUVCoordinateSet(::std::string const& name, int blockVariant, int textureVariant);
146
147 MCAPI static void initBlocks(::ResourcePackManager& packManager, ::Experiments const& experiments);
148
149 MCAPI static bool isFullAndOpaque(::Block const& block);
150
151 MCAPI static ::BlockGraphics& registerBlockGraphics(
152 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
153 ::HashedString const& name,
154 ::BlockShape defaultBlockShape
155 );
156
157 MCAPI static void reloadBlockTextures(::ResourcePackManager& packManager, ::Experiments const& experiments);
158
159 MCNAPI static void teardownBlocks();
160 // NOLINTEND
161
162public:
163 // static variables
164 // NOLINTBEGIN
165 MCNAPI static ::std::unordered_map<::std::string, ::BlockGraphics*>& mBlockLookupMap();
166
167 MCNAPI static ::std::mutex& mBlockModelAccess();
168
169 MCNAPI static ::std::unordered_map<uint, ::BlockGraphics*>& mBlocks();
170
171 MCAPI static ::std::unique_ptr<::BlockGraphics>& mDummyBlock();
172
173 MCNAPI static bool& mInitialized();
174
175 MCNAPI static ::std::map<::std::string, ::std::unique_ptr<::BlockGeometry::Model>>& mModels();
176
177 MCNAPI static ::std::vector<::std::unique_ptr<::BlockGraphics>>& mOwnedBlocks();
178
179 MCNAPI static ::std::weak_ptr<::AtlasItemManager>& mTerrainTextureAtlas();
180
181 MCNAPI static ::std::unordered_set<uint>& mVanillaBlocksWithFallbackToOldTessellation();
182
183 MCNAPI static ::std::unordered_map<::std::string, ::TextureAtlasItem>& sComplexTextureItems();
184 // NOLINTEND
185
186public:
187 // virtual function thunks
188 // NOLINTBEGIN
189 MCNAPI ::BlockRenderLayer $getRenderLayer(::BlockSource& region, ::BlockPos const& pos) const;
190
191 MCNAPI int $getColor(int auxData) const;
192
193 MCNAPI int $getColor(::BlockSource& region, ::BlockPos const& pos) const;
194
195 MCNAPI bool $isSeasonTinted(::BlockSource& region, ::BlockPos const& p) const;
196
197 MCNAPI void $onGraphicsModeChanged(bool fancy, bool fancyBubbles);
198
200
201 MCNAPI ::TextureUVCoordinateSet const& $getCarriedTexture(uint64 textureSlot, int blockVariant) const;
202
203 MCNAPI void $setVisualShape(::AABB const& shape);
204
205 MCNAPI void $setVisualShape(::Vec3 const& min, ::Vec3 const& max);
206 // NOLINTEND
207};
Definition AABB.h:18
Definition AtlasItemManager.h:5
Definition BlockGraphics.h:5
MCAPI void setDefaultCarriedTextures()
static MCAPI ::std::mutex & mBlockModelAccess()
MCAPI::BlockRenderLayer getRenderLayer() const
MCAPI void _logBlockTextureError(::fmt::v11::fstring< char const * > const &error) const
MCAPI::BlockRenderLayer $getRenderLayer(::BlockSource &region, ::BlockPos const &pos) const
MCAPI::TextureUVCoordinateSet const & $getCarriedTexture(uint64 textureSlot, int blockVariant) const
MCAPI::std::string const getDefaultTextureName(uint64 textureSlot) const
static MCAPI void teardownBlocks()
MCAPI void $onGraphicsModeChanged(bool fancy, bool fancyBubbles)
static MCAPI ::std::unordered_map<::std::string, ::TextureAtlasItem > & sComplexTextureItems()
static MCAPI ::TextureAtlasItem const & getTextureItem(::std::string const &name, ::std::weak_ptr<::AtlasItemManager > terrainTextureAtlas, ::std::unordered_map<::std::string, ::TextureAtlasItem > &complexTextureItems)
MCAPI void $setVisualShape(::Vec3 const &min, ::Vec3 const &max)
MCAPI int $getColor(::BlockSource &region, ::BlockPos const &pos) const
MCAPI int $getExtraRenderLayers()
static MCAPI ::std::weak_ptr<::AtlasItemManager > & mTerrainTextureAtlas()
MCAPI void $setVisualShape(::AABB const &shape)
static MCAPI ::std::vector<::std::unique_ptr<::BlockGraphics > > & mOwnedBlocks()
static MCAPI ::std::unordered_map< uint, ::BlockGraphics * > & mBlocks()
static MCAPI ::BlockGraphics * createBlockGraphics(::HashedString const &name, ::BlockShape defaultBlockShape)
static MCAPI ::std::unordered_set< uint > & mVanillaBlocksWithFallbackToOldTessellation()
MCAPI int $getColor(int auxData) const
static MCAPI ::std::unordered_map<::std::string, ::BlockGraphics * > & mBlockLookupMap()
MCAPI bool isFullAndOpaque() const
static MCAPI bool & mInitialized()
static MCAPI ::std::map<::std::string, ::std::unique_ptr<::BlockGeometry::Model > > & mModels()
static MCAPI void _initBlockModels(::ResourcePackManager &packManager)
MCAPI bool $isSeasonTinted(::BlockSource &region, ::BlockPos const &p) const
static MCAPI void extractBlockDataValuesFromFileContents(::Experiments const &experiments, ::std::vector<::LoadedResourceData > const &contents, ::std::unordered_map<::HashedString, ::std::vector<::Json::Value > > &blockDataValuesMap, ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo > &blockTessellationInfoMap)
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition Block.h:42
Definition Experiments.h:14
Definition HashedString.h:5
Definition Value.h:16
Definition LoadedResourceData.h:5
Definition ResourcePackManager.h:29
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