fixes for 22w11a

This commit is contained in:
gnembon committed 2022-03-17 20:21:55 +01:00
1 parent 3e419d1557
commit 302a7b4817
39 files changed
+410 -305

No files matched your search

+20 -21
View File
@@ -32,6 +32,7 @@ import com.mojang.brigadier.CommandDispatcher;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.MinecraftServer;
@@ -117,37 +118,35 @@ public class CarpetServer // static for now - easier to handle all around the co
extensions.forEach(e -> e.onTick(server));
}
@Deprecated
public static void registerCarpetCommands(CommandDispatcher<CommandSourceStack> dispatcher) {
}
public static void registerCarpetCommands(CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment)
public static void registerCarpetCommands(CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment, CommandBuildContext commandBuildContext)
{
if (settingsManager == null) // bootstrap dev initialization check
{
return;
}
settingsManager.registerCommand(dispatcher);
settingsManager.registerCommand(dispatcher, commandBuildContext);
extensions.forEach(e -> {
SettingsManager sm = e.customSettingsManager();
if (sm != null) sm.registerCommand(dispatcher);
if (sm != null) sm.registerCommand(dispatcher, commandBuildContext);
});
TickCommand.register(dispatcher);
ProfileCommand.register(dispatcher);
CounterCommand.register(dispatcher);
LogCommand.register(dispatcher);
SpawnCommand.register(dispatcher);
PlayerCommand.register(dispatcher);
//CameraModeCommand.register(dispatcher);
InfoCommand.register(dispatcher);
DistanceCommand.register(dispatcher);
PerimeterInfoCommand.register(dispatcher);
DrawCommand.register(dispatcher);
ScriptCommand.register(dispatcher);
MobAICommand.register(dispatcher);
TickCommand.register(dispatcher, commandBuildContext);
ProfileCommand.register(dispatcher, commandBuildContext);
CounterCommand.register(dispatcher, commandBuildContext);
LogCommand.register(dispatcher, commandBuildContext);
SpawnCommand.register(dispatcher, commandBuildContext);
PlayerCommand.register(dispatcher, commandBuildContext);
InfoCommand.register(dispatcher, commandBuildContext);
DistanceCommand.register(dispatcher, commandBuildContext);
PerimeterInfoCommand.register(dispatcher, commandBuildContext);
DrawCommand.register(dispatcher, commandBuildContext);
ScriptCommand.register(dispatcher, commandBuildContext);
MobAICommand.register(dispatcher, commandBuildContext);
// registering command of extensions that has registered before either server is created
// for all other, they will have them registered when they add themselves
extensions.forEach(e -> e.registerCommands(dispatcher));
extensions.forEach(e -> {
e.registerCommands(dispatcher, commandBuildContext);
e.registerCommands(dispatcher);
});
currentCommandDispatcher = dispatcher;
if (environment != Commands.CommandSelection.DEDICATED)