CopperGolemStatueSpecialRenderer.java

net.minecraft.client.renderer.special.CopperGolemStatueSpecialRenderer

信息

  • 全限定名:net.minecraft.client.renderer.special.CopperGolemStatueSpecialRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.special
  • 源码路径:src/main/java/net/minecraft/client/renderer/special/CopperGolemStatueSpecialRenderer.java
  • 起始行号:L21
  • 实现:NoDataSpecialModelRenderer
  • 职责:

    TODO

字段/常量

  • model

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

      TODO

  • texture

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

      TODO

内部类/嵌套类型

  • net.minecraft.client.renderer.special.CopperGolemStatueSpecialRenderer.Unbaked
    • 类型: record
    • 修饰符: public
    • 源码定位: L43
    • 说明:

      TODO

构造器

public CopperGolemStatueSpecialRenderer(CopperGolemStatueModel model, Identifier texture) @ L25

  • 构造器名:CopperGolemStatueSpecialRenderer
  • 源码定位:L25
  • 修饰符:public

参数:

  • model: CopperGolemStatueModel
  • texture: Identifier

说明:

TODO

方法

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

public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) @ L30

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

参数:

  • poseStack: PoseStack
  • submitNodeCollector: SubmitNodeCollector
  • lightCoords: int
  • overlayCoords: int
  • hasFoil: boolean
  • outlineColor: int

说明:

TODO

public void getExtents(Consumer<Vector3fc> output) @ L35

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

参数:

  • output: Consumer

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class CopperGolemStatueSpecialRenderer implements NoDataSpecialModelRenderer {
    private final CopperGolemStatueModel model;
    private final Identifier texture;
 
    public CopperGolemStatueSpecialRenderer(CopperGolemStatueModel model, Identifier texture) {
        this.model = model;
        this.texture = texture;
    }
 
    @Override
    public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) {
        submitNodeCollector.submitModel(this.model, Unit.INSTANCE, poseStack, this.texture, lightCoords, overlayCoords, outlineColor, null);
    }
 
    @Override
    public void getExtents(Consumer<Vector3fc> output) {
        PoseStack poseStack = new PoseStack();
        this.model.setupAnim(Unit.INSTANCE);
        this.model.root().getExtentsForGui(poseStack, output);
    }
 
    @OnlyIn(Dist.CLIENT)
    public record Unbaked(Identifier texture, CopperGolemStatueBlock.Pose pose) implements NoDataSpecialModelRenderer.Unbaked {
        public static final MapCodec<CopperGolemStatueSpecialRenderer.Unbaked> MAP_CODEC = RecordCodecBuilder.mapCodec(
            i -> i.group(
                    Identifier.CODEC.fieldOf("texture").forGetter(CopperGolemStatueSpecialRenderer.Unbaked::texture),
                    CopperGolemStatueBlock.Pose.CODEC.fieldOf("pose").forGetter(CopperGolemStatueSpecialRenderer.Unbaked::pose)
                )
                .apply(i, CopperGolemStatueSpecialRenderer.Unbaked::new)
        );
 
        public Unbaked(WeatheringCopper.WeatherState state, CopperGolemStatueBlock.Pose pose) {
            this(CopperGolemOxidationLevels.getOxidationLevel(state).texture(), pose);
        }
 
        @Override
        public MapCodec<CopperGolemStatueSpecialRenderer.Unbaked> type() {
            return MAP_CODEC;
        }
 
        public CopperGolemStatueSpecialRenderer bake(SpecialModelRenderer.BakingContext context) {
            CopperGolemStatueModel model = new CopperGolemStatueModel(context.entityModelSet().bakeLayer(getModel(this.pose)));
            return new CopperGolemStatueSpecialRenderer(model, this.texture);
        }
 
        private static ModelLayerLocation getModel(CopperGolemStatueBlock.Pose pose) {
            return switch (pose) {
                case STANDING -> ModelLayers.COPPER_GOLEM;
                case SITTING -> ModelLayers.COPPER_GOLEM_SITTING;
                case STAR -> ModelLayers.COPPER_GOLEM_STAR;
                case RUNNING -> ModelLayers.COPPER_GOLEM_RUNNING;
            };
        }
    }
}

引用的其他类