ResourceLookupRule.java
net.minecraft.util.parsing.packrat.commands.ResourceLookupRule
信息
- 全限定名:net.minecraft.util.parsing.packrat.commands.ResourceLookupRule
- 类型:public abstract class
- 包:net.minecraft.util.parsing.packrat.commands
- 源码路径:src/main/java/net/minecraft/util/parsing/packrat/commands/ResourceLookupRule.java
- 起始行号:L13
- 实现:Rule<StringReader,V>, ResourceSuggestion
- 职责:
TODO
字段/常量
-
idParser- 类型:
NamedRule<StringReader,Identifier> - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
context- 类型:
C - 修饰符:
protected final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
error- 类型:
DelayedException<CommandSyntaxException> - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
protected ResourceLookupRule(NamedRule<StringReader,Identifier> idParser, C context) @ L18
- 构造器名:ResourceLookupRule
- 源码定位:L18
- 修饰符:protected
参数:
- idParser: NamedRule<StringReader,Identifier>
- context: C
说明:
TODO
方法
下面的方法块按源码顺序生成。
public V parse(ParseState<StringReader> state) @ L24
- 方法名:parse
- 源码定位:L24
- 返回类型:V
- 修饰符:public
参数:
- state: ParseState
说明:
TODO
protected abstract V validateElement(ImmutableStringReader reader, Identifier id) @ L42
- 方法名:validateElement
- 源码定位:L42
- 返回类型:V
- 修饰符:protected abstract
参数:
- reader: ImmutableStringReader
- id: Identifier
说明:
TODO
代码
public abstract class ResourceLookupRule<C, V> implements Rule<StringReader, V>, ResourceSuggestion {
private final NamedRule<StringReader, Identifier> idParser;
protected final C context;
private final DelayedException<CommandSyntaxException> error;
protected ResourceLookupRule(NamedRule<StringReader, Identifier> idParser, C context) {
this.idParser = idParser;
this.context = context;
this.error = DelayedException.create(Identifier.ERROR_INVALID);
}
@Override
public @Nullable V parse(ParseState<StringReader> state) {
state.input().skipWhitespace();
int mark = state.mark();
Identifier id = state.parse(this.idParser);
if (id != null) {
try {
return this.validateElement(state.input(), id);
} catch (Exception var5) {
state.errorCollector().store(mark, this, var5);
return null;
}
} else {
state.errorCollector().store(mark, this, this.error);
return null;
}
}
protected abstract V validateElement(ImmutableStringReader reader, Identifier id) throws Exception;
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
DelayedException.create()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
实现
- 引用位置: