ParrotRenderer .java

net.minecraft.client.renderer.entity.ParrotRenderer (class, 52 lines): members: getVariantTexture, YELLOW_BLUE, RED_BLUE, GREY, GREEN, BLUE. imports: Mth.

net.minecraft.client.renderer.entityclass52 linesclientextends MobRenderer<Parrot2.2 KB

API Surface (4)

Identifier getTextureLocation(final ParrotRenderState state)
ParrotRenderState createRenderState()
void extractRenderState(final Parrot entity, final ParrotRenderState state, final float partialTicks)
Identifier getVariantTexture(final Variant variant)

Fields & Constants (5)

RED_BLUE
BLUE
GREEN
YELLOW_BLUE
GREY

String literals (5)

"textures/entity/parrot/parrot_red_blue.png"
"textures/entity/parrot/parrot_blue.png"
"textures/entity/parrot/parrot_green.png"
"textures/entity/parrot/parrot_yellow_blue.png"
"textures/entity/parrot/parrot_grey.png"

Full Source

ParrotRenderer.java52 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.entity;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.model.animal.parrot.ParrotModel;
6
import net.minecraft.client.model.geom.ModelLayers;
7
import net.minecraft.client.renderer.entity.state.ParrotRenderState;
8
import net.minecraft.resources.Identifier;
9
import net.minecraft.util.Mth;
10
import net.minecraft.world.entity.animal.parrot.Parrot;
11
import net.minecraft.world.entity.animal.parrot.Parrot.Variant;
12
13
@Environment(EnvType.CLIENT)
14
public class ParrotRenderer extends MobRenderer<Parrot, ParrotRenderState, ParrotModel> {
15
	private static final Identifier RED_BLUE = Identifier.withDefaultNamespace("textures/entity/parrot/parrot_red_blue.png");
16
	private static final Identifier BLUE = Identifier.withDefaultNamespace("textures/entity/parrot/parrot_blue.png");
17
	private static final Identifier GREEN = Identifier.withDefaultNamespace("textures/entity/parrot/parrot_green.png");
18
	private static final Identifier YELLOW_BLUE = Identifier.withDefaultNamespace("textures/entity/parrot/parrot_yellow_blue.png");
19
	private static final Identifier GREY = Identifier.withDefaultNamespace("textures/entity/parrot/parrot_grey.png");
20
21
	public ParrotRenderer(final EntityRendererProvider.Context context) {
22
		super(context, new ParrotModel(context.bakeLayer(ModelLayers.PARROT)), 0.3F);
23
	}
24
25
	public Identifier getTextureLocation(final ParrotRenderState state) {
26
		return getVariantTexture(state.variant);
27
	}
28
29
	public ParrotRenderState createRenderState() {
30
		return new ParrotRenderState();
31
	}
32
33
	public void extractRenderState(final Parrot entity, final ParrotRenderState state, final float partialTicks) {
34
		super.extractRenderState(entity, state, partialTicks);
35
		state.variant = entity.getVariant();
36
		float flap = Mth.lerp(partialTicks, entity.oFlap, entity.flap);
37
		float flapSpeed = Mth.lerp(partialTicks, entity.oFlapSpeed, entity.flapSpeed);
38
		state.flapAngle = (Mth.sin(flap) + 1.0F) * flapSpeed;
39
		state.pose = ParrotModel.getPose(entity);
40
	}
41
42
	public static Identifier getVariantTexture(final Variant variant) {
43
		return switch (variant) {
44
			case RED_BLUE -> RED_BLUE;
45
			case BLUE -> BLUE;
46
			case GREEN -> GREEN;
47
			case YELLOW_BLUE -> YELLOW_BLUE;
48
			case GRAY -> GREY;
49
		};
50
	}
51
}
52

Decompiled Minecraft 26.3 source of ParrotRenderer (net/minecraft/client/renderer/entity/ParrotRenderer.java) with Mojang official mappings, stored verbatim on the site.