Class ItemTextureQuadConverter

java.lang.Object
net.minecraftforge.client.model.ItemTextureQuadConverter

public final class ItemTextureQuadConverter extends Object
  • Constructor Details

    • ItemTextureQuadConverter

      private ItemTextureQuadConverter()
  • Method Details

    • convertTexture

      public static List<BakedQuad> convertTexture(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
      Takes a texture and converts it into BakedQuads. The conversion is done by scanning the texture horizontally and vertically and creating "strips" of the texture. Strips that are of the same size and follow each other are converted into one bigger quad.
      The resulting list of quads is the texture represented as a list of horizontal OR vertical quads, depending on which creates less quads. If the amount of quads is equal, horizontal is preferred.
      Parameters:
      template - The input texture to convert
      sprite - The texture whose UVs shall be used
      Returns:
      The generated quads.
    • convertTexture

      public static List<BakedQuad> convertTexture(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint, int luminosity)
    • convertTextureHorizontal

      public static List<BakedQuad> convertTextureHorizontal(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
      Scans a texture and converts it into a list of horizontal strips stacked on top of each other. The height of the strips is as big as possible.
    • convertTextureHorizontal

      public static List<BakedQuad> convertTextureHorizontal(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint, int luminosity)
    • convertTextureVertical

      public static List<BakedQuad> convertTextureVertical(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
      Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right. The width of the strips is as big as possible.
    • convertTextureVertical

      public static List<BakedQuad> convertTextureVertical(Transformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint, int luminosity)
    • isVisible

      private static boolean isVisible(int color)
    • genQuad

      public static BakedQuad genQuad(Transformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint)
      Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH. Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
    • genQuad

      public static BakedQuad genQuad(Transformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint, int luminosity)
    • putQuad

      private static BakedQuad putQuad(Transformation transform, Direction side, TextureAtlasSprite sprite, int color, int tint, float x1, float y1, float x2, float y2, float z, float u1, float v1, float u2, float v2, int luminosity)
    • putVertex

      private static void putVertex(IVertexConsumer consumer, Direction side, float x, float y, float z, float u, float v, int color, int luminosity)