Ejemplo n.º 1
0
  @Override
  public void setup() {
    super.setup();
    int sWidth = overrideData.getWidth();
    int sHeight = overrideData.getHeight();

    pixels = new int[tileSizeSquare];
    if (tileSizeBase == sWidth && tileSizeBase == sHeight) {
      overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth);
    } else {
      BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6);
      Graphics2D gfx = tmp.createGraphics();
      gfx.drawImage(
          overrideData,
          0,
          0,
          tileSizeBase,
          tileSizeBase,
          0,
          0,
          sWidth,
          sHeight,
          (ImageObserver) null);
      tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase);
      gfx.dispose();
    }

    update();
  }
Ejemplo n.º 2
0
 @Override
 public void setup() {
   super.setup();
   fireTileSize = tileSizeBase + (tileSizeBase >> 2);
   fireGridSize = fireTileSize * tileSizeBase;
   field_76869_g = new float[fireGridSize];
   field_76870_h = new float[fireGridSize];
 }
 @Override
 public void setup() {
   super.setup();
   red = new float[tileSizeSquare];
   green = new float[tileSizeSquare];
   blue = new float[tileSizeSquare];
   alpha = new float[tileSizeSquare];
   tickCounter = 0;
 }
Ejemplo n.º 4
0
 @Override
 public void onTextureDimensionsUpdate(int width, int height) {
   tileSizeBase = width >> 4;
   tileSizeSquare = tileSizeBase * tileSizeBase;
   tileSizeMask = tileSizeBase - 1;
   tileSizeSquareMask = tileSizeSquare - 1;
   setErrored(false);
   setup();
 }
Ejemplo n.º 5
0
  @Override
  public void setup() {
    super.setup();

    int sWidth = imgData.getWidth();
    int sHeight = imgData.getHeight();
    int tWidth = tileSizeBase;
    int tHeight = tileSizeBase;

    int frames = (int) Math.floor((double) (sHeight / sWidth));

    if (frames < 1) {
      throw new IllegalArgumentException(
          String.format(
              "Attempted to create a TextureAnimation with no complete frames: %dx%d",
              sWidth, sHeight));
    } else {
      images = new byte[frames][];
      BufferedImage image = imgData;

      if (sWidth != tWidth) {
        BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
        Graphics2D g = b.createGraphics();
        g.drawImage(
            imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver) null);
        g.dispose();
        image = b;
      }

      for (int frame = 0; frame < frames; frame++) {
        int[] pixels = new int[tileSizeSquare];
        image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth);
        images[frame] = new byte[tileSizeSquare << 2];

        for (int i = 0; i < pixels.length; i++) {
          int i4 = i * 4;
          images[frame][i4 + 0] = (byte) (pixels[i] >> 16 & 255);
          images[frame][i4 + 1] = (byte) (pixels[i] >> 8 & 255);
          images[frame][i4 + 2] = (byte) (pixels[i] >> 0 & 255);
          images[frame][i4 + 3] = (byte) (pixels[i] >> 24 & 255);
        }
      }
    }
  }