AbstractBoatModel .java

net.minecraft.client.model.object.boat.AbstractBoatModel (class): members: rightPaddle, leftPaddle, setupAnim. strings: "right_paddle", "left_paddle".

net.minecraft.client.model.object.boatclass35 linesclientextends EntityModel<BoatRenderState>1.2 KB

API Surface (1)

void setupAnim(final BoatRenderState state)

Fields & Constants (2)

leftPaddle
rightPaddle

String literals (2)

"left_paddle"
"right_paddle"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

AbstractBoatModel.java35 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.object.boat;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.model.EntityModel;
6
import net.minecraft.client.model.geom.ModelPart;
7
import net.minecraft.client.renderer.entity.state.BoatRenderState;
8
import net.minecraft.util.Mth;
9
10
@Environment(EnvType.CLIENT)
11
public abstract class AbstractBoatModel extends EntityModel<BoatRenderState> {
12
	private final ModelPart leftPaddle;
13
	private final ModelPart rightPaddle;
14
15
	public AbstractBoatModel(final ModelPart root) {
16
		super(root);
17
		this.leftPaddle = root.getChild("left_paddle");
18
		this.rightPaddle = root.getChild("right_paddle");
19
	}
20
21
	public void setupAnim(final BoatRenderState state) {
22
		super.setupAnim(state);
23
		animatePaddle(state.rowingTimeLeft, 0, this.leftPaddle);
24
		animatePaddle(state.rowingTimeRight, 1, this.rightPaddle);
25
	}
26
27
	private static void animatePaddle(final float time, final int side, final ModelPart paddle) {
28
		paddle.xRot = Mth.clampedLerp((Mth.sin(-time) + 1.0F) / 2.0F, (float) (-Math.PI / 3), (float) (-Math.PI / 12));
29
		paddle.yRot = Mth.clampedLerp((Mth.sin(-time + 1.0F) + 1.0F) / 2.0F, (float) (-Math.PI / 4), (float) (Math.PI / 4));
30
		if (side == 1) {
31
			paddle.yRot = (float) Math.PI - paddle.yRot;
32
		}
33
	}
34
}
35

Decompiled Minecraft 26.3 source of AbstractBoatModel (net/minecraft/client/model/object/boat/AbstractBoatModel.java) with Mojang official mappings, stored verbatim on the site.