51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.joml.Quaternionfc
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import com.mojang.math.Axis;
|
|
import net.minecraft.client.model.CodModel;
|
|
import net.minecraft.client.model.geom.ModelLayers;
|
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|
import net.minecraft.client.renderer.entity.MobRenderer;
|
|
import net.minecraft.client.renderer.entity.state.LivingEntityRenderState;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.world.entity.animal.Cod;
|
|
import org.joml.Quaternionfc;
|
|
|
|
public class CodRenderer
|
|
extends MobRenderer<Cod, LivingEntityRenderState, CodModel> {
|
|
private static final Identifier COD_LOCATION = Identifier.withDefaultNamespace("textures/entity/fish/cod.png");
|
|
|
|
public CodRenderer(EntityRendererProvider.Context context) {
|
|
super(context, new CodModel(context.bakeLayer(ModelLayers.COD)), 0.3f);
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTextureLocation(LivingEntityRenderState state) {
|
|
return COD_LOCATION;
|
|
}
|
|
|
|
@Override
|
|
public LivingEntityRenderState createRenderState() {
|
|
return new LivingEntityRenderState();
|
|
}
|
|
|
|
@Override
|
|
protected void setupRotations(LivingEntityRenderState state, PoseStack poseStack, float bodyRot, float entityScale) {
|
|
super.setupRotations(state, poseStack, bodyRot, entityScale);
|
|
float bodyZRot = 4.3f * Mth.sin(0.6f * state.ageInTicks);
|
|
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(bodyZRot));
|
|
if (!state.isInWater) {
|
|
poseStack.translate(0.1f, 0.1f, -0.1f);
|
|
poseStack.mulPose((Quaternionfc)Axis.ZP.rotationDegrees(90.0f));
|
|
}
|
|
}
|
|
}
|
|
|