[1.19.x] Add CommandBuildContext to Register Command Events (#8716)

This commit is contained in:
ChampionAsh5357 authored and GitHub committed 2022-06-12 23:36:25 +01:00
1 parent 597ebc3267
commit 0ec4c34a34
6 files changed
+47 -14

No files matched your search

@@ -6,6 +6,7 @@
package net.minecraftforge.event;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.server.ReloadableServerResources;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Event;
@@ -24,20 +25,36 @@ public class RegisterCommandsEvent extends Event
{
private final CommandDispatcher<CommandSourceStack> dispatcher;
private final Commands.CommandSelection environment;
private final CommandBuildContext context;
public RegisterCommandsEvent(CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment)
public RegisterCommandsEvent(CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment, CommandBuildContext context)
{
this.dispatcher = dispatcher;
this.environment = environment;
this.context = context;
}
/**
* {@return the command dispatcher for registering commands to be executed on the client}
*/
public CommandDispatcher<CommandSourceStack> getDispatcher()
{
return dispatcher;
}
/**
* {@return the environment the command is being registered for}
*/
public Commands.CommandSelection getEnvironment()
{
return environment;
}
/**
* {@return the context to build the commands for}
*/
public CommandBuildContext getBuildContext()
{
return context;
}
}