WaypointStyleProvider.java
net.minecraft.client.data.models.WaypointStyleProvider
信息
- 全限定名:net.minecraft.client.data.models.WaypointStyleProvider
- 类型:public class
- 包:net.minecraft.client.data.models
- 源码路径:src/main/java/net/minecraft/client/data/models/WaypointStyleProvider.java
- 起始行号:L20
- 实现:DataProvider
- 职责:
TODO
字段/常量
pathProvider- 类型:
PackOutput.PathProvider - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public WaypointStyleProvider(PackOutput output) @ L23
- 构造器名:WaypointStyleProvider
- 源码定位:L23
- 修饰符:public
参数:
- output: PackOutput
说明:
TODO
方法
下面的方法块按源码顺序生成。
private static void bootstrap(BiConsumer<ResourceKey<WaypointStyleAsset>,WaypointStyle> consumer) @ L27
- 方法名:bootstrap
- 源码定位:L27
- 返回类型:void
- 修饰符:private static
参数:
- consumer: BiConsumer<ResourceKey
,WaypointStyle>
说明:
TODO
public CompletableFuture<?> run(CachedOutput cache) @ L57
- 方法名:run
- 源码定位:L57
- 返回类型:CompletableFuture<?>
- 修饰符:public
参数:
- cache: CachedOutput
说明:
TODO
public String getName() @ L68
- 方法名:getName
- 源码定位:L68
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class WaypointStyleProvider implements DataProvider {
private final PackOutput.PathProvider pathProvider;
public WaypointStyleProvider(PackOutput output) {
this.pathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "waypoint_style");
}
private static void bootstrap(BiConsumer<ResourceKey<WaypointStyleAsset>, WaypointStyle> consumer) {
consumer.accept(
WaypointStyleAssets.DEFAULT,
new WaypointStyle(
128,
332,
List.of(
Identifier.withDefaultNamespace("default_0"),
Identifier.withDefaultNamespace("default_1"),
Identifier.withDefaultNamespace("default_2"),
Identifier.withDefaultNamespace("default_3")
)
)
);
consumer.accept(
WaypointStyleAssets.BOWTIE,
new WaypointStyle(
64,
332,
List.of(
Identifier.withDefaultNamespace("bowtie"),
Identifier.withDefaultNamespace("default_0"),
Identifier.withDefaultNamespace("default_1"),
Identifier.withDefaultNamespace("default_2"),
Identifier.withDefaultNamespace("default_3")
)
)
);
}
@Override
public CompletableFuture<?> run(CachedOutput cache) {
Map<ResourceKey<WaypointStyleAsset>, WaypointStyle> waypointStyles = new HashMap<>();
bootstrap((id, asset) -> {
if (waypointStyles.putIfAbsent(id, asset) != null) {
throw new IllegalStateException("Tried to register waypoint style twice for id: " + id);
}
});
return DataProvider.saveAll(cache, WaypointStyle.CODEC, this.pathProvider::json, waypointStyles);
}
@Override
public String getName() {
return "Waypoint Style Definitions";
}
}引用的其他类
-
- 引用位置:
参数/构造调用 - 关联成员:
WaypointStyle()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
DataProvider.saveAll()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Identifier.withDefaultNamespace()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: