ExecutionCommandSource.java

net.minecraft.commands.ExecutionCommandSource

信息

  • 全限定名:net.minecraft.commands.ExecutionCommandSource
  • 类型:public interface
  • 包:net.minecraft.commands
  • 源码路径:src/main/java/net/minecraft/commands/ExecutionCommandSource.java
  • 起始行号:L12
  • 继承:PermissionSetSupplier
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

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

T withCallback(CommandResultCallback resultCallback) @ L13

  • 方法名:withCallback
  • 源码定位:L13
  • 返回类型:T
  • 修饰符:package-private

参数:

  • resultCallback: CommandResultCallback

说明:

TODO

CommandResultCallback callback() @ L15

  • 方法名:callback
  • 源码定位:L15
  • 返回类型:CommandResultCallback
  • 修饰符:package-private

参数:

说明:

TODO

default T clearCallbacks() @ L17

  • 方法名:clearCallbacks
  • 源码定位:L17
  • 返回类型:T
  • 修饰符:default

参数:

说明:

TODO

CommandDispatcher<T> dispatcher() @ L21

  • 方法名:dispatcher
  • 源码定位:L21
  • 返回类型:CommandDispatcher
  • 修饰符:package-private

参数:

说明:

TODO

void handleError(CommandExceptionType type, Message message, boolean forked, TraceCallbacks tracer) @ L23

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

参数:

  • type: CommandExceptionType
  • message: Message
  • forked: boolean
  • tracer: TraceCallbacks

说明:

TODO

boolean isSilent() @ L25

  • 方法名:isSilent
  • 源码定位:L25
  • 返回类型:boolean
  • 修饰符:package-private

参数:

说明:

TODO

default void handleError(CommandSyntaxException e, boolean forked, TraceCallbacks tracer) @ L27

  • 方法名:handleError
  • 源码定位:L27
  • 返回类型:void
  • 修饰符:default

参数:

  • e: CommandSyntaxException
  • forked: boolean
  • tracer: TraceCallbacks

说明:

TODO

static <T extends ExecutionCommandSource<T>> ResultConsumer<T> resultConsumer() @ L31

  • 方法名:resultConsumer
  • 源码定位:L31
  • 返回类型:<T extends ExecutionCommandSource> ResultConsumer
  • 修饰符:static

参数:

说明:

TODO

代码

public interface ExecutionCommandSource<T extends ExecutionCommandSource<T>> extends PermissionSetSupplier {
    T withCallback(CommandResultCallback resultCallback);
 
    CommandResultCallback callback();
 
    default T clearCallbacks() {
        return this.withCallback(CommandResultCallback.EMPTY);
    }
 
    CommandDispatcher<T> dispatcher();
 
    void handleError(CommandExceptionType type, Message message, boolean forked, @Nullable TraceCallbacks tracer);
 
    boolean isSilent();
 
    default void handleError(CommandSyntaxException e, boolean forked, @Nullable TraceCallbacks tracer) {
        this.handleError(e.getType(), e.getRawMessage(), forked, tracer);
    }
 
    static <T extends ExecutionCommandSource<T>> ResultConsumer<T> resultConsumer() {
        return (context, success, result) -> context.getSource().callback().onResult(success, result);
    }
}

引用的其他类