Fixed Elytra Renderer

This commit is contained in:
Frank 2023-12-19 15:12:18 +01:00
parent 951a6d110c
commit 72003aa94b

View file

@ -16,6 +16,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.ElytraLayer; import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -48,13 +49,12 @@ public class ArmoredElytraLayer<T extends LivingEntity, M extends EntityModel<T>
if (itemStack != null && itemStack.getItem() instanceof BCLElytraItem) { if (itemStack != null && itemStack.getItem() instanceof BCLElytraItem) {
ResourceLocation wingsTexture = ((BCLElytraItem) itemStack.getItem()).getModelTexture(); ResourceLocation wingsTexture = ((BCLElytraItem) itemStack.getItem()).getModelTexture();
if (livingEntity instanceof AbstractClientPlayer) { if (livingEntity instanceof AbstractClientPlayer abstractClientPlayer) {
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) livingEntity; final PlayerSkin playerSkin = abstractClientPlayer.getSkin();
if (abstractClientPlayer.isElytraLoaded() && abstractClientPlayer.getElytraTextureLocation() != null) { if (playerSkin.elytraTexture() != null) {
wingsTexture = abstractClientPlayer.getElytraTextureLocation(); wingsTexture = playerSkin.elytraTexture();
} else if (abstractClientPlayer.isCapeLoaded() && abstractClientPlayer.getCloakTextureLocation() != null && abstractClientPlayer } else if (playerSkin.capeTexture() != null && abstractClientPlayer.isModelPartShown(PlayerModelPart.CAPE)) {
.isModelPartShown(PlayerModelPart.CAPE)) { wingsTexture = playerSkin.capeTexture();
wingsTexture = abstractClientPlayer.getCloakTextureLocation();
} }
} }