/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.ElytraModel; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.EquipmentLayerRenderer; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.state.AvatarRenderState; import net.minecraft.client.renderer.entity.state.HumanoidRenderState; import net.minecraft.client.resources.model.EquipmentClientInfo; import net.minecraft.core.component.DataComponents; import net.minecraft.resources.Identifier; import net.minecraft.world.entity.player.PlayerSkin; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.equipment.Equippable; import org.jspecify.annotations.Nullable; public class WingsLayer> extends RenderLayer { private final ElytraModel elytraModel; private final ElytraModel elytraBabyModel; private final EquipmentLayerRenderer equipmentRenderer; public WingsLayer(RenderLayerParent renderer, EntityModelSet modelSet, EquipmentLayerRenderer equipmentRenderer) { super(renderer); this.elytraModel = new ElytraModel(modelSet.bakeLayer(ModelLayers.ELYTRA)); this.elytraBabyModel = new ElytraModel(modelSet.bakeLayer(ModelLayers.ELYTRA_BABY)); this.equipmentRenderer = equipmentRenderer; } @Override public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, S state, float yRot, float xRot) { ItemStack itemStack = ((HumanoidRenderState)state).chestEquipment; Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE); if (equippable == null || equippable.assetId().isEmpty()) { return; } Identifier playerElytraTexture = WingsLayer.getPlayerElytraTexture(state); ElytraModel model = ((HumanoidRenderState)state).isBaby ? this.elytraBabyModel : this.elytraModel; poseStack.pushPose(); poseStack.translate(0.0f, 0.0f, 0.125f); this.equipmentRenderer.renderLayers(EquipmentClientInfo.LayerType.WINGS, equippable.assetId().get(), model, state, itemStack, poseStack, submitNodeCollector, lightCoords, playerElytraTexture, ((HumanoidRenderState)state).outlineColor, 0); poseStack.popPose(); } private static @Nullable Identifier getPlayerElytraTexture(HumanoidRenderState state) { if (state instanceof AvatarRenderState) { AvatarRenderState playerState = (AvatarRenderState)state; PlayerSkin skin = playerState.skin; if (skin.elytra() != null) { return skin.elytra().texturePath(); } if (skin.cape() != null && playerState.showCape) { return skin.cape().texturePath(); } } return null; } }