package com.radon.naruto_universe.client.entity;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import com.radon.naruto_universe.entity.projectile.FireBulletProjectile;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
public class FireBulletRenderer extends EntityRenderer<FireBulletProjectile> {
public FireBulletRenderer(EntityRendererProvider.Context context) {
super(context);
}
@Override
public void render(FireBulletProjectile entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) {
poseStack.pushPose();
float quadSize = 10.0F;
poseStack.scale(quadSize, quadSize, quadSize);
poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation());
poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F));
int lightColor = 15728640;
VertexConsumer consumer = buffer.getBuffer(RenderTypeRegistry.FIREBALL_RENDER);
float U0 = 0.0F;
float U1 = 1.0F;
float V0 = 0.0F;
float V1 = 1.0F;
Vec3 position = this.entityRenderDispatcher.camera.getPosition();
float x = (float)(Mth.lerp(partialTicks, entity.xo, entity.getX()) - position.x());
float y = (float)(Mth.lerp(partialTicks, entity.yo, entity.getY()) - position.y());
float z = (float)(Mth.lerp(partialTicks, entity.zo, entity.getZ()) - position.z());
consumer.vertex(poseStack.last().pose(), x, y, z).uv(U1, V1).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
consumer.vertex(poseStack.last().pose(), x, y, z).uv(U1, V0).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
consumer.vertex(poseStack.last().pose(), x, y, z).uv(U0, V0).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
consumer.vertex(poseStack.last().pose(), x, y, z).uv(U0, V1).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
poseStack.popPose();
}
@Override
public ResourceLocation getTextureLocation(FireBulletProjectile pEntity) {
return null;
}
}