2025-11-24 22:52:51 +03:00

53 lines
2.1 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.BoatModel;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.entity.AbstractBoatRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.state.BoatRenderState;
import net.minecraft.client.renderer.rendertype.RenderType;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.Identifier;
import net.minecraft.util.Unit;
public class BoatRenderer
extends AbstractBoatRenderer {
private final Model.Simple waterPatchModel;
private final Identifier texture;
private final EntityModel<BoatRenderState> model;
public BoatRenderer(EntityRendererProvider.Context context, ModelLayerLocation modelId) {
super(context);
this.texture = modelId.model().withPath(p -> "textures/entity/" + p + ".png");
this.waterPatchModel = new Model.Simple(context.bakeLayer(ModelLayers.BOAT_WATER_PATCH), t -> RenderTypes.waterMask());
this.model = new BoatModel(context.bakeLayer(modelId));
}
@Override
protected EntityModel<BoatRenderState> model() {
return this.model;
}
@Override
protected RenderType renderType() {
return this.model.renderType(this.texture);
}
@Override
protected void submitTypeAdditions(BoatRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords) {
if (!state.isUnderWater) {
submitNodeCollector.submitModel(this.waterPatchModel, Unit.INSTANCE, poseStack, this.waterPatchModel.renderType(this.texture), lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor, null);
}
}
}