LeviLamina
Loading...
Searching...
No Matches
MinecraftCommands.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/server/commands/CommandOutputType.h"
8#include "mc/server/commands/CommandPermissionLevel.h"
9#include "mc/server/commands/CurrentCmdVersion.h"
10
11// auto generated forward declare list
12// clang-format off
14class ActorFactory;
15class BaseGameVersion;
16class CameraPresets;
17class Command;
18class CommandContext;
19class CommandOrigin;
20class CommandOutput;
22class CommandRegistry;
25class Experiments;
27class ItemRegistryRef;
28class Level;
29class Packet;
30class Recipes;
31struct MCRESULT;
33namespace br::worldgen { class StructureRegistry; }
34// clang-format on
35
36class MinecraftCommands {
37public:
38 // member variables
39 // NOLINTBEGIN
40 ::ll::TypedStorage<8, 8, ::ICommandsContextProvider&> mContextProvider;
41 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandRegistry>> mRegistry;
42 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CommandOutputSender>> mOutputSender;
43 ::ll::TypedStorage<1, 1, ::CommandPermissionLevel> mOpPermissionLevel;
44 ::ll::TypedStorage<8, 64, ::std::function<bool()>> mChatPermissionsCallback;
45 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::std::unique_ptr<::Command>>> mCompiledCommandMap;
46 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::DeferredCommandBase>>> mDeferredCommands;
47 ::ll::TypedStorage<8, 8, uint64> mDeferredScriptCommandCount;
48 // NOLINTEND
49
50public:
51 // prevent constructor by default
52 MinecraftCommands& operator=(MinecraftCommands const&);
53 MinecraftCommands(MinecraftCommands const&);
54 MinecraftCommands();
55
56public:
57 // virtual functions
58 // NOLINTBEGIN
59 virtual ~MinecraftCommands();
60 // NOLINTEND
61
62public:
63 // member functions
64 // NOLINTBEGIN
65 MCAPI explicit MinecraftCommands(::MinecraftCommandsArguments&& args);
66
67 MCAPI ::Command* compileCommand(
68 ::HashedString const& commandStr,
69 ::CommandOrigin& origin,
70 ::CurrentCmdVersion commandVersion,
71 ::std::function<void(::std::string const&)> onParserError
72 );
73
74 MCAPI void enqueueDeferredCommand(
75 ::std::unique_ptr<::CommandContext> context,
76 bool suppressOutput,
77 bool isRequest,
78 ::std::function<void(::MCRESULT)> callback
79 );
80
81 MCAPI void
82 enqueueDeferredCompiledCommand(::gsl::not_null<::Command*> command, ::std::unique_ptr<::CommandOrigin> origin);
83
84 MCAPI bool enqueueDeferredScriptCommand(::std::unique_ptr<::DeferredScriptCommand> scriptCommand);
85
86 MCAPI ::MCRESULT executeCommand(::CommandContext& context, bool suppressOutput) const;
87
88#ifdef LL_PLAT_C
89 MCFOLD ::CommandOutputSender& getOutputSender() const;
90#endif
91
92 MCFOLD ::CommandRegistry const& getRegistry() const;
93
94 MCFOLD ::CommandRegistry& getRegistry();
95
96 MCAPI void handleOutput(::CommandOrigin const& origin, ::CommandOutput const& output) const;
97
98 MCAPI void initCoreEnums(
99 ::ItemRegistryRef itemRegistry,
100 ::Level const& level,
101 ::ActorFactory const& actorFactory,
102 ::Experiments const& experiments,
103 ::BaseGameVersion const& worldBaseGameVersion
104 );
105
106 MCAPI void initCoreEnumsServer(
107 ::ActorDefinitionGroup const& actorDefinitionGroup,
108 ::CameraPresets const& cameraPresets,
109 ::Recipes const& recipes
110 );
111
112#ifdef LL_PLAT_C
113 MCFOLD void registerChatPermissionsCallback(::std::function<bool()> callback);
114#endif
115
116 MCAPI ::MCRESULT requestCommandExecution(::CommandContext& context, bool suppressOutput);
117
118#ifdef LL_PLAT_C
119 MCAPI ::MCRESULT requestCommandExecution(
120 ::std::unique_ptr<::CommandOrigin> origin,
121 ::std::string const& commandLine,
122 int version,
123 bool suppressOutput
124 );
125#endif
126
127 MCAPI void runCommand(::Command& command, ::CommandOrigin& origin);
128
129 MCAPI void
130 runCommand(::HashedString const& commandStr, ::CommandOrigin& origin, ::CurrentCmdVersion commandVersion);
131
132#ifdef LL_PLAT_C
133 MCAPI void setOutputSender(::std::unique_ptr<::CommandOutputSender> outputSender);
134#endif
135
136 MCAPI void setRegistryNetworkUpdateCallback(::std::function<void(::Packet const&)> callback) const;
137
138 MCAPI void tick();
139 // NOLINTEND
140
141public:
142 // static functions
143 // NOLINTBEGIN
144 MCAPI static ::CommandOutputType getOutputType(::CommandOrigin const& origin);
145
146 MCAPI static void initBlockEnum(::CommandRegistry& registry, ::BaseGameVersion const& worldBaseGameVersion);
147
148 MCAPI static void
149 initEntityEnum(::CommandRegistry& registry, ::ActorFactory const& actorFactory, ::Experiments const& experiments);
150
151 MCAPI static void initEntityPropertyEnum(::CommandRegistry& registry, ::Level const& level);
152
153 MCAPI static void initItemEnum(
154 ::ItemRegistryRef itemRegistry,
155 ::CommandRegistry& registry,
156 ::BaseGameVersion const& worldBaseGameVersion
157 );
158
159 MCAPI static void initItemTagEnum(::ItemRegistryRef itemRegistry, ::CommandRegistry& registry);
160
161 MCAPI static void initStructureFeatureEnum(
162 ::CommandRegistry& registry,
163 ::Experiments const& experiments,
164 ::br::worldgen::StructureRegistry const& structureRegistry
165 );
166
167 MCAPI static void initUnlockableRecipesEnum(::CommandRegistry& registry, ::Recipes const& recipes);
168
169 MCAPI static void registerSharedClientServerEnums(::CommandRegistry& registry);
170 // NOLINTEND
171
172public:
173 // constructor thunks
174 // NOLINTBEGIN
175 MCAPI void* $ctor(::MinecraftCommandsArguments&& args);
176 // NOLINTEND
177
178public:
179 // destructor thunk
180 // NOLINTBEGIN
181 MCAPI void $dtor();
182 // NOLINTEND
183
184public:
185 // vftables
186 // NOLINTBEGIN
187 MCNAPI static void** $vftable();
188 // NOLINTEND
189};
Definition ActorDefinitionGroup.h:37
Definition ActorFactory.h:34
Definition BaseGameVersion.h:13
Definition CameraPresets.h:20
Definition CommandContext.h:10
Definition CommandOrigin.h:32
Definition CommandOutputSender.h:19
Definition CommandOutput.h:20
Definition CommandRegistry.h:51
Definition Command.h:18
Definition DeferredCommandBase.h:10
Definition DeferredScriptCommand.h:20
Definition Experiments.h:14
Definition HashedString.h:5
Definition ICommandsContextProvider.h:15
Definition ItemRegistryRef.h:42
Definition Level.h:255
static MCAPI void ** $vftable()
Definition Packet.h:31
Definition Recipes.h:36
Definition StructureRegistry.h:12
Definition MCRESULT.h:8
Definition MinecraftCommandsArguments.h:11
Definition context.h:5