2025-11-24 22:52:51 +03:00

45 lines
1.9 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.renderer.entity;
import net.minecraft.client.model.VillagerModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.layers.CrossedArmsItemLayer;
import net.minecraft.client.renderer.entity.layers.CustomHeadLayer;
import net.minecraft.client.renderer.entity.state.HoldingEntityRenderState;
import net.minecraft.client.renderer.entity.state.VillagerRenderState;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.npc.WanderingTrader;
public class WanderingTraderRenderer
extends MobRenderer<WanderingTrader, VillagerRenderState, VillagerModel> {
private static final Identifier VILLAGER_BASE_SKIN = Identifier.withDefaultNamespace("textures/entity/wandering_trader.png");
public WanderingTraderRenderer(EntityRendererProvider.Context context) {
super(context, new VillagerModel(context.bakeLayer(ModelLayers.WANDERING_TRADER)), 0.5f);
this.addLayer(new CustomHeadLayer<VillagerRenderState, VillagerModel>(this, context.getModelSet(), context.getPlayerSkinRenderCache()));
this.addLayer(new CrossedArmsItemLayer<VillagerRenderState, VillagerModel>(this));
}
@Override
public Identifier getTextureLocation(VillagerRenderState state) {
return VILLAGER_BASE_SKIN;
}
@Override
public VillagerRenderState createRenderState() {
return new VillagerRenderState();
}
@Override
public void extractRenderState(WanderingTrader entity, VillagerRenderState state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
HoldingEntityRenderState.extractHoldingEntityRenderState(entity, state, this.itemModelResolver);
state.isUnhappy = entity.getUnhappyCounter() > 0;
}
}