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 index) 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 MCAPI_C int _getAvailableAddCount(
103 ::ContainerEnumName name,
104 ::ItemStack const& itemInSlot
105 ) const;
106
107 MCAPI_C bool
108 _isItemAllowedInSlot(::ContainerEnumName name, int slot, ::ItemStackBase const& item, int amount) const;
109
110 MCAPI void _onItemNetworkChanged(int slot, ::ItemStack const& oldItem, ::ItemStack const& newItem);
111
112 MCAPI_C void _setBackingContainerSlot(int slot, ::ItemStack const& newItem);
113
114 MCAPI_C void addAvailableSetCountCallback(
115 ::ContainerEnumName name,
116 ::std::function<int(int, ::ItemStackBase const&)> availableSetCountCallback
117 );
118
119 MCAPI_C void addItemAllowedInSlotCallback(
120 ::ContainerEnumName name,
121 ::std::function<bool(int, ::ItemStackBase const&, int)> itemAllowedCallback
122 );
123
124 MCAPI_C void addItemAllowedToAddCallback(
125 ::ContainerEnumName name,
126 ::std::function<bool(::ItemStackBase const&)> itemAllowedCallback
127 );
128
129 MCAPI_C void addItemAllowedToRemoveCallback(
130 ::ContainerEnumName name,
131 ::std::function<bool(::ItemStackBase const&)> itemAllowedCallback
132 );
133
134 MCAPI_C void addValidSlotForContainerCallback(
135 ::ContainerEnumName name,
136 ::std::function<bool(int)> validSlotForContainerCallback
137 );
138
139 MCAPI_C ::ItemAddType canAdd(
141 ::FullContainerName const& openContainerNetId,
142 int slot,
143 ::ItemStackBase const& item,
144 int amount
145 ) const;
146
147 MCAPI_C bool canRemove(::ContainerEnumName name, int slot, int amount) const;
148
149 MCAPI_C ::ItemSetType canSet(
151 ::FullContainerName const& name,
152 int slot,
153 ::ItemStackBase const& item,
154 int amount
155 ) const;
156
157 MCAPI_C int getAvailableSetCount(
159 ::FullContainerName const& name,
160 int slot,
161 ::ItemStackBase const& item
162 ) const;
163
164 MCAPI_C bool isValidSlot(::ContainerEnumName name, int slot) const;
165 // NOLINTEND
166
167public:
168 // constructor thunks
169 // NOLINTBEGIN
170 MCAPI_C void* $ctor(
171 ::Container& backingContainer,
172 ::SparseContainerBackingSetType backingSetType,
173 bool isClientSide,
174 bool isItemStackNetManagerEnabled,
175 ::std::unique_ptr<::ISparseContainerSetListener> netManagerSetter,
176 ::std::unique_ptr<::IPlayerContainerSetter> playerSetter
177 );
178 // NOLINTEND
179
180public:
181 // destructor thunk
182 // NOLINTBEGIN
183 MCAPI void $dtor();
184 // NOLINTEND
185
186public:
187 // virtual function thunks
188 // NOLINTBEGIN
189#ifdef LL_PLAT_C
190 MCAPI ::ItemStack const& $getItem(int index) const;
191
192 MCAPI int $getContainerSize() const;
193
194 MCAPI int $getMaxStackSize() const;
195
196 MCFOLD void $containerContentChanged(int slot);
197
198 MCAPI void $setItem(int slot, ::ItemStack const& item);
199
200 MCFOLD void $serverInitItemStackIds(int, int, ::std::function<void(int, ::ItemStack const&)>);
201
202 MCAPI void $startOpen(::Actor& actor);
203
204 MCAPI void $stopOpen(::Actor& actor);
205
206 MCFOLD void $removeItem(int slot, int count);
207#endif
208
209
210 // NOLINTEND
211
212public:
213 // vftables
214 // NOLINTBEGIN
215 MCAPI static void** $vftableForContainerContentChangeListener();
216
217 MCAPI static void** $vftableForContainer();
218 // NOLINTEND
219};
Definition Actor.h:105
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