LeviLamina
Loading...
Searching...
No Matches
SoundMapping.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/sound/EventToSoundListMap.h"
7#include "mc/deps/core/string/HashedString.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
10#include "mc/platform/brstd/flat_map.h"
11#include "mc/util/molang/ExpressionNode.h"
12
13// auto generated forward declare list
14// clang-format off
17class Random;
18struct Sound;
19namespace Json { class Value; }
20// clang-format on
21
22class SoundMapping {
23public:
24 // SoundMapping inner types declare
25 // clang-format off
27 struct EntitySounds;
28 struct EntitySoundList;
29 struct BlockSounds;
31 // clang-format on
32
33 // SoundMapping inner types define
34 struct SoundVariantCompare {
35 public:
36 // SoundVariantCompare inner types define
37 using is_transparent = void;
38 };
39
40 struct EntitySounds {
41 public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 64, ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>> mBaseSounds;
45 ::ll::TypedStorage<
46 8,
47 48,
48 ::brstd::flat_map<
49 ::HashedString,
50 ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>,
51 ::SoundMapping::SoundVariantCompare,
52 ::std::vector<::HashedString>,
53 ::std::vector<::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>>>>
54 mVariantSounds;
55 ::ll::TypedStorage<8, 16, ::ExpressionNode> mVariantKey;
56 // NOLINTEND
57 };
58
59 struct EntitySoundList {
60 public:
61 // member variables
62 // NOLINTBEGIN
63 ::ll::TypedStorage<8, 80, ::EventToSoundListMap> mBaseSounds;
64 ::ll::TypedStorage<
65 8,
66 48,
67 ::brstd::flat_map<
68 ::HashedString,
69 ::EventToSoundListMap,
70 ::SoundMapping::SoundVariantCompare,
71 ::std::vector<::HashedString>,
72 ::std::vector<::EventToSoundListMap>>>
73 mVariantSounds;
74 ::ll::TypedStorage<8, 16, ::ExpressionNode> mVariantKey;
75 // NOLINTEND
76 };
77
78 struct BlockSounds {
79 public:
80 // member variables
81 // NOLINTBEGIN
82 ::ll::TypedStorage<8, 64, ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>> mSounds;
83 ::ll::TypedStorage<8, 32, ::std::string> mBaseBlock;
84 // NOLINTEND
85 };
86
88 public:
89 // member variables
90 // NOLINTBEGIN
91 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::SoundMapping::BlockSounds>> mDefaultBlockSounds;
92 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::SoundMapping::EntitySoundList>>
93 mEntitySoundLists;
94 // NOLINTEND
95 };
96
97 using EventSoundMap = ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>;
98
99 using NamedSoundMap = ::std::unordered_map<::HashedString, ::Sound>;
100
101public:
102 // member variables
103 // NOLINTBEGIN
104 ::ll::TypedStorage<8, 64, ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>> mEventSounds;
105 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::Sound>> mNamedSounds;
106 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::SoundMapping::EntitySounds>> mEntitySounds;
107 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::SoundMapping::BlockSounds>> mBlockSounds;
108 ::ll::TypedStorage<8, 128, ::SoundMapping::ActorInteractiveSounds> mEntityInteractiveSounds;
109 // NOLINTEND
110
111public:
112 // virtual functions
113 // NOLINTBEGIN
114 virtual ~SoundMapping() = default;
115 // NOLINTEND
116
117public:
118 // member functions
119 // NOLINTBEGIN
120 MCAPI ::Sound const& _getBlockSound(
121 ::std::unordered_map<::std::string, ::SoundMapping::BlockSounds> const& blockSounds,
122 ::SharedTypes::Legacy::LevelSoundEvent eventType,
123 ::std::string const& blockType
124 ) const;
125
126 MCAPI void _loadSounds(::Json::Value const& json, ::Bedrock::NonOwnerPointer<::LinkedAssetValidator> validator);
127
128 MCAPI ::Sound const& getEntitySound(
129 ::SharedTypes::Legacy::LevelSoundEvent eventType,
130 ::ActorSoundIdentifier const& actorSoundIdentifier
131 ) const;
132
133 MCAPI ::Sound const& getEventSound(::SharedTypes::Legacy::LevelSoundEvent eventType) const;
134
135 MCAPI ::Sound const& getNamedSound(::HashedString const& name) const;
136
137 MCAPI ::Sound getSound(
138 ::SharedTypes::Legacy::LevelSoundEvent eventType,
139 ::ActorSoundIdentifier const& actorSoundIdentifier,
140 ::std::string const& blockType,
141 ::Random& rand
142 ) const;
143 // NOLINTEND
144
145public:
146 // static functions
147 // NOLINTBEGIN
148 MCAPI static void _loadBlockSounds(
149 ::Json::Value const& root,
150 ::std::unordered_map<::std::string, ::SoundMapping::BlockSounds>& blockSoundList
151 );
152
153 MCAPI static void _loadEntityInteractiveSounds(
154 ::Json::Value const& root,
155 ::std::unordered_map<::std::string, ::SoundMapping::BlockSounds>& blockSounds,
156 ::std::unordered_map<::std::string, ::SoundMapping::EntitySoundList>& entitySoundLists
157 );
158
159 MCAPI static void _loadEventSounds(
160 ::Json::Value const& root,
161 ::std::unordered_map<::SharedTypes::Legacy::LevelSoundEvent, ::Sound>& eventSoundMap,
162 bool allowEmpty
163 );
164 // NOLINTEND
165};
Definition ActorSoundIdentifier.h:17
Definition Value.h:16
Definition LinkedAssetValidator.h:8
Definition Random.h:10
Definition SoundMapping.h:5
Definition SoundMapping.h:25
Definition SoundMapping.h:23
Definition SoundMapping.h:21
Definition SoundMapping.h:19
Definition SoundMapping.h:17
Definition Sound.h:5