content: package com.aizistral.enigmaticlegacy.client.renderers;
  
  import javax.annotation.Nonnull;
  
  import com.aizistral.enigmaticlegacy.EnigmaticLegacy;
  import com.aizistral.enigmaticlegacy.handlers.SuperpositionHandler;
  import com.mojang.blaze3d.vertex.PoseStack;
  import com.mojang.blaze3d.vertex.VertexConsumer;
  
  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.MultiBufferSource;
  import net.minecraft.client.renderer.RenderType;
  import net.minecraft.client.renderer.entity.ItemRenderer;
  import net.minecraft.client.renderer.entity.RenderLayerParent;
  import net.minecraft.client.renderer.entity.layers.RenderLayer;
  import net.minecraft.client.renderer.texture.OverlayTexture;
  import net.minecraft.resources.ResourceLocation;
  import net.minecraft.world.entity.LivingEntity;
  import net.minecraft.world.item.ItemStack;
  import net.minecraftforge.api.distmarker.Dist;
  import net.minecraftforge.api.distmarker.OnlyIn;
  
  @OnlyIn(Dist.CLIENT)
  public class EnigmaticElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
  	private static final ResourceLocation TEXTURE = new ResourceLocation(EnigmaticLegacy.MODID, "textures/models/misc/elytra.png");
  	private final ElytraModel<T> elytraModel;
  
  	public EnigmaticElytraLayer(RenderLayerParent<T, M> layerParent, EntityModelSet modelSet) {
  		super(layerParent);
  		this.elytraModel = new ElytraModel<>(modelSet.bakeLayer(ModelLayers.ELYTRA));
  	}
  
  	@Override
  	public void render(@Nonnull PoseStack pMatrixStack, @Nonnull MultiBufferSource pBuffer, int pPackedLight, T pLivingEntity, float pLimbSwing, float pLimbSwingAmount, float pPartialTicks, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
  		if (SuperpositionHandler.hasEnigmaticElytra(pLivingEntity)) {
  			ItemStack stack = SuperpositionHandler.getEnigmaticElytra(pLivingEntity);
  
  			pMatrixStack.pushPose();
  			pMatrixStack.translate(0.0D, 0.0D, 0.125D);
  			this.getParentModel().copyPropertiesTo(this.elytraModel);
  			this.elytraModel.setupAnim(pLivingEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch);
  			VertexConsumer vertexconsumer = ItemRenderer.getArmorFoilBuffer(pBuffer, RenderType.armorCutoutNoCull(TEXTURE), false, stack.isEnchanted());
  
  			float red = 1;
  			float green = 1;
  			float blue = 1;
  			float alpha = 1;
  
  			this.elytraModel.renderToBuffer(pMatrixStack, vertexconsumer, pPackedLight, OverlayTexture.NO_OVERLAY, red, green, blue, alpha);
  			pMatrixStack.popPose();
  		}
  	}
  }