content: package com.github.alexthe666.iceandfire.client.particle;
  
  import com.github.alexthe666.iceandfire.entity.EntityCockatrice;
  import com.mojang.blaze3d.vertex.PoseStack;
  import com.mojang.blaze3d.vertex.VertexConsumer;
  import com.mojang.math.Matrix3f;
  import com.mojang.math.Matrix4f;
  import com.mojang.math.Vector3f;
  import net.minecraft.client.renderer.MultiBufferSource;
  import net.minecraft.client.renderer.RenderType;
  import net.minecraft.client.renderer.texture.OverlayTexture;
  import net.minecraft.resources.ResourceLocation;
  import net.minecraft.util.Mth;
  import net.minecraft.world.entity.Entity;
  import net.minecraft.world.phys.Vec3;
  
  public class CockatriceBeamRender {
  
      public static final RenderType TEXTURE_BEAM = RenderType.entityCutoutNoCull(new ResourceLocation("iceandfire:textures/models/cockatrice/beam.png"));
  
      private static void vertex(VertexConsumer p_229108_0_, Matrix4f p_229108_1_, Matrix3f p_229108_2_, float p_229108_3_, float p_229108_4_, float p_229108_5_, int p_229108_6_, int p_229108_7_, int p_229108_8_, float p_229108_9_, float p_229108_10_) {
          p_229108_0_.vertex(p_229108_1_, p_229108_3_, p_229108_4_, p_229108_5_).color(p_229108_6_, p_229108_7_, p_229108_8_, 255).uv(p_229108_9_, p_229108_10_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(15728880).normal(p_229108_2_, 0.0F, 1.0F, 0.0F).endVertex();
      }
  
      public static void render(Entity entityIn, Entity targetEntity, PoseStack matrixStackIn, MultiBufferSource bufferIn, float partialTicks) {
          float f = 1;
          if (entityIn instanceof EntityCockatrice)
              f = (((EntityCockatrice) entityIn).getAttackAnimationScale(partialTicks));
  
          float f1 = (float) entityIn.level.getGameTime() + partialTicks;
          float f2 = f1 * 0.5F % 1.0F;
          float f3 = entityIn.getEyeHeight();
          matrixStackIn.pushPose();
          matrixStackIn.translate(0.0D, f3, 0.0D);
          Vec3 Vector3d = getPosition(targetEntity, (double) targetEntity.getBbHeight() * 0.5D, partialTicks);
          Vec3 Vector3d1 = getPosition(entityIn, f3, partialTicks);
          Vec3 Vector3d2 = Vector3d.subtract(Vector3d1);
          float f4 = (float) (Vector3d2.length() + 1.0D);
          Vector3d2 = Vector3d2.normalize();
          float f5 = (float) Math.acos(Vector3d2.y);
          float f6 = (float) Math.atan2(Vector3d2.z, Vector3d2.x);
          matrixStackIn.mulPose(Vector3f.YP.rotationDegrees((((float) Math.PI / 2F) - f6) * (180F / (float) Math.PI)));
          matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(f5 * (180F / (float) Math.PI)));
          int i = 1;
          float f7 = f1 * 0.05F * -1.5F;
          float f8 = f * f;
          int j = 64 + (int) (f8 * 191.0F);
          int k = 32 + (int) (f8 * 191.0F);
          int l = 128 - (int) (f8 * 64.0F);
          float f9 = 0.2F;
          float f10 = 0.282F;
          float f11 = Mth.cos(f7 + 2.3561945F) * 0.282F;
          float f12 = Mth.sin(f7 + 2.3561945F) * 0.282F;
          float f13 = Mth.cos(f7 + ((float) Math.PI / 4F)) * 0.282F;
          float f14 = Mth.sin(f7 + ((float) Math.PI / 4F)) * 0.282F;
          float f15 = Mth.cos(f7 + 3.926991F) * 0.282F;
          float f16 = Mth.sin(f7 + 3.926991F) * 0.282F;
          float f17 = Mth.cos(f7 + 5.4977875F) * 0.282F;
          float f18 = Mth.sin(f7 + 5.4977875F) * 0.282F;
          float f19 = Mth.cos(f7 + (float) Math.PI) * 0.2F;
          float f20 = Mth.sin(f7 + (float) Math.PI) * 0.2F;
          float f21 = Mth.cos(f7 + 0.0F) * 0.2F;
          float f22 = Mth.sin(f7 + 0.0F) * 0.2F;
          float f23 = Mth.cos(f7 + ((float) Math.PI / 2F)) * 0.2F;
          float f24 = Mth.sin(f7 + ((float) Math.PI / 2F)) * 0.2F;
          float f25 = Mth.cos(f7 + ((float) Math.PI * 1.5F)) * 0.2F;
          float f26 = Mth.sin(f7 + ((float) Math.PI * 1.5F)) * 0.2F;
          float f27 = 0.0F;
          float f28 = 0.4999F;
          float f29 = -1.0F + f2;
          float f30 = f4 * 2.5F + f29;
          VertexConsumer ivertexbuilder = bufferIn.getBuffer(TEXTURE_BEAM);
          PoseStack.Pose matrixstack$entry = matrixStackIn.last();
          Matrix4f matrix4f = matrixstack$entry.pose();
          Matrix3f matrix3f = matrixstack$entry.normal();
          vertex(ivertexbuilder, matrix4f, matrix3f, f19, f4, f20, j, k, l, 0.4999F, f30);
          vertex(ivertexbuilder, matrix4f, matrix3f, f19, 0.0F, f20, j, k, l, 0.4999F, f29);
          vertex(ivertexbuilder, matrix4f, matrix3f, f21, 0.0F, f22, j, k, l, 0.0F, f29);
          vertex(ivertexbuilder, matrix4f, matrix3f, f21, f4, f22, j, k, l, 0.0F, f30);
          vertex(ivertexbuilder, matrix4f, matrix3f, f23, f4, f24, j, k, l, 0.4999F, f30);
          vertex(ivertexbuilder, matrix4f, matrix3f, f23, 0.0F, f24, j, k, l, 0.4999F, f29);
          vertex(ivertexbuilder, matrix4f, matrix3f, f25, 0.0F, f26, j, k, l, 0.0F, f29);
          vertex(ivertexbuilder, matrix4f, matrix3f, f25, f4, f26, j, k, l, 0.0F, f30);
          float f31 = 0.0F;
          if (entityIn.tickCount % 2 == 0) {
              f31 = 0.5F;
          }
  
          vertex(ivertexbuilder, matrix4f, matrix3f, f11, f4, f12, j, k, l, 0.5F, f31 + 0.5F);
          vertex(ivertexbuilder, matrix4f, matrix3f, f13, f4, f14, j, k, l, 1.0F, f31 + 0.5F);
          vertex(ivertexbuilder, matrix4f, matrix3f, f17, f4, f18, j, k, l, 1.0F, f31);
          vertex(ivertexbuilder, matrix4f, matrix3f, f15, f4, f16, j, k, l, 0.5F, f31);
          matrixStackIn.popPose();
      }
  
      private static Vec3 getPosition(Entity LivingEntityIn, double p_177110_2_, float p_177110_4_) {
          double d0 = LivingEntityIn.xOld + (LivingEntityIn.getX() - LivingEntityIn.xOld) * (double) p_177110_4_;
          double d1 = p_177110_2_ + LivingEntityIn.yOld + (LivingEntityIn.getY() - LivingEntityIn.yOld) * (double) p_177110_4_;
          double d2 = LivingEntityIn.zOld + (LivingEntityIn.getZ() - LivingEntityIn.zOld) * (double) p_177110_4_;
          return new Vec3(d0, d1, d2);
      }
  
  }
  