Untitled

mail@pastecode.io avatar
unknown
java
3 years ago
2.1 kB
2
Indexable
Never
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 = 2.5F;

        poseStack.scale(quadSize, quadSize, quadSize);
        poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation());
        poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F));

        int lightColor = 15728640;

        float U0 = 0.0F;
        float U1 = 1.0F;
        float V0 = 0.0F;
        float V1 = 1.0F;

        VertexConsumer consumer = buffer.getBuffer(RenderTypeRegistry.FIREBALL_RENDER);

        consumer.vertex(poseStack.last().pose(), -1.0F, -1.0F, 0.0F).uv(U1, V1).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
        consumer.vertex(poseStack.last().pose(), -1.0F, 1.0F, 0.0F).uv(U1, V0).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
        consumer.vertex(poseStack.last().pose(), 1.0F, 1.0F, 0.0F).uv(U0, V0).color(1.0F, 0.5F, 0.0F, 1.0F).uv2(lightColor).endVertex();
        consumer.vertex(poseStack.last().pose(), 1.0F, -1.0F, 0.0F).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;
    }
}