CustomCommandExecutor.java

net.minecraft.commands.execution.CustomCommandExecutor

信息

  • 全限定名:net.minecraft.commands.execution.CustomCommandExecutor
  • 类型:public interface
  • 包:net.minecraft.commands.execution
  • 源码路径:src/main/java/net/minecraft/commands/execution/CustomCommandExecutor.java
  • 起始行号:L10
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

  • net.minecraft.commands.execution.CustomCommandExecutor.CommandAdapter

    • 类型: interface
    • 修饰符: public
    • 源码定位: L13
    • 说明:

      TODO

  • net.minecraft.commands.execution.CustomCommandExecutor.WithErrorHandling

    • 类型: class
    • 修饰符: public abstract static
    • 源码定位: L20
    • 说明:

      TODO

构造器

方法

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

void run(T sender, ContextChain<T> currentStep, ChainModifiers modifiers, ExecutionControl<T> output) @ L11

  • 方法名:run
  • 源码定位:L11
  • 返回类型:void
  • 修饰符:package-private

参数:

  • sender: T
  • currentStep: ContextChain
  • modifiers: ChainModifiers
  • output: ExecutionControl

说明:

TODO

代码

public interface CustomCommandExecutor<T> {
    void run(T sender, ContextChain<T> currentStep, ChainModifiers modifiers, ExecutionControl<T> output);
 
    public interface CommandAdapter<T> extends CustomCommandExecutor<T>, Command<T> {
        @Override
        default int run(CommandContext<T> context) throws CommandSyntaxException {
            throw new UnsupportedOperationException("This function should not run");
        }
    }
 
    public abstract static class WithErrorHandling<T extends ExecutionCommandSource<T>> implements CustomCommandExecutor<T> {
        public final void run(T sender, ContextChain<T> currentStep, ChainModifiers modifiers, ExecutionControl<T> output) {
            try {
                this.runGuarded(sender, currentStep, modifiers, output);
            } catch (CommandSyntaxException var6) {
                this.onError(var6, sender, modifiers, output.tracer());
                sender.callback().onFailure();
            }
        }
 
        protected void onError(CommandSyntaxException e, T sender, ChainModifiers modifiers, @Nullable TraceCallbacks tracer) {
            sender.handleError(e, modifiers.isForked(), tracer);
        }
 
        protected abstract void runGuarded(T sender, ContextChain<T> currentStep, ChainModifiers modifiers, ExecutionControl<T> output) throws CommandSyntaxException;
    }
}

引用的其他类