/* * Decompiled with CFR 0.152. */ package net.minecraft.client.renderer.entity; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.ZombieModel; import net.minecraft.client.renderer.entity.ArmorModelSet; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.HumanoidMobRenderer; import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.state.ZombieRenderState; import net.minecraft.core.component.DataComponents; import net.minecraft.resources.Identifier; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.item.SwingAnimationType; import net.minecraft.world.item.component.SwingAnimation; public abstract class AbstractZombieRenderer> extends HumanoidMobRenderer { private static final Identifier ZOMBIE_LOCATION = Identifier.withDefaultNamespace("textures/entity/zombie/zombie.png"); protected AbstractZombieRenderer(EntityRendererProvider.Context context, M model, M babyModel, ArmorModelSet armorSet, ArmorModelSet babyArmorSet) { super(context, model, babyModel, 0.5f); this.addLayer(new HumanoidArmorLayer(this, armorSet, babyArmorSet, context.getEquipmentRenderer())); } @Override public Identifier getTextureLocation(S state) { return ZOMBIE_LOCATION; } @Override public void extractRenderState(T entity, S state, float partialTicks) { super.extractRenderState(entity, state, partialTicks); ((ZombieRenderState)state).isAggressive = ((Mob)entity).isAggressive(); ((ZombieRenderState)state).isConverting = ((Zombie)entity).isUnderWaterConverting(); } @Override protected boolean isShaking(S state) { return super.isShaking(state) || ((ZombieRenderState)state).isConverting; } @Override protected HumanoidModel.ArmPose getArmPose(T mob, HumanoidArm arm) { SwingAnimation otherAnim = ((LivingEntity)mob).getItemHeldByArm(arm.getOpposite()).get(DataComponents.SWING_ANIMATION); if (otherAnim != null && otherAnim.type() == SwingAnimationType.STAB) { return HumanoidModel.ArmPose.SPEAR; } return super.getArmPose(mob, arm); } }