LeviLamina
Loading...
Searching...
No Matches
ContainerScreenValidation.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/inventory/network/ContainerScreenContext.h"
8#include "mc/world/inventory/simulation/ContainerScreenRequestActionType.h"
9#include "mc/world/inventory/simulation/ContainerValidationCaller.h"
10#include "mc/world/inventory/simulation/ContainerValidationDebug.h"
11
12// auto generated forward declare list
13// clang-format off
14class Container;
17class ItemStack;
26// clang-format on
27
28class ContainerScreenValidation {
29public:
30 // member variables
31 // NOLINTBEGIN
32 ::ll::TypedStorage<8, 40, ::ContainerScreenContext> mScreenContext;
33 ::ll::TypedStorage<4, 4, ::ContainerValidationCaller> mCaller;
34 ::ll::TypedStorage<8, 64, ::std::unordered_map<::FullContainerName, uint64>> mContainerIndexMap;
35 ::ll::TypedStorage<
36 8,
37 64,
38 ::std::unordered_map<::FullContainerName, ::std::shared_ptr<::ContainerValidationBase const>>>
39 mContainerValidatorMap;
40 ::ll::TypedStorage<8, 64, ::std::unordered_map<::FullContainerName, ::std::shared_ptr<::Container>>>
41 mPredictiveContainers;
42 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContainerScreenValidatorBase>> mContainerScreenValidator;
43 ::ll::TypedStorage<8, 24, ::std::vector<::ContainerValidationLayer>> mValidationStack;
44 ::ll::TypedStorage<4, 12, ::ContainerValidationDebug const> mDebug;
45 // NOLINTEND
46
47public:
48 // prevent constructor by default
49 ContainerScreenValidation();
50
51public:
52 // virtual functions
53 // NOLINTBEGIN
54 virtual ~ContainerScreenValidation() = default;
55
56 virtual ::ContainerValidationResult
57 tryCraft(::std::unique_ptr<::ContainerValidationCraftInputs> craftInputs, uchar const numCrafts);
58
59 virtual ::ContainerValidationCraftResult
60 getCraftResults(::std::unique_ptr<::ContainerValidationCraftInputs> craftInputs, uchar const numCrafts);
61
62 virtual ::ContainerValidationResult tryActivate();
63 // NOLINTEND
64
65public:
66 // member functions
67 // NOLINTBEGIN
68 MCAPI ContainerScreenValidation(
69 ::ContainerScreenContext const& screenContext,
70 ::ContainerValidationCaller caller,
71 ::std::unordered_map<::FullContainerName, ::std::shared_ptr<::Container>> predictiveContainers
72 );
73
74 MCAPI void _commit();
75
76 MCAPI ::ContainerValidationSlotInfo
77 _createContainerValidatorSlotInfo(::ContainerValidationSlotData const& slotData);
78
79 MCAPI bool _dropItems();
80
81 MCAPI bool _propagateContainers();
82
83 MCAPI bool
84 _tryMoveItem(::ContainerValidationSlotInfo& srcValidatorPair, ::ContainerValidationSlotInfo& dstValidatorPair);
85
86 MCAPI ::ItemStack _tryRemoveItem(::ContainerValidationSlotInfo& slotInfo, int amount);
87
88 MCAPI int _trySetItem(
90 ::ItemStack const& stack,
91 bool isWholeStackTransfer,
92 bool allowPartialSuccess,
93 bool isInternalTransfer
94 );
95
96 MCAPI ::ContainerValidationResult _tryTransferSpecial(
97 ::ContainerValidationSlotData const& srcSlotData,
98 int transferAmount,
99 ::ContainerScreenRequestActionType actionType
100 );
101
102#ifdef LL_PLAT_C
103 MCAPI ::std::optional<::ContainerIterationRange>
104 getContainerIterator(::ContainerValidationSlotData const& slotData);
105#endif
106
107 MCAPI ::std::shared_ptr<::SimpleSparseContainer>
108 getOrCreateSparseContainer(::FullContainerName const& containerEnumName);
109
110 MCAPI bool tryCommitActionResults();
111
112 MCAPI ::ContainerValidationResult tryConsume(::ContainerValidationSlotData const& srcSlotData, int transferAmount);
113
114 MCAPI ::ContainerValidationResult
115 tryDrop(::ContainerValidationSlotData const& srcSlotData, int transferAmount, bool dropRandomly);
116
117 MCAPI ::ContainerValidationResult
118 trySwap(::ContainerValidationSlotData const& srcSlotData, ::ContainerValidationSlotData const& dstSlotData);
119
120 MCAPI ::ContainerValidationResult tryTransfer(
121 ::ContainerValidationSlotData const& srcSlotData,
122 ::ContainerValidationSlotData const& dstSlotData,
123 int transferAmount,
124 bool isAllowingPartialTransfer
125 );
126 // NOLINTEND
127
128public:
129 // static functions
130 // NOLINTBEGIN
131 MCAPI static ::std::unique_ptr<::ContainerScreenValidation> makeContainerScreenValidation(
132 ::ContainerScreenContext const& screenContext,
133 ::ContainerValidationCaller caller,
134 ::std::unordered_map<::FullContainerName, ::std::shared_ptr<::Container>> predictiveContainers
135 );
136 // NOLINTEND
137
138public:
139 // constructor thunks
140 // NOLINTBEGIN
141 MCAPI void* $ctor(
142 ::ContainerScreenContext const& screenContext,
143 ::ContainerValidationCaller caller,
144 ::std::unordered_map<::FullContainerName, ::std::shared_ptr<::Container>> predictiveContainers
145 );
146 // NOLINTEND
147
148public:
149 // virtual function thunks
150 // NOLINTBEGIN
151 MCAPI ::ContainerValidationResult
152 $tryCraft(::std::unique_ptr<::ContainerValidationCraftInputs> craftInputs, uchar const numCrafts);
153
154 MCAPI ::ContainerValidationCraftResult
155 $getCraftResults(::std::unique_ptr<::ContainerValidationCraftInputs> craftInputs, uchar const numCrafts);
156
157 MCFOLD ::ContainerValidationResult $tryActivate();
158
159
160 // NOLINTEND
161};
Definition ContainerScreenContext.h:16
Definition ContainerScreenValidatorBase.h:18
Definition ContainerValidationBase.h:12
Definition Container.h:35
Definition ItemStack.h:26
Definition SimpleSparseContainer.h:18
Definition ContainerIterationRange.h:5
Definition ContainerValidationCraftInputs.h:5
Definition ContainerValidationCraftResult.h:14
Definition ContainerValidationLayer.h:15
Definition ContainerValidationResult.h:14
Definition ContainerValidationSlotData.h:8
Definition ContainerValidationSlotInfo.h:14
Definition FullContainerName.h:8