/* * Decompiled with CFR 0.152. */ package net.minecraft.client.renderer.entity; import net.minecraft.client.model.CamelModel; import net.minecraft.client.model.CamelSaddleModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.entity.AgeableMobRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.layers.SimpleEquipmentLayer; import net.minecraft.client.renderer.entity.state.CamelRenderState; import net.minecraft.client.resources.model.EquipmentClientInfo; import net.minecraft.resources.Identifier; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.animal.camel.Camel; public class CamelRenderer extends AgeableMobRenderer { private static final Identifier CAMEL_LOCATION = Identifier.withDefaultNamespace("textures/entity/camel/camel.png"); public CamelRenderer(EntityRendererProvider.Context context) { super(context, new CamelModel(context.bakeLayer(ModelLayers.CAMEL)), new CamelModel(context.bakeLayer(ModelLayers.CAMEL_BABY)), 0.7f); this.addLayer(this.createCamelSaddleLayer(context)); } protected SimpleEquipmentLayer createCamelSaddleLayer(EntityRendererProvider.Context context) { return new SimpleEquipmentLayer(this, context.getEquipmentRenderer(), EquipmentClientInfo.LayerType.CAMEL_SADDLE, state -> state.saddle, new CamelSaddleModel(context.bakeLayer(ModelLayers.CAMEL_SADDLE)), new CamelSaddleModel(context.bakeLayer(ModelLayers.CAMEL_BABY_SADDLE))); } @Override public Identifier getTextureLocation(CamelRenderState state) { return CAMEL_LOCATION; } @Override public CamelRenderState createRenderState() { return new CamelRenderState(); } @Override public void extractRenderState(Camel entity, CamelRenderState state, float partialTicks) { super.extractRenderState(entity, state, partialTicks); state.saddle = entity.getItemBySlot(EquipmentSlot.SADDLE).copy(); state.isRidden = entity.isVehicle(); state.jumpCooldown = Math.max((float)entity.getJumpCooldown() - partialTicks, 0.0f); state.sitAnimationState.copyFrom(entity.sitAnimationState); state.sitPoseAnimationState.copyFrom(entity.sitPoseAnimationState); state.sitUpAnimationState.copyFrom(entity.sitUpAnimationState); state.idleAnimationState.copyFrom(entity.idleAnimationState); state.dashAnimationState.copyFrom(entity.dashAnimationState); } }