CommandResultCallback.java
net.minecraft.commands.CommandResultCallback
信息
- 全限定名:net.minecraft.commands.CommandResultCallback
- 类型:public interface
- 包:net.minecraft.commands
- 源码路径:src/main/java/net/minecraft/commands/CommandResultCallback.java
- 起始行号:L4
- 职责:
TODO
字段/常量
EMPTY- 类型:
CommandResultCallback - 修饰符:
public public - 源码定位:
L5 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
void onResult(boolean success, int result) @ L16
- 方法名:onResult
- 源码定位:L16
- 返回类型:void
- 修饰符:package-private
参数:
- success: boolean
- result: int
说明:
TODO
default void onSuccess(int result) @ L18
- 方法名:onSuccess
- 源码定位:L18
- 返回类型:void
- 修饰符:default
参数:
- result: int
说明:
TODO
default void onFailure() @ L22
- 方法名:onFailure
- 源码定位:L22
- 返回类型:void
- 修饰符:default
参数:
- 无
说明:
TODO
static CommandResultCallback chain(CommandResultCallback first, CommandResultCallback second) @ L26
- 方法名:chain
- 源码定位:L26
- 返回类型:CommandResultCallback
- 修饰符:static
参数:
- first: CommandResultCallback
- second: CommandResultCallback
说明:
TODO
代码
@FunctionalInterface
public interface CommandResultCallback {
CommandResultCallback EMPTY = new CommandResultCallback() {
@Override
public void onResult(boolean success, int result) {
}
@Override
public String toString() {
return "<empty>";
}
};
void onResult(boolean success, int result);
default void onSuccess(int result) {
this.onResult(true, result);
}
default void onFailure() {
this.onResult(false, 0);
}
static CommandResultCallback chain(CommandResultCallback first, CommandResultCallback second) {
if (first == EMPTY) {
return second;
} else {
return second == EMPTY ? first : (success, result) -> {
first.onResult(success, result);
second.onResult(success, result);
};
}
}
}引用的其他类
- 无