LeviLamina
Loading...
Searching...
No Matches
FunctionManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/server/commands/CommandOrigin.h"
7#include "mc/server/commands/CurrentCmdVersion.h"
8#include "mc/server/commands/functions/FunctionQueueOrder.h"
9
10// auto generated forward declare list
11// clang-format off
12class CommandRegistry;
13class FunctionEntry;
14class GameRule;
16class IFunctionEntry;
18namespace Core { class Path; }
19namespace Json { class Value; }
20// clang-format on
21
22class FunctionManager {
23public:
24 // FunctionManager inner types declare
25 // clang-format off
26 struct OriginMapping;
27 struct QueuedCommand;
28 struct TickFunction;
29 // clang-format on
30
31 // FunctionManager inner types define
33 public:
34 // member variables
35 // NOLINTBEGIN
36 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandOrigin>> mOrigin;
37 ::ll::TypedStorage<4, 4, uint> mRefCount;
38 // NOLINTEND
39 };
40
42 public:
43 // member variables
44 // NOLINTBEGIN
45 ::ll::TypedStorage<8, 8, ::IFunctionEntry*> mFunction;
46 ::ll::TypedStorage<8, 8, ::gsl::not_null<::CommandOrigin const*>> mOrigin;
47 // NOLINTEND
48 };
49
50 struct TickFunction {
51 public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<8, 8, ::gsl::not_null<::FunctionEntry*>> mFunction;
55 ::ll::TypedStorage<1, 1, ::FunctionQueueOrder> mOrder;
56 // NOLINTEND
57 };
58
59public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<8, 8, ::GameRule const*> mGameRule;
63 ::ll::TypedStorage<1, 1, bool> mIsProcessingStack;
64 ::ll::TypedStorage<8, 8, uint64> mInsertPoint;
65 ::ll::TypedStorage<4, 4, int> mExecutionCount;
66 ::ll::TypedStorage<8, 24, ::std::vector<::FunctionManager::QueuedCommand>> mCommandList;
67 ::ll::TypedStorage<8, 64, ::std::unordered_map<::CommandOrigin const*, ::FunctionManager::OriginMapping>>
68 mOriginMap;
69 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ICommandDispatcher>> mCommandDispatcher;
70 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandOrigin>> mTickOrigin;
71 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::FunctionEntry>>> mFunctions;
72 ::ll::TypedStorage<8, 24, ::std::vector<::FunctionManager::TickFunction>> mTickFunctions;
73 // NOLINTEND
74
75public:
76 // prevent constructor by default
77 FunctionManager();
78
79public:
80 // virtual functions
81 // NOLINTBEGIN
82 virtual ~FunctionManager();
83 // NOLINTEND
84
85public:
86 // member functions
87 // NOLINTBEGIN
88 MCAPI FunctionManager(
89 ::std::unique_ptr<::ICommandDispatcher> commandDispatcher,
90 ::std::unique_ptr<::CommandOrigin> tickOrigin,
91 ::GameRule const* gameRule
92 );
93
94 MCAPI ::CommandOrigin const& _addOriginReference(::CommandOrigin const& origin, uint amount);
95
96 MCAPI void _addTickFunctionsFromJson(::Json::Value const& arrayVal, ::CurrentCmdVersion resourceCommandVersion);
97
98 MCAPI void _loadTickFiles(::ResourcePackManager const& serverPackManager);
99
100 MCAPI int
101 _processCommandStack(::FunctionEntry& toExecute, ::CommandOrigin const& origin, ::FunctionQueueOrder order);
102
103 MCAPI void _processFunctionEntry(
104 ::std::string const& functionName,
105 ::std::vector<::std::string> const& lines,
106 ::std::vector<::std::string>& errorList,
107 ::CurrentCmdVersion commandVersion,
108 ::CommandRegistry const& registry
109 );
110
111 MCAPI void _queueCommandsAfterCaller(
112 ::std::vector<::std::unique_ptr<::IFunctionEntry>> const& toQueue,
113 ::CommandOrigin const& origin
114 );
115
116 MCAPI void _queueCommandsNextToExecute(
117 ::std::vector<::std::unique_ptr<::IFunctionEntry>> const& toQueue,
118 ::CommandOrigin const& origin
119 );
120
121 MCAPI void _removeOriginReference(::CommandOrigin const& origin, uint amount);
122
123 MCAPI int execute(::FunctionEntry& toExecute, ::CommandOrigin const& origin, ::FunctionQueueOrder order);
124
125 MCAPI ::FunctionEntry* getFunction(::std::string const& functionName);
126
127 MCAPI void load(::ResourcePackManager& serverPackManager, ::CommandRegistry& registry);
128
129 MCAPI void tick();
130 // NOLINTEND
131
132public:
133 // static functions
134 // NOLINTBEGIN
135 MCAPI static ::std::string getFunctionNameFromPath(::Core::Path const& filename);
136
137 MCAPI static ::FunctionQueueOrder getQueueOrderForCommandVersion(::CurrentCmdVersion version);
138 // NOLINTEND
139
140public:
141 // constructor thunks
142 // NOLINTBEGIN
143 MCAPI void* $ctor(
144 ::std::unique_ptr<::ICommandDispatcher> commandDispatcher,
145 ::std::unique_ptr<::CommandOrigin> tickOrigin,
146 ::GameRule const* gameRule
147 );
148 // NOLINTEND
149
150public:
151 // destructor thunk
152 // NOLINTBEGIN
153 MCAPI void $dtor();
154 // NOLINTEND
155
156public:
157 // vftables
158 // NOLINTBEGIN
159 MCNAPI static void** $vftable();
160 // NOLINTEND
161};
Definition CommandOrigin.h:32
Definition CommandRegistry.h:51
Definition Path.h:12
Definition FunctionEntry.h:16
static MCAPI void ** $vftable()
Definition GameRule.h:13
Definition ICommandDispatcher.h:11
Definition IFunctionEntry.h:14
Definition Value.h:16
Definition ResourcePackManager.h:35
Definition FunctionManager.h:32
Definition FunctionManager.h:41
Definition FunctionManager.h:50