SquidRenderer .java

net.minecraft.client.renderer.entity.SquidRenderer (class): members: SQUID_BABY_LOCATION, SQUID_LOCATION, setupRotations, getTextureLocation. imports: Mth.

net.minecraft.client.renderer.entityclass45 linesclientextends Squid>2.0 KB

API Surface (4)

Identifier getTextureLocation(final SquidRenderState state)
SquidRenderState createRenderState()
void extractRenderState(final T entity, final SquidRenderState state, final float partialTicks)
void setupRotations(final SquidRenderState state, final PoseStack poseStack, final float bodyRot, final float entityScale)

Fields & Constants (2)

SQUID_LOCATION
SQUID_BABY_LOCATION

String literals (2)

"textures/entity/squid/squid.png"
"textures/entity/squid/squid_baby.png"

Full Source

SquidRenderer.java45 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.entity;
2
3
import com.mojang.blaze3d.vertex.PoseStack;
4
import com.mojang.math.Axis;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.client.model.animal.squid.SquidModel;
8
import net.minecraft.client.renderer.entity.state.SquidRenderState;
9
import net.minecraft.resources.Identifier;
10
import net.minecraft.util.Mth;
11
import net.minecraft.world.entity.animal.squid.Squid;
12
13
@Environment(EnvType.CLIENT)
14
public class SquidRenderer<T extends Squid> extends AgeableMobRenderer<T, SquidRenderState, SquidModel> {
15
	private static final Identifier SQUID_LOCATION = Identifier.withDefaultNamespace("textures/entity/squid/squid.png");
16
	private static final Identifier SQUID_BABY_LOCATION = Identifier.withDefaultNamespace("textures/entity/squid/squid_baby.png");
17
18
	public SquidRenderer(final EntityRendererProvider.Context context, final SquidModel model, final SquidModel babyModel) {
19
		super(context, model, babyModel, 0.7F);
20
	}
21
22
	public Identifier getTextureLocation(final SquidRenderState state) {
23
		return state.isBaby ? SQUID_BABY_LOCATION : SQUID_LOCATION;
24
	}
25
26
	public SquidRenderState createRenderState() {
27
		return new SquidRenderState();
28
	}
29
30
	public void extractRenderState(final T entity, final SquidRenderState state, final float partialTicks) {
31
		super.extractRenderState(entity, state, partialTicks);
32
		state.tentacleAngle = Mth.lerp(partialTicks, entity.oldTentacleAngle, entity.tentacleAngle);
33
		state.xBodyRot = Mth.lerp(partialTicks, entity.xBodyRotO, entity.xBodyRot);
34
		state.zBodyRot = Mth.lerp(partialTicks, entity.zBodyRotO, entity.zBodyRot);
35
	}
36
37
	protected void setupRotations(final SquidRenderState state, final PoseStack poseStack, final float bodyRot, final float entityScale) {
38
		poseStack.translate(0.0F, state.isBaby ? 0.25F : 0.5F, 0.0F);
39
		poseStack.rotateDegrees(Axis.YP, 180.0F - bodyRot);
40
		poseStack.rotateDegrees(Axis.XP, state.xBodyRot);
41
		poseStack.rotateDegrees(Axis.YP, state.zBodyRot);
42
		poseStack.translate(0.0F, state.isBaby ? -0.6F : -1.2F, 0.0F);
43
	}
44
}
45

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