LeviLamina
Loading...
Searching...
No Matches
ContainerRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/containers/FullContainerName.h"
7#include "mc/world/containers/IContainerRegistryAccess.h"
8#include "mc/world/containers/IContainerRegistryTracker.h"
9#include "mc/world/containers/IDynamicContainerSerialization.h"
10
11// auto generated forward declare list
12// clang-format off
15class ItemStack;
16class ListTag;
17class Packet;
18class SaveContext;
23namespace Bedrock::Threading { class SharedRecursiveMutex; }
24// clang-format on
25
26class ContainerRegistry : public ::IDynamicContainerSerialization,
29public:
30 // member variables
31 // NOLINTBEGIN
32 ::ll::TypedStorage<4, 4, uint> mNextDynamicId;
33 ::ll::TypedStorage<8, 64, ::std::unordered_map<::FullContainerName, ::DynamicTrackedContainer>> mContainers;
34 ::ll::TypedStorage<1, 1, bool const> mIsClientSide;
35 ::ll::TypedStorage<4, 4, int> mTicksSinceLastCleanup;
36 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Bedrock::Threading::SharedRecursiveMutex>> mContainerContextMutex;
37 // NOLINTEND
38
39public:
40 // prevent constructor by default
41 ContainerRegistry();
42
43public:
44 // virtual functions
45 // NOLINTBEGIN
46 virtual ~ContainerRegistry() /*override*/;
47
48 virtual ::std::unique_ptr<::ListTag>
49 serializeContainerContent(::FullContainerName const& name, ::SaveContext const& saveContext) /*override*/;
50
51 virtual ::std::optional<int> getDynamicContainerWeight(::FullContainerName const& name) /*override*/;
52
53 virtual bool hasContainer(::FullContainerName const& name) const /*override*/;
54
55 virtual ::std::shared_ptr<::StorageItemContainerModel> getModel(::FullContainerName const& name) /*override*/;
56
57 virtual ::std::shared_ptr<::FillingContainer> getBackingContainer(::FullContainerName const& name) /*override*/;
58
59 virtual void tryCreateEntry(
60 ::StorageItemComponent* storageItemComponent,
61 ::StorageWeightLimitItemComponent* storageWeightLimitItemComponent,
62 ::FullContainerName const& name
63 ) /*override*/;
64
65 virtual ::std::unique_ptr<::DynamicContainerManager> createContainerManager(
66 ::FullContainerName const& id,
67 ::ItemStack const& storageItem,
68 ::StorageItemComponent* storageItemComponent,
69 ::StorageWeightLimitItemComponent* storageWeightLimitItemComponent
70 ) /*override*/;
71
72 virtual uint generateNewID() /*override*/;
73
74 virtual void tryLoadSavedStorageItem(::ListTag const& contentData, ::FullContainerName const& name) /*override*/;
75
76 virtual void setExpired(::std::vector<::FullContainerName> const& removedContainers) /*override*/;
77
78 virtual uint64 getSize() /*override*/;
79 // NOLINTEND
80
81public:
82 // member functions
83 // NOLINTBEGIN
84 MCAPI explicit ContainerRegistry(bool isClientSide);
85
86 MCAPI ::DynamicTrackedContainer& _getOrCreate(
87 ::FullContainerName const& id,
88 ::StorageItemComponent* storageItemComponent,
89 ::StorageWeightLimitItemComponent* storageWeightLimitItemComponent
90 );
91
92 MCAPI void _serverCleanUp(::std::function<void(::Packet&)> broadcastPacketFunction);
93
94 MCAPI int _tick(::std::function<void(::Packet&)> broadcastPacketFunction, int ticksSinceLastCleanup);
95
96 MCAPI void tick(::std::function<void(::Packet&)> broadcastPacketFunction);
97 // NOLINTEND
98
99public:
100 // static functions
101 // NOLINTBEGIN
102 MCAPI static void sendCleanupPackets(
103 ::std::function<void(::Packet&)> const& broadcastPacketFunction,
104 ::std::vector<::FullContainerName> const& removedContainers
105 );
106 // NOLINTEND
107
108public:
109 // constructor thunks
110 // NOLINTBEGIN
111 MCAPI void* $ctor(bool isClientSide);
112 // NOLINTEND
113
114public:
115 // destructor thunk
116 // NOLINTBEGIN
117 MCAPI void $dtor();
118 // NOLINTEND
119
120public:
121 // virtual function thunks
122 // NOLINTBEGIN
123 MCAPI ::std::unique_ptr<::ListTag>
124 $serializeContainerContent(::FullContainerName const& name, ::SaveContext const& saveContext);
125
126 MCAPI ::std::optional<int> $getDynamicContainerWeight(::FullContainerName const& name);
127
128 MCAPI bool $hasContainer(::FullContainerName const& name) const;
129
130 MCAPI ::std::shared_ptr<::StorageItemContainerModel> $getModel(::FullContainerName const& name);
131
132 MCAPI ::std::shared_ptr<::FillingContainer> $getBackingContainer(::FullContainerName const& name);
133
134 MCAPI void $tryCreateEntry(
135 ::StorageItemComponent* storageItemComponent,
136 ::StorageWeightLimitItemComponent* storageWeightLimitItemComponent,
137 ::FullContainerName const& name
138 );
139
140 MCAPI ::std::unique_ptr<::DynamicContainerManager> $createContainerManager(
141 ::FullContainerName const& id,
142 ::ItemStack const& storageItem,
143 ::StorageItemComponent* storageItemComponent,
144 ::StorageWeightLimitItemComponent* storageWeightLimitItemComponent
145 );
146
147 MCAPI uint $generateNewID();
148
149 MCAPI void $tryLoadSavedStorageItem(::ListTag const& contentData, ::FullContainerName const& name);
150
151 MCAPI void $setExpired(::std::vector<::FullContainerName> const& removedContainers);
152
153 MCFOLD uint64 $getSize();
154
155
156 // NOLINTEND
157
158public:
159 // vftables
160 // NOLINTBEGIN
161 MCAPI static void** $vftableForIDynamicContainerSerialization();
162
163 MCAPI static void** $vftableForIContainerRegistryTracker();
164
165 MCAPI static void** $vftableForIContainerRegistryAccess();
166 // NOLINTEND
167};
Definition SharedRecursiveMutex.h:11
Definition DynamicContainerManager.h:18
Definition FillingContainer.h:18
Definition IContainerRegistryAccess.h:14
Definition IContainerRegistryTracker.h:15
Definition IDynamicContainerSerialization.h:12
Definition ItemStack.h:35
Definition ListTag.h:21
Definition Packet.h:30
Definition SaveContext.h:5
Definition StorageItemComponent.h:31
Definition StorageItemContainerModel.h:18
Definition StorageWeightLimitItemComponent.h:17
Definition DynamicTrackedContainer.h:11
Definition FullContainerName.h:8