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

55 lines
2.4 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.ArrowModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.SubmitNodeCollector;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.state.ArrowRenderState;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.client.renderer.state.CameraRenderState;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import org.joml.Quaternionfc;
public abstract class ArrowRenderer<T extends AbstractArrow, S extends ArrowRenderState>
extends EntityRenderer<T, S> {
private final ArrowModel model;
public ArrowRenderer(EntityRendererProvider.Context context) {
super(context);
this.model = new ArrowModel(context.bakeLayer(ModelLayers.ARROW));
}
@Override
public void submit(S state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
poseStack.pushPose();
poseStack.mulPose((Quaternionfc)Axis.YP.rotationDegrees(((ArrowRenderState)state).yRot - 90.0f));
poseStack.mulPose((Quaternionfc)Axis.ZP.rotationDegrees(((ArrowRenderState)state).xRot));
submitNodeCollector.submitModel(this.model, state, poseStack, RenderTypes.entityCutout(this.getTextureLocation(state)), ((ArrowRenderState)state).lightCoords, OverlayTexture.NO_OVERLAY, ((ArrowRenderState)state).outlineColor, null);
poseStack.popPose();
super.submit(state, poseStack, submitNodeCollector, camera);
}
protected abstract Identifier getTextureLocation(S var1);
@Override
public void extractRenderState(T entity, S state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
((ArrowRenderState)state).xRot = ((Entity)entity).getXRot(partialTicks);
((ArrowRenderState)state).yRot = ((Entity)entity).getYRot(partialTicks);
((ArrowRenderState)state).shake = (float)((AbstractArrow)entity).shakeTime - partialTicks;
}
}