pureppecat

yar

Dec 11th, 2024 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.37 KB | None | 0 0
  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by FernFlower decompiler)
  4. //
  5.  
  6. package net.minecraft.client.renderer.entity;
  7.  
  8. import com.mojang.blaze3d.vertex.PoseStack;
  9. import com.mojang.math.Axis;
  10. import javax.annotation.Nullable;
  11. import net.minecraft.client.model.ArmorStandArmorModel;
  12. import net.minecraft.client.model.ArmorStandModel;
  13. import net.minecraft.client.model.geom.ModelLayers;
  14. import net.minecraft.client.renderer.RenderType;
  15. import net.minecraft.client.renderer.entity.layers.CustomHeadLayer;
  16. import net.minecraft.client.renderer.entity.layers.ElytraLayer;
  17. import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
  18. import net.minecraft.client.renderer.entity.layers.ItemInHandLayer;
  19. import net.minecraft.resources.ResourceLocation;
  20. import net.minecraft.util.Mth;
  21. import net.minecraft.world.entity.decoration.ArmorStand;
  22. import net.neoforged.api.distmarker.Dist;
  23. import net.neoforged.api.distmarker.OnlyIn;
  24.  
  25. @OnlyIn(Dist.CLIENT)
  26. public class ArmorStandRenderer extends LivingEntityRenderer<ArmorStand, ArmorStandArmorModel> {
  27.     public static final ResourceLocation DEFAULT_SKIN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/armorstand/wood.png");
  28.  
  29.     public ArmorStandRenderer(EntityRendererProvider.Context p_173915_) {
  30.         super(p_173915_, new ArmorStandModel(p_173915_.bakeLayer(ModelLayers.ARMOR_STAND)), 0.0F);
  31.         this.addLayer(new HumanoidArmorLayer(this, new ArmorStandArmorModel(p_173915_.bakeLayer(ModelLayers.ARMOR_STAND_INNER_ARMOR)), new ArmorStandArmorModel(p_173915_.bakeLayer(ModelLayers.ARMOR_STAND_OUTER_ARMOR)), p_173915_.getModelManager()));
  32.         this.addLayer(new ItemInHandLayer(this, p_173915_.getItemInHandRenderer()));
  33.         this.addLayer(new ElytraLayer(this, p_173915_.getModelSet()));
  34.         this.addLayer(new CustomHeadLayer(this, p_173915_.getModelSet(), p_173915_.getItemInHandRenderer()));
  35.     }
  36.  
  37.     public ResourceLocation getTextureLocation(ArmorStand p_113798_) {
  38.         return DEFAULT_SKIN_LOCATION;
  39.     }
  40.  
  41.     protected void setupRotations(ArmorStand p_113800_, PoseStack p_113801_, float p_113802_, float p_113803_, float p_113804_, float p_319811_) {
  42.         p_113801_.mulPose(Axis.YP.rotationDegrees(180.0F - p_113803_));
  43.         float f = (float)(p_113800_.level().getGameTime() - p_113800_.lastHit) + p_113804_;
  44.         if (f < 5.0F) {
  45.             p_113801_.mulPose(Axis.YP.rotationDegrees(Mth.sin(f / 1.5F * 3.1415927F) * 3.0F));
  46.         }
  47.  
  48.     }
  49.  
  50.     protected boolean shouldShowName(ArmorStand p_113815_) {
  51.         double d0 = this.entityRenderDispatcher.distanceToSqr(p_113815_);
  52.         float f = p_113815_.isCrouching() ? 32.0F : 64.0F;
  53.         return d0 >= (double)(f * f) ? false : p_113815_.isCustomNameVisible();
  54.     }
  55.  
  56.     @Nullable
  57.     protected RenderType getRenderType(ArmorStand p_113806_, boolean p_113807_, boolean p_113808_, boolean p_113809_) {
  58.         if (!p_113806_.isMarker()) {
  59.             return super.getRenderType(p_113806_, p_113807_, p_113808_, p_113809_);
  60.         } else {
  61.             ResourceLocation resourcelocation = this.getTextureLocation(p_113806_);
  62.             if (p_113808_) {
  63.                 return RenderType.entityTranslucent(resourcelocation, false);
  64.             } else {
  65.                 return p_113807_ ? RenderType.entityCutoutNoCull(resourcelocation, false) : null;
  66.             }
  67.         }
  68.     }
  69. }
  70.  
Add Comment
Please, Sign In to add comment