60 lines
2.7 KiB
Java
60 lines
2.7 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.joml.Quaternionfc
|
|
*/
|
|
package net.minecraft.client.renderer.entity.layers;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import com.mojang.math.Axis;
|
|
import net.minecraft.client.model.SnowGolemModel;
|
|
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
|
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
|
import net.minecraft.client.renderer.block.model.BlockStateModel;
|
|
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
|
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
|
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
|
import net.minecraft.client.renderer.entity.state.SnowGolemRenderState;
|
|
import net.minecraft.client.renderer.rendertype.RenderType;
|
|
import net.minecraft.client.renderer.rendertype.RenderTypes;
|
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
|
import net.minecraft.world.level.block.Blocks;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import org.joml.Quaternionfc;
|
|
|
|
public class SnowGolemHeadLayer
|
|
extends RenderLayer<SnowGolemRenderState, SnowGolemModel> {
|
|
private final BlockRenderDispatcher blockRenderer;
|
|
|
|
public SnowGolemHeadLayer(RenderLayerParent<SnowGolemRenderState, SnowGolemModel> renderer, BlockRenderDispatcher blockRenderer) {
|
|
super(renderer);
|
|
this.blockRenderer = blockRenderer;
|
|
}
|
|
|
|
@Override
|
|
public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, SnowGolemRenderState state, float yRot, float xRot) {
|
|
if (!state.hasPumpkin) {
|
|
return;
|
|
}
|
|
if (state.isInvisible && !state.appearsGlowing()) {
|
|
return;
|
|
}
|
|
poseStack.pushPose();
|
|
((SnowGolemModel)this.getParentModel()).getHead().translateAndRotate(poseStack);
|
|
float s = 0.625f;
|
|
poseStack.translate(0.0f, -0.34375f, 0.0f);
|
|
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(180.0f));
|
|
poseStack.scale(0.625f, -0.625f, -0.625f);
|
|
BlockState pumpkinBlockState = Blocks.CARVED_PUMPKIN.defaultBlockState();
|
|
BlockStateModel model = this.blockRenderer.getBlockModel(pumpkinBlockState);
|
|
int overlayCoords = LivingEntityRenderer.getOverlayCoords(state, 0.0f);
|
|
poseStack.translate(-0.5f, -0.5f, -0.5f);
|
|
RenderType renderType = state.appearsGlowing() && state.isInvisible ? RenderTypes.outline(TextureAtlas.LOCATION_BLOCKS) : ItemBlockRenderTypes.getRenderType(pumpkinBlockState);
|
|
submitNodeCollector.submitBlockModel(poseStack, renderType, model, 0.0f, 0.0f, 0.0f, lightCoords, overlayCoords, state.outlineColor);
|
|
poseStack.popPose();
|
|
}
|
|
}
|
|
|