ExecuteCommand.java

net.minecraft.commands.execution.tasks.ExecuteCommand

信息

  • 全限定名:net.minecraft.commands.execution.tasks.ExecuteCommand
  • 类型:public class
  • 包:net.minecraft.commands.execution.tasks
  • 源码路径:src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
  • 起始行号:L13
  • 实现:UnboundEntryAction
  • 职责:

    TODO

字段/常量

  • commandInput

    • 类型: String
    • 修饰符: private final
    • 源码定位: L14
    • 说明:

      TODO

  • modifiers

    • 类型: ChainModifiers
    • 修饰符: private final
    • 源码定位: L15
    • 说明:

      TODO

  • executionContext

    • 类型: CommandContext<T>
    • 修饰符: private final
    • 源码定位: L16
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ExecuteCommand(String commandInput, ChainModifiers modifiers, CommandContext<T> executionContext) @ L18

  • 构造器名:ExecuteCommand
  • 源码定位:L18
  • 修饰符:public

参数:

  • commandInput: String
  • modifiers: ChainModifiers
  • executionContext: CommandContext

说明:

TODO

方法

下面的方法块按源码顺序生成。

public void execute(T sender, ExecutionContext<T> context, Frame frame) @ L24

  • 方法名:execute
  • 源码定位:L24
  • 返回类型:void
  • 修饰符:public

参数:

  • sender: T
  • context: ExecutionContext
  • frame: Frame

说明:

TODO

代码

public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements UnboundEntryAction<T> {
    private final String commandInput;
    private final ChainModifiers modifiers;
    private final CommandContext<T> executionContext;
 
    public ExecuteCommand(String commandInput, ChainModifiers modifiers, CommandContext<T> executionContext) {
        this.commandInput = commandInput;
        this.modifiers = modifiers;
        this.executionContext = executionContext;
    }
 
    public void execute(T sender, ExecutionContext<T> context, Frame frame) {
        context.profiler().push(() -> "execute " + this.commandInput);
 
        try {
            context.incrementCost();
            int result = ContextChain.runExecutable(this.executionContext, sender, ExecutionCommandSource.resultConsumer(), this.modifiers.isForked());
            TraceCallbacks tracer = context.tracer();
            if (tracer != null) {
                tracer.onReturn(frame.depth(), this.commandInput, result);
            }
        } catch (CommandSyntaxException var9) {
            sender.handleError(var9, this.modifiers.isForked(), context.tracer());
        } finally {
            context.profiler().pop();
        }
    }
}

引用的其他类