59 lines
2.3 KiB
Java
59 lines
2.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import net.minecraft.client.model.EndermanModel;
|
|
import net.minecraft.client.model.geom.ModelLayers;
|
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
|
|
import net.minecraft.client.renderer.entity.MobRenderer;
|
|
import net.minecraft.client.renderer.entity.layers.CarriedBlockLayer;
|
|
import net.minecraft.client.renderer.entity.layers.EnderEyesLayer;
|
|
import net.minecraft.client.renderer.entity.state.EndermanRenderState;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.world.entity.monster.EnderMan;
|
|
import net.minecraft.world.phys.Vec3;
|
|
|
|
public class EndermanRenderer
|
|
extends MobRenderer<EnderMan, EndermanRenderState, EndermanModel<EndermanRenderState>> {
|
|
private static final Identifier ENDERMAN_LOCATION = Identifier.withDefaultNamespace("textures/entity/enderman/enderman.png");
|
|
private final RandomSource random = RandomSource.create();
|
|
|
|
public EndermanRenderer(EntityRendererProvider.Context context) {
|
|
super(context, new EndermanModel(context.bakeLayer(ModelLayers.ENDERMAN)), 0.5f);
|
|
this.addLayer(new EnderEyesLayer(this));
|
|
this.addLayer(new CarriedBlockLayer(this, context.getBlockRenderDispatcher()));
|
|
}
|
|
|
|
@Override
|
|
public Vec3 getRenderOffset(EndermanRenderState state) {
|
|
Vec3 offset = super.getRenderOffset(state);
|
|
if (state.isCreepy) {
|
|
double d = 0.02 * (double)state.scale;
|
|
return offset.add(this.random.nextGaussian() * d, 0.0, this.random.nextGaussian() * d);
|
|
}
|
|
return offset;
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTextureLocation(EndermanRenderState state) {
|
|
return ENDERMAN_LOCATION;
|
|
}
|
|
|
|
@Override
|
|
public EndermanRenderState createRenderState() {
|
|
return new EndermanRenderState();
|
|
}
|
|
|
|
@Override
|
|
public void extractRenderState(EnderMan entity, EndermanRenderState state, float partialTicks) {
|
|
super.extractRenderState(entity, state, partialTicks);
|
|
HumanoidMobRenderer.extractHumanoidRenderState(entity, state, partialTicks, this.itemModelResolver);
|
|
state.isCreepy = entity.isCreepy();
|
|
state.carriedBlock = entity.getCarriedBlock();
|
|
}
|
|
}
|
|
|