LeviLamina
Loading...
Searching...
No Matches
SparseContainer.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/Container.h"
7#include "mc/world/ContainerContentChangeListener.h"
8#include "mc/world/containers/ContainerEnumName.h"
9#include "mc/world/containers/controllers/ItemAddType.h"
10#include "mc/world/containers/controllers/ItemSetType.h"
11#include "mc/world/inventory/simulation/SparseContainerBackingSetType.h"
12
13// auto generated forward declare list
14// clang-format off
15class Actor;
19class ItemStack;
20class ItemStackBase;
22// clang-format on
23
24class SparseContainer : public ::Container, public ::ContainerContentChangeListener {
25public:
26 // SparseContainer inner types define
27 using ItemNetworkChangedCallback = ::std::function<void(int, ::ItemStack const&, ::ItemStack const&)>;
28
29public:
30 // member variables
31 // NOLINTBEGIN
32 ::ll::TypedStorage<4, 4, ::SparseContainerBackingSetType const> mBackingSetType;
33 ::ll::TypedStorage<8, 8, ::Container&> mBackingContainer;
34 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::ItemStack>> mItems;
35 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ISparseContainerSetListener>> mNetManagerSetter;
36 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IPlayerContainerSetter>> mPlayerSetter;
37 ::ll::TypedStorage<
38 8,
39 64,
40 ::std::unordered_map<::ContainerEnumName, ::std::function<void(int, ::ItemStack const&, ::ItemStack const&)>>>
41 mItemNetworkChangedCallbacks;
42 ::ll::TypedStorage<
43 8,
44 64,
45 ::std::unordered_map<::ContainerEnumName, ::std::function<bool(int, ::ItemStackBase const&, int)>>>
46 mItemAllowedInSlotCallbacks;
47 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContainerEnumName, ::std::function<bool(::ItemStackBase const&)>>>
48 mItemAllowedToAddCallbacks;
49 ::ll::TypedStorage<
50 8,
51 64,
52 ::std::unordered_map<::ContainerEnumName, ::std::function<int(int, ::ItemStackBase const&)>>>
53 mAvailableSetCountCallbacks;
54 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContainerEnumName, ::std::function<bool(int)>>>
55 mValidSlotForContainerCallbacks;
56 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContainerEnumName, ::std::function<bool(::ItemStackBase const&)>>>
57 mItemAllowedToRemoveCallbacks;
58 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContainerEnumName, ::std::function<bool(::ItemStackBase const&)>>>
59 mItemAllowedInContainerCallbacks;
60 ::ll::TypedStorage<1, 1, bool const> mIsClientSide;
61 ::ll::TypedStorage<1, 1, bool const> mIsItemStackNetManagerEnabled;
62 // NOLINTEND
63
64public:
65 // prevent constructor by default
66 SparseContainer& operator=(SparseContainer const&);
67 SparseContainer(SparseContainer const&);
68 SparseContainer();
69
70public:
71 // virtual functions
72 // NOLINTBEGIN
73#ifdef LL_PLAT_S
74 virtual ~SparseContainer() /*override*/ = default;
75#else // LL_PLAT_C
76 virtual ~SparseContainer() /*override*/;
77#endif
78
79 virtual ::ItemStack const& getItem(int slot) const /*override*/;
80
81 virtual int getContainerSize() const /*override*/;
82
83 virtual int getMaxStackSize() const /*override*/;
84
85 virtual void containerContentChanged(int slot) /*override*/;
86
87 virtual void setItem(int slot, ::ItemStack const& item) /*override*/;
88
89 virtual void serverInitItemStackIds(int, int, ::std::function<void(int, ::ItemStack const&)>) /*override*/;
90
91 virtual void startOpen(::Actor& actor) /*override*/;
92
93 virtual void stopOpen(::Actor& actor) /*override*/;
94
95 virtual void removeItem(int slot, int count) /*override*/;
96 // NOLINTEND
97
98public:
99 // member functions
100 // NOLINTBEGIN
101#ifdef LL_PLAT_C
102 MCAPI SparseContainer(
103 ::Container& backingContainer,
104 ::SparseContainerBackingSetType backingSetType,
105 bool isClientSide,
106 bool isItemStackNetManagerEnabled,
107 ::std::unique_ptr<::ISparseContainerSetListener> netManagerSetter,
108 ::std::unique_ptr<::IPlayerContainerSetter> playerSetter
109 );
110
111 MCAPI int _getAvailableAddCount(
113 ::ContainerEnumName name,
114 ::ItemStack const& itemInSlot
115 ) const;
116
117 MCAPI bool _isItemAllowedInSlot(::ContainerEnumName name, int slot, ::ItemStackBase const& item, int amount) const;
118#endif
119
120 MCAPI void _onItemNetworkChanged(int slot, ::ItemStack const& oldItem, ::ItemStack const& newItem);
121
122#ifdef LL_PLAT_C
123 MCAPI void _setBackingContainerSlot(int slot, ::ItemStack const& newItem);
124
125 MCAPI void addAvailableSetCountCallback(
126 ::ContainerEnumName name,
127 ::std::function<int(int, ::ItemStackBase const&)> availableSetCountCallback
128 );
129
130 MCAPI void addItemAllowedInSlotCallback(
131 ::ContainerEnumName name,
132 ::std::function<bool(int, ::ItemStackBase const&, int)> itemAllowedCallback
133 );
134
135 MCAPI void addItemAllowedToAddCallback(
136 ::ContainerEnumName name,
137 ::std::function<bool(::ItemStackBase const&)> itemAllowedCallback
138 );
139
140 MCAPI void addItemAllowedToRemoveCallback(
141 ::ContainerEnumName name,
142 ::std::function<bool(::ItemStackBase const&)> itemAllowedCallback
143 );
144
145 MCAPI void addValidSlotForContainerCallback(
146 ::ContainerEnumName name,
147 ::std::function<bool(int)> validSlotForContainerCallback
148 );
149
150 MCAPI ::ItemAddType canAdd(
152 ::FullContainerName const& openContainerNetId,
153 int slot,
154 ::ItemStackBase const& item,
155 int amount
156 ) const;
157
158 MCAPI bool canRemove(::ContainerEnumName name, int slot, int amount) const;
159
160 MCAPI ::ItemSetType canSet(
162 ::FullContainerName const& name,
163 int slot,
164 ::ItemStackBase const& item,
165 int amount
166 ) const;
167
168 MCAPI int getAvailableSetCount(
170 ::FullContainerName const& name,
171 int slot,
172 ::ItemStackBase const& item
173 ) const;
174
175 MCAPI bool isValidSlot(::ContainerEnumName name, int slot) const;
176#endif
177 // NOLINTEND
178
179public:
180 // constructor thunks
181 // NOLINTBEGIN
182#ifdef LL_PLAT_C
183 MCAPI void* $ctor(
184 ::Container& backingContainer,
185 ::SparseContainerBackingSetType backingSetType,
186 bool isClientSide,
187 bool isItemStackNetManagerEnabled,
188 ::std::unique_ptr<::ISparseContainerSetListener> netManagerSetter,
189 ::std::unique_ptr<::IPlayerContainerSetter> playerSetter
190 );
191#endif
192 // NOLINTEND
193
194public:
195 // destructor thunk
196 // NOLINTBEGIN
197 MCAPI void $dtor();
198 // NOLINTEND
199
200public:
201 // virtual function thunks
202 // NOLINTBEGIN
203#ifdef LL_PLAT_C
204 MCAPI ::ItemStack const& $getItem(int slot) const;
205
206 MCAPI int $getContainerSize() const;
207
208 MCAPI int $getMaxStackSize() const;
209
210 MCFOLD void $containerContentChanged(int slot);
211
212 MCAPI void $setItem(int slot, ::ItemStack const& item);
213
214 MCFOLD void $serverInitItemStackIds(int, int, ::std::function<void(int, ::ItemStack const&)>);
215
216 MCAPI void $startOpen(::Actor& actor);
217
218 MCAPI void $stopOpen(::Actor& actor);
219
220 MCFOLD void $removeItem(int slot, int count);
221#endif
222
223
224 // NOLINTEND
225
226public:
227 // vftables
228 // NOLINTBEGIN
229 MCAPI static void** $vftableForContainerContentChangeListener();
230
231 MCAPI static void** $vftableForContainer();
232 // NOLINTEND
233};
Definition Actor.h:106
Definition ContainerContentChangeListener.h:5
Definition ContainerScreenContext.h:17
Definition IPlayerContainerSetter.h:10
Definition ISparseContainerSetListener.h:11
Definition ItemStackBase.h:44
Definition ItemStack.h:26
Definition FullContainerName.h:8
Definition context.h:5