diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-09-14 20:19:35 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-09-14 20:19:35 +0300 |
commit | bfa600f2829a29b77c90063041a9db057aa70b14 (patch) | |
tree | 3dd05c97ee8995c2f2002988dd766f0e8ec80c4b /src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra | |
parent | b84a1aa3afe1b917b10157ba5af7843873fe6af0 (diff) | |
download | CITResewn-bfa600f2829a29b77c90063041a9db057aa70b14.tar.gz CITResewn-bfa600f2829a29b77c90063041a9db057aa70b14.tar.bz2 CITResewn-bfa600f2829a29b77c90063041a9db057aa70b14.zip |
Fixed bug with Cosmetic Armor support
Closes #23
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra/ElytraFeatureRendererMixin.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra/ElytraFeatureRendererMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra/ElytraFeatureRendererMixin.java index b5ef126..2214598 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra/ElytraFeatureRendererMixin.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/citelytra/ElytraFeatureRendererMixin.java @@ -7,6 +7,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -32,7 +33,7 @@ public class ElytraFeatureRendererMixin { ItemStack itemStack = livingEntity.getEquippedStack(EquipmentSlot.CHEST); //compat Cosmetic Armor - itemStack = OptionalCompat.getCosmeticArmor(itemStack, livingEntity, EquipmentSlot.CHEST); + itemStack = OptionalCompat.getCosmeticArmor(itemStack, livingEntity, EquipmentSlot.CHEST, true); this.elytraItemCached = new WeakReference<>(itemStack); this.livingEntityCached = new WeakReference<>(livingEntity); @@ -44,9 +45,11 @@ public class ElytraFeatureRendererMixin { return RenderLayer.getArmorCutoutNoCull(originalIdentifier); ItemStack itemStack = this.elytraItemCached.get(); - LivingEntity livingEntity = livingEntityCached.get(); - if (itemStack != null && livingEntity != null) { + LivingEntity livingEntity = this.livingEntityCached.get(); + if (itemStack != null && itemStack.isOf(Items.ELYTRA) && livingEntity != null) { Identifier elytraTexture = CITResewn.INSTANCE.activeCITs.getElytraTexture(itemStack, livingEntity.world, livingEntity); + this.elytraItemCached = new WeakReference<>(null); + this.livingEntityCached = new WeakReference<>(null); if (elytraTexture != null) return RenderLayer.getArmorCutoutNoCull(elytraTexture); } |