AbstractEndPortalRenderer.java

net.minecraft.client.renderer.blockentity.AbstractEndPortalRenderer

信息

  • 全限定名:net.minecraft.client.renderer.blockentity.AbstractEndPortalRenderer
  • 类型:public abstract class
  • 包:net.minecraft.client.renderer.blockentity
  • 源码路径:src/main/java/net/minecraft/client/renderer/blockentity/AbstractEndPortalRenderer.java
  • 起始行号:L25
  • 实现:BlockEntityRenderer<T,S>
  • 职责:

    TODO

字段/常量

  • FROM

    • 类型: Vector3fc
    • 修饰符: private static final
    • 源码定位: L26
    • 说明:

      TODO

  • TO

    • 类型: Vector3fc
    • 修饰符: private static final
    • 源码定位: L27
    • 说明:

      TODO

  • END_SKY_LOCATION

    • 类型: Identifier
    • 修饰符: public static final
    • 源码定位: L40
    • 说明:

      TODO

  • END_PORTAL_LOCATION

    • 类型: Identifier
    • 修饰符: public static final
    • 源码定位: L41
    • 说明:

      TODO

  • ALL_FACES

    • 类型: List<Direction>
    • 修饰符: private static final
    • 源码定位: L42
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

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

public void extractRenderState(T blockEntity, S state, float partialTicks, Vec3 cameraPosition, ModelFeatureRenderer.CrumblingOverlay breakProgress) @ L44

  • 方法名:extractRenderState
  • 源码定位:L44
  • 返回类型:void
  • 修饰符:public

参数:

  • blockEntity: T
  • state: S
  • partialTicks: float
  • cameraPosition: Vec3
  • breakProgress: ModelFeatureRenderer.CrumblingOverlay

说明:

TODO

protected static void submitCube(Collection<Direction> facesToShow, RenderType renderType, PoseStack poseStack, SubmitNodeCollector submitNodeCollector) @ L57

  • 方法名:submitCube
  • 源码定位:L57
  • 返回类型:void
  • 修饰符:protected static

参数:

  • facesToShow: Collection
  • renderType: RenderType
  • poseStack: PoseStack
  • submitNodeCollector: SubmitNodeCollector

说明:

TODO

public static void submitSpecial(RenderType renderType, PoseStack poseStack, SubmitNodeCollector submitNodeCollector) @ L69

  • 方法名:submitSpecial
  • 源码定位:L69
  • 返回类型:void
  • 修饰符:public static

参数:

  • renderType: RenderType
  • poseStack: PoseStack
  • submitNodeCollector: SubmitNodeCollector

说明:

TODO

public static void getExtents(Consumer<Vector3fc> output) @ L73

  • 方法名:getExtents
  • 源码定位:L73
  • 返回类型:void
  • 修饰符:public static

参数:

  • output: Consumer

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class AbstractEndPortalRenderer<T extends TheEndPortalBlockEntity, S extends EndPortalRenderState> implements BlockEntityRenderer<T, S> {
    private static final Vector3fc FROM = new Vector3f(0.0F, 0.0F, 0.0F);
    private static final Vector3fc TO = new Vector3f(1.0F, 1.0F, 1.0F);
    private static final Map<Direction, List<Vector3fc>> FACES = Util.makeEnumMap(
        Direction.class,
        direction -> {
            FaceInfo faceInfo = FaceInfo.fromFacing(direction);
            return List.of(
                faceInfo.getVertexInfo(0).select(FROM, TO),
                faceInfo.getVertexInfo(1).select(FROM, TO),
                faceInfo.getVertexInfo(2).select(FROM, TO),
                faceInfo.getVertexInfo(3).select(FROM, TO)
            );
        }
    );
    public static final Identifier END_SKY_LOCATION = Identifier.withDefaultNamespace("textures/environment/end_sky.png");
    public static final Identifier END_PORTAL_LOCATION = Identifier.withDefaultNamespace("textures/entity/end_portal/end_portal.png");
    private static final List<Direction> ALL_FACES = List.of(Direction.values());
 
    public void extractRenderState(
        T blockEntity, S state, float partialTicks, Vec3 cameraPosition, ModelFeatureRenderer.@Nullable CrumblingOverlay breakProgress
    ) {
        BlockEntityRenderer.super.extractRenderState(blockEntity, state, partialTicks, cameraPosition, breakProgress);
        state.facesToShow.clear();
 
        for (Direction direction : Direction.values()) {
            if (blockEntity.shouldRenderFace(direction)) {
                state.facesToShow.add(direction);
            }
        }
    }
 
    protected static void submitCube(Collection<Direction> facesToShow, RenderType renderType, PoseStack poseStack, SubmitNodeCollector submitNodeCollector) {
        if (!facesToShow.isEmpty()) {
            submitNodeCollector.submitCustomGeometry(poseStack, renderType, (pose, buffer) -> {
                for (Direction direction : facesToShow) {
                    for (Vector3fc faceVertex : FACES.get(direction)) {
                        buffer.addVertex(pose, faceVertex);
                    }
                }
            });
        }
    }
 
    public static void submitSpecial(RenderType renderType, PoseStack poseStack, SubmitNodeCollector submitNodeCollector) {
        submitCube(ALL_FACES, renderType, poseStack, submitNodeCollector);
    }
 
    public static void getExtents(Consumer<Vector3fc> output) {
        FACES.values().forEach(vertices -> vertices.forEach(output));
    }
}

引用的其他类