minecraft-src/net/minecraft/client/renderer/entity/VexRenderer.java
2025-07-04 02:49:36 +03:00

39 lines
1.6 KiB
Java

package net.minecraft.client.renderer.entity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.VexModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.layers.ItemInHandLayer;
import net.minecraft.client.renderer.entity.state.VexRenderState;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.monster.Vex;
@Environment(EnvType.CLIENT)
public class VexRenderer extends MobRenderer<Vex, VexRenderState, VexModel> {
private static final ResourceLocation VEX_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/vex.png");
private static final ResourceLocation VEX_CHARGING_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/illager/vex_charging.png");
public VexRenderer(EntityRendererProvider.Context context) {
super(context, new VexModel(context.bakeLayer(ModelLayers.VEX)), 0.3F);
this.addLayer(new ItemInHandLayer<>(this, context.getItemRenderer()));
}
protected int getBlockLightLevel(Vex entity, BlockPos pos) {
return 15;
}
public ResourceLocation getTextureLocation(VexRenderState renderState) {
return renderState.isCharging ? VEX_CHARGING_LOCATION : VEX_LOCATION;
}
public VexRenderState createRenderState() {
return new VexRenderState();
}
public void extractRenderState(Vex entity, VexRenderState reusedState, float partialTick) {
super.extractRenderState(entity, reusedState, partialTick);
reusedState.isCharging = entity.isCharging();
}
}