FallingBlockRenderer.java

net.minecraft.client.renderer.entity.FallingBlockRenderer

信息

  • 全限定名:net.minecraft.client.renderer.entity.FallingBlockRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.entity
  • 源码路径:src/main/java/net/minecraft/client/renderer/entity/FallingBlockRenderer.java
  • 起始行号:L17
  • 继承:EntityRenderer<FallingBlockEntity,FallingBlockRenderState>
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public FallingBlockRenderer(EntityRendererProvider.Context context) @ L18

  • 构造器名:FallingBlockRenderer
  • 源码定位:L18
  • 修饰符:public

参数:

  • context: EntityRendererProvider.Context

说明:

TODO

方法

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

public boolean shouldRender(FallingBlockEntity entity, Frustum culler, double camX, double camY, double camZ) @ L23

  • 方法名:shouldRender
  • 源码定位:L23
  • 返回类型:boolean
  • 修饰符:public

参数:

  • entity: FallingBlockEntity
  • culler: Frustum
  • camX: double
  • camY: double
  • camZ: double

说明:

TODO

public void submit(FallingBlockRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) @ L27

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

参数:

  • state: FallingBlockRenderState
  • poseStack: PoseStack
  • submitNodeCollector: SubmitNodeCollector
  • camera: CameraRenderState

说明:

TODO

public FallingBlockRenderState createRenderState() @ L38

  • 方法名:createRenderState
  • 源码定位:L38
  • 返回类型:FallingBlockRenderState
  • 修饰符:public

参数:

说明:

TODO

public void extractRenderState(FallingBlockEntity entity, FallingBlockRenderState state, float partialTicks) @ L42

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

参数:

  • entity: FallingBlockEntity
  • state: FallingBlockRenderState
  • partialTicks: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class FallingBlockRenderer extends EntityRenderer<FallingBlockEntity, FallingBlockRenderState> {
    public FallingBlockRenderer(EntityRendererProvider.Context context) {
        super(context);
        this.shadowRadius = 0.5F;
    }
 
    public boolean shouldRender(FallingBlockEntity entity, Frustum culler, double camX, double camY, double camZ) {
        return !super.shouldRender(entity, culler, camX, camY, camZ) ? false : entity.getBlockState() != entity.level().getBlockState(entity.blockPosition());
    }
 
    public void submit(FallingBlockRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
        BlockState blockState = state.movingBlockRenderState.blockState;
        if (blockState.getRenderShape() == RenderShape.MODEL) {
            poseStack.pushPose();
            poseStack.translate(-0.5, 0.0, -0.5);
            submitNodeCollector.submitMovingBlock(poseStack, state.movingBlockRenderState);
            poseStack.popPose();
            super.submit(state, poseStack, submitNodeCollector, camera);
        }
    }
 
    public FallingBlockRenderState createRenderState() {
        return new FallingBlockRenderState();
    }
 
    public void extractRenderState(FallingBlockEntity entity, FallingBlockRenderState state, float partialTicks) {
        super.extractRenderState(entity, state, partialTicks);
        BlockPos pos = BlockPos.containing(entity.getX(), entity.getBoundingBox().maxY, entity.getZ());
        state.movingBlockRenderState.randomSeedPos = entity.getStartPos();
        state.movingBlockRenderState.blockPos = pos;
        state.movingBlockRenderState.blockState = entity.getBlockState();
        if (entity.level() instanceof ClientLevel clientLevel) {
            state.movingBlockRenderState.biome = clientLevel.getBiome(pos);
            state.movingBlockRenderState.cardinalLighting = clientLevel.cardinalLighting();
            state.movingBlockRenderState.lightEngine = clientLevel.getLightEngine();
        }
    }
}

引用的其他类