/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.MapCodec * org.joml.Vector3f * org.jspecify.annotations.Nullable */ package net.minecraft.client.renderer.special; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.serialization.MapCodec; import java.util.Set; import net.minecraft.client.model.SkullModelBase; import net.minecraft.client.renderer.PlayerSkinRenderCache; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.blockentity.SkullBlockRenderer; import net.minecraft.client.renderer.rendertype.RenderType; import net.minecraft.client.renderer.special.SpecialModelRenderer; import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.ResolvableProfile; import net.minecraft.world.level.block.SkullBlock; import org.joml.Vector3f; import org.jspecify.annotations.Nullable; public class PlayerHeadSpecialRenderer implements SpecialModelRenderer { private final PlayerSkinRenderCache playerSkinRenderCache; private final SkullModelBase modelBase; private PlayerHeadSpecialRenderer(PlayerSkinRenderCache playerSkinRenderCache, SkullModelBase modelBase) { this.playerSkinRenderCache = playerSkinRenderCache; this.modelBase = modelBase; } @Override public void submit(@Nullable PlayerSkinRenderCache.RenderInfo argument, ItemDisplayContext type, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, int overlayCoords, boolean hasFoil, int outlineColor) { RenderType renderType = argument != null ? argument.renderType() : PlayerSkinRenderCache.DEFAULT_PLAYER_SKIN_RENDER_TYPE; SkullBlockRenderer.submitSkull(null, 180.0f, 0.0f, poseStack, submitNodeCollector, lightCoords, this.modelBase, renderType, outlineColor, null); } @Override public void getExtents(Set result) { PoseStack poseStack = new PoseStack(); poseStack.translate(0.5f, 0.0f, 0.5f); poseStack.scale(-1.0f, -1.0f, 1.0f); this.modelBase.root().getExtentsForGui(poseStack, result); } @Override public @Nullable PlayerSkinRenderCache.RenderInfo extractArgument(ItemStack stack) { ResolvableProfile profile = stack.get(DataComponents.PROFILE); if (profile == null) { return null; } return this.playerSkinRenderCache.getOrDefault(profile); } public record Unbaked() implements SpecialModelRenderer.Unbaked { public static final MapCodec MAP_CODEC = MapCodec.unit(Unbaked::new); public MapCodec type() { return MAP_CODEC; } @Override public @Nullable SpecialModelRenderer bake(SpecialModelRenderer.BakingContext context) { SkullModelBase model = SkullBlockRenderer.createModel(context.entityModelSet(), SkullBlock.Types.PLAYER); if (model == null) { return null; } return new PlayerHeadSpecialRenderer(context.playerSkinRenderCache(), model); } } }