use of net.silentchaos512.gear.item.gear.GearElytraItem in project Silent-Gear by SilentChaos512.
the class GearElytraLayer method render.
@Override
public void render(@Nonnull PoseStack matrixStackIn, @Nonnull MultiBufferSource bufferIn, int packedLightIn, T entityIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
ItemStack stack = entityIn.getItemBySlot(EquipmentSlot.CHEST);
if (stack.getItem() instanceof GearElytraItem) {
ResourceLocation resourcelocation;
if (entityIn instanceof AbstractClientPlayer) {
AbstractClientPlayer abstractclientplayerentity = (AbstractClientPlayer) entityIn;
boolean hasElytra = abstractclientplayerentity.isElytraLoaded() && abstractclientplayerentity.getElytraTextureLocation() != null;
boolean hasCape = abstractclientplayerentity.isCapeLoaded() && abstractclientplayerentity.getCloakTextureLocation() != null && abstractclientplayerentity.isModelPartShown(PlayerModelPart.CAPE);
if (hasElytra) {
resourcelocation = abstractclientplayerentity.getElytraTextureLocation();
} else if (hasCape) {
resourcelocation = abstractclientplayerentity.getCloakTextureLocation();
} else {
resourcelocation = TEXTURE;
}
} else {
resourcelocation = TEXTURE;
}
matrixStackIn.pushPose();
matrixStackIn.translate(0.0D, 0.0D, 0.125D);
this.getParentModel().copyPropertiesTo(this.modelElytra);
this.modelElytra.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
VertexConsumer ivertexbuilder = ItemRenderer.getArmorFoilBuffer(bufferIn, this.modelElytra.renderType(resourcelocation), false, stack.isEnchanted());
Color color = new Color(GearClientHelper.getColor(stack, PartType.MAIN));
this.modelElytra.renderToBuffer(matrixStackIn, ivertexbuilder, packedLightIn, OverlayTexture.NO_OVERLAY, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
matrixStackIn.popPose();
}
}
Aggregations