minecraft-src/net/minecraft/client/renderer/entity/SquidRenderer.java
2025-07-04 01:41:11 +03:00

43 lines
1.6 KiB
Java

package net.minecraft.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.SquidModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.animal.Squid;
@Environment(EnvType.CLIENT)
public class SquidRenderer<T extends Squid> extends MobRenderer<T, SquidModel<T>> {
private static final ResourceLocation SQUID_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/squid/squid.png");
public SquidRenderer(EntityRendererProvider.Context context, SquidModel<T> model) {
super(context, model, 0.7F);
}
/**
* Returns the location of an entity's texture.
*/
public ResourceLocation getTextureLocation(T entity) {
return SQUID_LOCATION;
}
protected void setupRotations(T entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) {
float f = Mth.lerp(partialTick, entity.xBodyRotO, entity.xBodyRot);
float g = Mth.lerp(partialTick, entity.zBodyRotO, entity.zBodyRot);
poseStack.translate(0.0F, 0.5F, 0.0F);
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - yBodyRot));
poseStack.mulPose(Axis.XP.rotationDegrees(f));
poseStack.mulPose(Axis.YP.rotationDegrees(g));
poseStack.translate(0.0F, -1.2F, 0.0F);
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float getBob(T livingBase, float partialTicks) {
return Mth.lerp(partialTicks, livingBase.oldTentacleAngle, livingBase.tentacleAngle);
}
}