IronGolemRenderer.java

net.minecraft.client.renderer.entity.IronGolemRenderer

信息

  • 全限定名:net.minecraft.client.renderer.entity.IronGolemRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.entity
  • 源码路径:src/main/java/net/minecraft/client/renderer/entity/IronGolemRenderer.java
  • 起始行号:L19
  • 继承:MobRenderer<IronGolem,IronGolemRenderState,IronGolemModel>
  • 职责:

    TODO

字段/常量

  • BLOCK_DISPLAY_CONTEXT

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

      TODO

  • GOLEM_LOCATION

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

      TODO

  • blockModelResolver

    • 类型: BlockModelResolver
    • 修饰符: private final
    • 源码定位: L22
    • 说明:

      TODO

内部类/嵌套类型

构造器

public IronGolemRenderer(EntityRendererProvider.Context context) @ L24

  • 构造器名:IronGolemRenderer
  • 源码定位:L24
  • 修饰符:public

参数:

  • context: EntityRendererProvider.Context

说明:

TODO

方法

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

public Identifier getTextureLocation(IronGolemRenderState state) @ L31

  • 方法名:getTextureLocation
  • 源码定位:L31
  • 返回类型:Identifier
  • 修饰符:public

参数:

  • state: IronGolemRenderState

说明:

TODO

public IronGolemRenderState createRenderState() @ L35

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

参数:

说明:

TODO

public void extractRenderState(IronGolem entity, IronGolemRenderState state, float partialTicks) @ L39

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

参数:

  • entity: IronGolem
  • state: IronGolemRenderState
  • partialTicks: float

说明:

TODO

protected void setupRotations(IronGolemRenderState state, PoseStack poseStack, float bodyRot, float entityScale) @ L52

  • 方法名:setupRotations
  • 源码定位:L52
  • 返回类型:void
  • 修饰符:protected

参数:

  • state: IronGolemRenderState
  • poseStack: PoseStack
  • bodyRot: float
  • entityScale: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class IronGolemRenderer extends MobRenderer<IronGolem, IronGolemRenderState, IronGolemModel> {
    public static final BlockDisplayContext BLOCK_DISPLAY_CONTEXT = BlockDisplayContext.create();
    private static final Identifier GOLEM_LOCATION = Identifier.withDefaultNamespace("textures/entity/iron_golem/iron_golem.png");
    private final BlockModelResolver blockModelResolver;
 
    public IronGolemRenderer(EntityRendererProvider.Context context) {
        super(context, new IronGolemModel(context.bakeLayer(ModelLayers.IRON_GOLEM)), 0.7F);
        this.blockModelResolver = context.getBlockModelResolver();
        this.addLayer(new IronGolemCrackinessLayer(this));
        this.addLayer(new IronGolemFlowerLayer(this));
    }
 
    public Identifier getTextureLocation(IronGolemRenderState state) {
        return GOLEM_LOCATION;
    }
 
    public IronGolemRenderState createRenderState() {
        return new IronGolemRenderState();
    }
 
    public void extractRenderState(IronGolem entity, IronGolemRenderState state, float partialTicks) {
        super.extractRenderState(entity, state, partialTicks);
        state.attackTicksRemaining = entity.getAttackAnimationTick() > 0.0F ? entity.getAttackAnimationTick() - partialTicks : 0.0F;
        state.offerFlowerTick = entity.getOfferFlowerTick();
        if (state.offerFlowerTick > 0) {
            this.blockModelResolver.update(state.flowerBlock, Blocks.POPPY.defaultBlockState(), BLOCK_DISPLAY_CONTEXT);
        } else {
            state.flowerBlock.clear();
        }
 
        state.crackiness = entity.getCrackiness();
    }
 
    protected void setupRotations(IronGolemRenderState state, PoseStack poseStack, float bodyRot, float entityScale) {
        super.setupRotations(state, poseStack, bodyRot, entityScale);
        if (!(state.walkAnimationSpeed < 0.01)) {
            float p = 13.0F;
            float wp = state.walkAnimationPos + 6.0F;
            float triangleWave = (Math.abs(wp % 13.0F - 6.5F) - 3.25F) / 3.25F;
            poseStack.mulPose(Axis.ZP.rotationDegrees(6.5F * triangleWave));
        }
    }
}

引用的其他类