DolphinRenderer .java

net.minecraft.client.renderer.entity.DolphinRenderer (class): members: DOLPHIN_BABY_LOCATION, DOLPHIN_LOCATION, getTextureLocation, createRenderState.

net.minecraft.client.renderer.entityclass37 linesclientextends AgeableMobRenderer<Dolphin1.8 KB

API Surface (3)

Identifier getTextureLocation(final DolphinRenderState state)
DolphinRenderState createRenderState()
void extractRenderState(final Dolphin entity, final DolphinRenderState state, final float partialTicks)

Fields & Constants (2)

DOLPHIN_LOCATION
DOLPHIN_BABY_LOCATION

String literals (2)

"textures/entity/dolphin/dolphin.png"
"textures/entity/dolphin/dolphin_baby.png"

Full Source

DolphinRenderer.java37 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.dolphin.DolphinModel;
6
import net.minecraft.client.model.geom.ModelLayers;
7
import net.minecraft.client.renderer.entity.layers.DolphinCarryingItemLayer;
8
import net.minecraft.client.renderer.entity.state.DolphinRenderState;
9
import net.minecraft.client.renderer.entity.state.HoldingEntityRenderState;
10
import net.minecraft.resources.Identifier;
11
import net.minecraft.world.entity.animal.dolphin.Dolphin;
12
13
@Environment(EnvType.CLIENT)
14
public class DolphinRenderer extends AgeableMobRenderer<Dolphin, DolphinRenderState, DolphinModel> {
15
	private static final Identifier DOLPHIN_LOCATION = Identifier.withDefaultNamespace("textures/entity/dolphin/dolphin.png");
16
	private static final Identifier DOLPHIN_BABY_LOCATION = Identifier.withDefaultNamespace("textures/entity/dolphin/dolphin_baby.png");
17
18
	public DolphinRenderer(final EntityRendererProvider.Context context) {
19
		super(context, new DolphinModel(context.bakeLayer(ModelLayers.DOLPHIN)), new DolphinModel(context.bakeLayer(ModelLayers.DOLPHIN_BABY)), 0.7F);
20
		this.addLayer(new DolphinCarryingItemLayer(this));
21
	}
22
23
	public Identifier getTextureLocation(final DolphinRenderState state) {
24
		return state.isBaby ? DOLPHIN_BABY_LOCATION : DOLPHIN_LOCATION;
25
	}
26
27
	public DolphinRenderState createRenderState() {
28
		return new DolphinRenderState();
29
	}
30
31
	public void extractRenderState(final Dolphin entity, final DolphinRenderState state, final float partialTicks) {
32
		super.extractRenderState(entity, state, partialTicks);
33
		HoldingEntityRenderState.extractHoldingEntityRenderState(entity, state, this.itemModelResolver);
34
		state.isMoving = entity.getDeltaMovement().horizontalDistanceSqr() > 1.0E-7;
35
	}
36
}
37

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