Advertisement
Guest User

Untitled

a guest
Aug 16th, 2021
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. @OnlyIn(Dist.CLIENT)
  2. public class EndSlashRenderer extends EntityRenderer<EndSlashEntity>
  3. {
  4.     private static final ResourceLocation END_SLASH_TEXTURE = new ResourceLocation("projectdawn:textures/items/projectile/slash.png");
  5.     private static final RenderType end_slash_render = RenderType.entityCutoutNoCull(END_SLASH_TEXTURE);
  6.  
  7.     public EndSlashRenderer(EntityRendererManager renderManagerIn) {
  8.         super(renderManagerIn);
  9.     }
  10.  
  11.     public void render(EndSlashEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
  12.         matrixStackIn.pushPose();
  13.         matrixStackIn.scale(1.50F, 1.50F, 1.50F);
  14.         matrixStackIn.translate(0, -0.3D, 0);
  15.         matrixStackIn.mulPose(this.entityRenderDispatcher.cameraOrientation());
  16.         matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(180.0F));
  17.         matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(-45.0F));
  18.         MatrixStack.Entry matrixstack = matrixStackIn.last();
  19.         Matrix4f matrix4f = matrixstack.pose();
  20.         Matrix3f matrix3f = matrixstack.normal();
  21.         IVertexBuilder ivertexbuilder = bufferIn.getBuffer(end_slash_render);
  22.         render(ivertexbuilder, matrix4f, matrix3f, packedLightIn, 0.0F, 0, 0, 1);
  23.         render(ivertexbuilder, matrix4f, matrix3f, packedLightIn, 1.0F, 0, 1, 1);
  24.         render(ivertexbuilder, matrix4f, matrix3f, packedLightIn, 1.0F, 1, 1, 0);
  25.         render(ivertexbuilder, matrix4f, matrix3f, packedLightIn, 0.0F, 1, 0, 0);
  26.         matrixStackIn.popPose();
  27.         super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
  28.     }
  29.  
  30.     private static void render(IVertexBuilder vertexBuilder, Matrix4f matrix4F, Matrix3f matrix3F, int lightmap, float x, int y, int p_229045_6_, int p_229045_7_) {
  31.  
  32.         vertexBuilder.vertex(matrix4F, x - 0.5F, (float)y - 0.25F, 0.0F).color(207, 159, 254, 255).uv((float)p_229045_6_, (float)p_229045_7_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(lightmap).normal(matrix3F, 0.0F, 1.0F, 0.0F).endVertex();
  33.     }
  34.  
  35.     @Override
  36.     public ResourceLocation getTextureLocation(EndSlashEntity entity) { return END_SLASH_TEXTURE; }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement