Java 类net.minecraft.client.resources.data.AnimationMetadataSection 实例源码

项目:ExtraUtilities    文件:TextureDerived.java   
public boolean load(final IResourceManager manager, final ResourceLocation oldlocation) {
    ResourceLocation location = new ResourceLocation(this.baseIcon);
    location = this.completeResourceLocation(location);
    try {
        final int mipmapLevels = Minecraft.getMinecraft().gameSettings.mipmapLevels;
        final int anisotropicFiltering = Minecraft.getMinecraft().gameSettings.anisotropicFiltering;
        final IResource iresource = manager.getResource(location);
        final BufferedImage[] abufferedimage = new BufferedImage[1 + mipmapLevels];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        abufferedimage[0] = this.processImage(abufferedimage[0], animationmetadatasection);
        this.loadSprite(abufferedimage, animationmetadatasection, anisotropicFiltering > 1.0f);
    }
    catch (RuntimeException runtimeexception) {
        FMLClientHandler.instance().trackBrokenTexture(location, runtimeexception.getMessage());
        return true;
    }
    catch (IOException ioexception1) {
        FMLClientHandler.instance().trackMissingTexture(location);
        return true;
    }
    return false;
}
项目:RuneCraftery    文件:AnimationMetadataSectionSerializer.java   
public AnimationMetadataSection func_110493_a(JsonElement p_110493_1_, Type p_110493_2_, JsonDeserializationContext p_110493_3_) {
   ArrayList var4 = Lists.newArrayList();
   JsonObject var5 = (JsonObject)p_110493_1_;
   int var6 = this.func_110485_a(var5.get("frametime"), "frametime", Integer.valueOf(1), 1, Integer.MAX_VALUE);
   int var8;
   if(var5.has("frames")) {
      try {
         JsonArray var7 = var5.getAsJsonArray("frames");

         for(var8 = 0; var8 < var7.size(); ++var8) {
            JsonElement var9 = var7.get(var8);
            AnimationFrame var10 = this.func_110492_a(var8, var9);
            if(var10 != null) {
               var4.add(var10);
            }
         }
      } catch (ClassCastException var11) {
         throw new JsonParseException("Invalid animation->frames: expected array, was " + var5.get("frames"), var11);
      }
   }

   int var12 = this.func_110485_a(var5.get("width"), "width", Integer.valueOf(-1), 1, Integer.MAX_VALUE);
   var8 = this.func_110485_a(var5.get("height"), "height", Integer.valueOf(-1), 1, Integer.MAX_VALUE);
   return new AnimationMetadataSection(var4, var12, var8, var6);
}
项目:DecompiledMinecraft    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:BaseClient    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:BaseClient    文件:Minecraft.java   
private void registerMetadataSerializers() {
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(),
            TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(),
            FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(),
            AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(),
            PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(),
            LanguageMetadataSection.class);
}
项目:connor41-etfuturum2    文件:PrismarineIcon.java   
private void updateAnimationInterpolated() throws IllegalArgumentException, IllegalAccessException {
    AnimationMetadataSection animationMetadata = (AnimationMetadataSection) fanimationMetadata.get(this);

    double d0 = 1.0D - tickCounter / (double) animationMetadata.getFrameTimeSingle(frameCounter);
    int i = animationMetadata.getFrameIndex(frameCounter);
    int j = animationMetadata.getFrameCount() == 0 ? framesTextureData.size() : animationMetadata.getFrameCount();
    int k = animationMetadata.getFrameIndex((frameCounter + 1) % j);

    if (i != k && k >= 0 && k < framesTextureData.size()) {
        int[][] aint = (int[][]) framesTextureData.get(i);
        int[][] aint1 = (int[][]) framesTextureData.get(k);

        if (interpolatedFrameData == null || interpolatedFrameData.length != aint.length)
            interpolatedFrameData = new int[aint.length][];

        for (int l = 0; l < aint.length; l++) {
            if (interpolatedFrameData[l] == null)
                interpolatedFrameData[l] = new int[aint[l].length];

            if (l < aint1.length && aint1[l].length == aint[l].length)
                for (int i1 = 0; i1 < aint[l].length; ++i1) {
                    int j1 = aint[l][i1];
                    int k1 = aint1[l][i1];
                    int l1 = (int) (((j1 & 16711680) >> 16) * d0 + ((k1 & 16711680) >> 16) * (1.0D - d0));
                    int i2 = (int) (((j1 & 65280) >> 8) * d0 + ((k1 & 65280) >> 8) * (1.0D - d0));
                    int j2 = (int) ((j1 & 255) * d0 + (k1 & 255) * (1.0D - d0));
                    interpolatedFrameData[l][i1] = j1 & -16777216 | l1 << 16 | i2 << 8 | j2;
                }
        }

        TextureUtil.uploadTextureMipmap(interpolatedFrameData, width, height, originX, originY, false, false);
    }
}
项目:Zombe-Modpack    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:Backmemed    文件:SimpleShaderTexture.java   
private static MetadataSerializer makeMetadataSerializer()
{
    MetadataSerializer metadataserializer = new MetadataSerializer();
    metadataserializer.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    metadataserializer.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    metadataserializer.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    metadataserializer.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    metadataserializer.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
    return metadataserializer;
}
项目:Backmemed    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:CustomWorldGen    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:ExtraUtilities    文件:TextureBedrockLava.java   
@Override
public BufferedImage processImage(final BufferedImage image, final AnimationMetadataSection animationmetadatasection) {
    final int w = image.getWidth();
    final int h = image.getHeight();
    final int[] pixels = new int[h * w];
    image.getRGB(0, 0, w, h, pixels, 0, w);
    double mean = 0.0;
    for (int i = 0; i < pixels.length; ++i) {
        pixels[i] = this.getLuminosity(pixels[i]);
        mean += pixels[i];
    }
    mean /= pixels.length;
    final BufferedImage bedrockImage = TConTextureResourcePackBedrockium.getBedrockImage();
    for (int j = 0; j < pixels.length; ++j) {
        final int x = j % w;
        final int y = (j - x) / w % w;
        final int sn = (j - x) / w / w;
        final int dx = x * bedrockImage.getWidth() / w;
        final int dy = y * bedrockImage.getHeight() / w;
        final int col = bedrockImage.getRGB(dx, dy);
        final double f = pixels[j] / mean;
        final int r = this.clamp(this.rgb.getRed(col) * f);
        final int g = this.clamp(this.rgb.getGreen(col) * f);
        final int b = this.clamp(this.rgb.getBlue(col) * f);
        pixels[j] = (0xFF000000 | r << 16 | g << 8 | b);
    }
    image.setRGB(0, 0, w, h, pixels, 0, w);
    return image;
}
项目:Et-Futurum    文件:PrismarineIcon.java   
private void updateAnimationInterpolated() throws IllegalArgumentException, IllegalAccessException {
    AnimationMetadataSection animationMetadata = (AnimationMetadataSection) fanimationMetadata.get(this);

    double d0 = 1.0D - tickCounter / (double) animationMetadata.getFrameTimeSingle(frameCounter);
    int i = animationMetadata.getFrameIndex(frameCounter);
    int j = animationMetadata.getFrameCount() == 0 ? framesTextureData.size() : animationMetadata.getFrameCount();
    int k = animationMetadata.getFrameIndex((frameCounter + 1) % j);

    if (i != k && k >= 0 && k < framesTextureData.size()) {
        int[][] aint = (int[][]) framesTextureData.get(i);
        int[][] aint1 = (int[][]) framesTextureData.get(k);

        if (interpolatedFrameData == null || interpolatedFrameData.length != aint.length)
            interpolatedFrameData = new int[aint.length][];

        for (int l = 0; l < aint.length; l++) {
            if (interpolatedFrameData[l] == null)
                interpolatedFrameData[l] = new int[aint[l].length];

            if (l < aint1.length && aint1[l].length == aint[l].length)
                for (int i1 = 0; i1 < aint[l].length; ++i1) {
                    int j1 = aint[l][i1];
                    int k1 = aint1[l][i1];
                    int l1 = (int) (((j1 & 16711680) >> 16) * d0 + ((k1 & 16711680) >> 16) * (1.0D - d0));
                    int i2 = (int) (((j1 & 65280) >> 8) * d0 + ((k1 & 65280) >> 8) * (1.0D - d0));
                    int j2 = (int) ((j1 & 255) * d0 + (k1 & 255) * (1.0D - d0));
                    interpolatedFrameData[l][i1] = j1 & -16777216 | l1 << 16 | i2 << 8 | j2;
                }
        }

        TextureUtil.uploadTextureMipmap(interpolatedFrameData, width, height, originX, originY, false, false);
    }
}
项目:AdventureBackpack2    文件:TextureSpecial.java   
@Override
public void loadSprite(BufferedImage[] images, AnimationMetadataSection animationMeta, boolean anisotropicFiltering)
{
    rawWidth = images[0].getWidth();
    rawHeight = images[0].getHeight();
    super.loadSprite(images, animationMeta, anisotropicFiltering);
}
项目:ExpandedRailsMod    文件:Minecraft.java   
private void registerMetadataSerializers()
{
    this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
    this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
}
项目:RuneCraftery    文件:AnimationMetadataSectionSerializer.java   
public JsonElement func_110491_a(AnimationMetadataSection p_110491_1_, Type p_110491_2_, JsonSerializationContext p_110491_3_) {
   JsonObject var4 = new JsonObject();
   var4.addProperty("frametime", Integer.valueOf(p_110491_1_.func_110469_d()));
   if(p_110491_1_.func_110474_b() != -1) {
      var4.addProperty("width", Integer.valueOf(p_110491_1_.func_110474_b()));
   }

   if(p_110491_1_.func_110471_a() != -1) {
      var4.addProperty("height", Integer.valueOf(p_110491_1_.func_110471_a()));
   }

   if(p_110491_1_.func_110473_c() > 0) {
      JsonArray var5 = new JsonArray();

      for(int var6 = 0; var6 < p_110491_1_.func_110473_c(); ++var6) {
         if(p_110491_1_.func_110470_b(var6)) {
            JsonObject var7 = new JsonObject();
            var7.addProperty("index", Integer.valueOf(p_110491_1_.func_110468_c(var6)));
            var7.addProperty("time", Integer.valueOf(p_110491_1_.func_110472_a(var6)));
            var5.add(var7);
         } else {
            var5.add(new JsonPrimitive(Integer.valueOf(p_110491_1_.func_110468_c(var6))));
         }
      }

      var4.add("frames", var5);
   }

   return var4;
}
项目:InfiniTiC    文件:CustomTexture.java   
@Override
public void loadSprite(BufferedImage[] image, AnimationMetadataSection animation, boolean useAnisotropicFiltering) {
    Colorize colrz = new Colorize(red, green, blue);

    for (int i=0; i < image.length; i++) {
        if (image[i] != null) {
            image[i] = colrz.filter(image[i]);
        }
    }

    super.loadSprite(image, animation, useAnisotropicFiltering);

}
项目:DecompiledMinecraft    文件:TextureAtlasSprite.java   
public void loadSprite(BufferedImage[] images, AnimationMetadataSection meta) throws IOException
{
    this.resetSprite();
    int i = images[0].getWidth();
    int j = images[0].getHeight();
    this.width = i;
    this.height = j;
    int[][] aint = new int[images.length][];

    for (int k = 0; k < images.length; ++k)
    {
        BufferedImage bufferedimage = images[k];

        if (bufferedimage != null)
        {
            if (k > 0 && (bufferedimage.getWidth() != i >> k || bufferedimage.getHeight() != j >> k))
            {
                throw new RuntimeException(String.format("Unable to load miplevel: %d, image is size: %dx%d, expected %dx%d", new Object[] {Integer.valueOf(k), Integer.valueOf(bufferedimage.getWidth()), Integer.valueOf(bufferedimage.getHeight()), Integer.valueOf(i >> k), Integer.valueOf(j >> k)}));
            }

            aint[k] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()];
            bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[k], 0, bufferedimage.getWidth());
        }
    }

    if (meta == null)
    {
        if (j != i)
        {
            throw new RuntimeException("broken aspect ratio and not an animation");
        }

        this.framesTextureData.add(aint);
    }
    else
    {
        int j1 = j / i;
        int k1 = i;
        int l = i;
        this.height = this.width;

        if (meta.getFrameCount() > 0)
        {
            Iterator iterator = meta.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                int i1 = ((Integer)iterator.next()).intValue();

                if (i1 >= j1)
                {
                    throw new RuntimeException("invalid frameindex " + i1);
                }

                this.allocateFrameTextureData(i1);
                this.framesTextureData.set(i1, getFrameTextureData(aint, k1, l, i1));
            }

            this.animationMetadata = meta;
        }
        else
        {
            List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();

            for (int l1 = 0; l1 < j1; ++l1)
            {
                this.framesTextureData.add(getFrameTextureData(aint, k1, l, l1));
                list.add(new AnimationFrame(l1, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(list, this.width, this.height, meta.getFrameTime(), meta.isInterpolate());
        }
    }
}
项目:Backmemed    文件:TextureAtlasSprite.java   
public AnimationMetadataSection getAnimationMetadata()
{
    return this.animationMetadata;
}
项目:Backmemed    文件:TextureAtlasSprite.java   
public void setAnimationMetadata(AnimationMetadataSection p_setAnimationMetadata_1_)
{
    this.animationMetadata = p_setAnimationMetadata_1_;
}
项目:CustomWorldGen    文件:TextureAtlasSprite.java   
public void loadSpriteFrames(IResource resource, int mipmaplevels) throws IOException
{
    BufferedImage bufferedimage = TextureUtil.readBufferedImage(resource.getInputStream());
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)resource.getMetadata("animation");
    int[][] aint = new int[mipmaplevels][];
    aint[0] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()];
    bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[0], 0, bufferedimage.getWidth());

    if (animationmetadatasection == null)
    {
        this.framesTextureData.add(aint);
    }
    else
    {
        int i = bufferedimage.getHeight() / this.width;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                int j = ((Integer)iterator.next()).intValue();

                if (j >= i)
                {
                    throw new RuntimeException("invalid frameindex " + j);
                }

                this.allocateFrameTextureData(j);
                this.framesTextureData.set(j, getFrameTextureData(aint, this.width, this.width, j));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();

            for (int k = 0; k < i; ++k)
            {
                this.framesTextureData.add(getFrameTextureData(aint, this.width, this.width, k));
                list.add(new AnimationFrame(k, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(list, this.width, this.height, animationmetadatasection.getFrameTime(), animationmetadatasection.isInterpolate());
        }
    }
}
项目:ExtraUtilities    文件:TextureUnstableLava.java   
@Override
public BufferedImage processImage(final BufferedImage image, final AnimationMetadataSection animationmetadatasection) {
    final int w = image.getWidth();
    final int h = image.getHeight();
    final int[] aint = new int[h * w];
    final int[] c = new int[256];
    image.getRGB(0, 0, w, h, aint, 0, w);
    int n1 = 0;
    for (int i = 0; i < aint.length; ++i) {
        if (this.rgb.getAlpha(aint[i]) > 10) {
            aint[i] = this.getLuminosity(aint[i]);
            n1 = Math.max(n1, aint[i]);
        }
        else {
            aint[i] = 255;
        }
    }
    final int v = h / w;
    for (int j = 0; j < aint.length; ++j) {
        final int x = j % w;
        final int y = (j - x) / w % w;
        final int sn = (j - x) / w / w;
        final int p = 1;
        int lum = 256 + (x * 16 / w + y * 16 / w - 16) % 32 * 1 * 2;
        for (int t = 0; (lum >= 256 || lum < 240) && t < 100; lum = 480 - lum) {
            ++t;
            if (lum >= 256) {
                lum = 511 - lum;
            }
            if (lum < 240) {}
        }
        final int col = aint[j];
        int l = col + n1;
        l = 255 - (255 - l) * 2;
        if (l < 0) {
            l = 0;
        }
        l = 192 + (l >> 2);
        if (XURandom.getInstance().nextInt(3) != 0) {
            l -= XURandom.getInstance().nextInt(4);
        }
        l = l * lum / 255;
        if (l > 255) {
            l = 255;
        }
        if (l < 128) {
            l = 128;
        }
        aint[j] = (0xFF000000 | l * 65793);
    }
    image.setRGB(0, 0, w, h, aint, 0, w);
    return image;
}
项目:ExtraUtilities    文件:TextureComprBlock.java   
public boolean load(final IResourceManager manager, final ResourceLocation location) {
    final int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
    try {
        final IResource iresource = manager.getResource(location);
        final BufferedImage[] abufferedimage = new BufferedImage[1 + Minecraft.getMinecraft().gameSettings.mipmapLevels];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture");
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        this.loadSprite(abufferedimage, animationmetadatasection, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
    }
    catch (IOException e) {
        try {
            final IResource iresource2 = manager.getResource(this.textureLocation);
            final BufferedImage[] abufferedimage2 = new BufferedImage[1 + Minecraft.getMinecraft().gameSettings.mipmapLevels];
            abufferedimage2[0] = ImageIO.read(iresource2.getInputStream());
            final TextureMetadataSection texturemetadatasection2 = (TextureMetadataSection)iresource2.getMetadata("texture");
            final AnimationMetadataSection animationmetadatasection2 = (AnimationMetadataSection)iresource2.getMetadata("animation");
            this.loadSprite(abufferedimage2, animationmetadatasection2, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
        }
        catch (IOException e2) {
            e.printStackTrace();
            return true;
        }
        final float nh = this.n / 8.5f;
        final float br = 1.0f - nh;
        for (int j = 0; j < this.framesTextureData.size(); ++j) {
            final int[] image = new int[((int[][])this.framesTextureData.get(j))[0].length];
            for (int i = 0; i < image.length; ++i) {
                final int x = i % this.width;
                final int y = i / this.height;
                final int l = ((int[][])this.framesTextureData.get(j))[0][i];
                float r = (-l >> 16 & 0xFF) / 255.0f;
                float g = (-l >> 8 & 0xFF) / 255.0f;
                float b = (-l & 0xFF) / 255.0f;
                final float dx = 2 * x / (this.width - 1) - 1.0f;
                final float dy = 2 * y / (this.height - 1) - 1.0f;
                float db = Math.max(Math.abs(dx), Math.abs(dy));
                db = Math.max(db, (float)Math.sqrt(dx * dx + dy * dy) / 1.4f);
                float d = 1.0f - db + 1.0f - nh;
                final float rb = 1.0f - (2 + this.n) / 32.0f;
                float k = 1.0f;
                if (db > rb) {
                    k = 0.7f + 0.1f * (db - rb) / (1.0f - rb);
                }
                d *= k * k;
                if (d > 1.0f) {
                    d = 1.0f;
                }
                else if (d < 0.0f) {
                    d = 0.0f;
                }
                r = 1.0f - (1.0f - r) * br * d;
                g = 1.0f - (1.0f - g) * br * d;
                b = 1.0f - (1.0f - b) * br * d;
                image[i] = -((int)(r * 255.0f) << 16 | (int)(g * 255.0f) << 8 | (int)(b * 255.0f));
            }
            final int[][] aint = new int[1 + mp][];
            aint[0] = image;
            this.framesTextureData.set(j, aint);
        }
    }
    return false;
}
项目:ExtraUtilities    文件:TextureColorBlockBase.java   
public boolean load(final IResourceManager manager, final ResourceLocation location) {
    String s1 = "minecraft";
    String s2 = this.name;
    final int ind = this.name.indexOf(58);
    if (ind >= 0) {
        s2 = this.name.substring(ind + 1, this.name.length());
        if (ind > 1) {
            s1 = this.name.substring(0, ind);
        }
    }
    final int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
    s1 = s1.toLowerCase();
    s2 = "textures/" + this.directory + "/" + s2 + ".png";
    try {
        final IResource iresource = manager.getResource(new ResourceLocation(s1, s2));
        final BufferedImage[] abufferedimage = new BufferedImage[1 + mp];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        this.loadSprite(abufferedimage, animationmetadatasection, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
    }
    catch (IOException e) {
        return true;
    }
    for (int j = 0; j < this.framesTextureData.size(); ++j) {
        final int[] image = new int[((int[][])this.framesTextureData.get(j))[0].length];
        float min_m = 1.0f;
        float max_m = 0.0f;
        for (int i = 0; i < image.length; ++i) {
            final int l = ((int[][])this.framesTextureData.get(j))[0][i];
            if (l < 0) {
                float r = (-l >> 16 & 0xFF) / 255.0f;
                float g = (-l >> 8 & 0xFF) / 255.0f;
                float b = (-l & 0xFF) / 255.0f;
                r = 1.0f - r;
                g = 1.0f - g;
                b = 1.0f - b;
                final float m = r * 0.2126f + g * 0.7152f + b * 0.0722f;
                if (m > max_m) {
                    max_m = m;
                }
                if (m < min_m) {
                    min_m = m;
                }
            }
        }
        if (min_m == 1.0f && max_m == 0.0f) {
            return false;
        }
        if (max_m == min_m) {
            max_m = min_m + 0.001f;
        }
        final float new_max_m = Math.min(max_m * this.scale, 1.0f);
        final float new_min_m = min_m / max_m * new_max_m;
        for (int k = 0; k < image.length; ++k) {
            final int l2 = ((int[][])this.framesTextureData.get(j))[0][k];
            if (l2 < 0) {
                float r2 = (-l2 >> 16 & 0xFF) / 255.0f;
                float g2 = (-l2 >> 8 & 0xFF) / 255.0f;
                float b2 = (-l2 & 0xFF) / 255.0f;
                r2 = 1.0f - r2;
                g2 = 1.0f - g2;
                b2 = 1.0f - b2;
                float m2 = r2 * 0.2126f + g2 * 0.7152f + b2 * 0.0722f;
                final float dm = (m2 - min_m) / (max_m - min_m);
                m2 = new_min_m + dm * (new_max_m - new_min_m);
                g2 = (r2 = (b2 = Math.max(Math.min(0.975f, m2), 0.025f)));
                r2 = 1.0f - r2;
                g2 = 1.0f - g2;
                b2 = 1.0f - b2;
                image[k] = -((int)(r2 * 255.0f) << 16 | (int)(g2 * 255.0f) << 8 | (int)(b2 * 255.0f));
            }
        }
        final int[][] aint = new int[1 + mp][];
        aint[0] = image;
        this.framesTextureData.set(j, aint);
    }
    return false;
}
项目:ExtraUtilities    文件:TextureMultiIcon.java   
public void loadSprite(final BufferedImage[] p_147964_1_, final AnimationMetadataSection p_147964_2_, final boolean p_147964_3_) {
    throw new RuntimeException("Likely Optifine error. TextureAtlasSprite.loadSprite(BufferedImage[] p_147964_1_, AnimationMetadataSection p_147964_2_, boolean p_147964_3_) called after TextureAtlasSprite.load(IResourceManager manager, ResourceLocation location) returned false (which is the correct return value for successful loading).\nThis is not supposed to happen and will result in a missing texture.\nThis is likely an Optifine error.");
}
项目:ExpandedRailsMod    文件:TextureAtlasSprite.java   
public void loadSpriteFrames(IResource resource, int mipmaplevels) throws IOException
{
    BufferedImage bufferedimage = TextureUtil.readBufferedImage(resource.getInputStream());
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)resource.getMetadata("animation");
    int[][] aint = new int[mipmaplevels][];
    aint[0] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()];
    bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[0], 0, bufferedimage.getWidth());

    if (animationmetadatasection == null)
    {
        this.framesTextureData.add(aint);
    }
    else
    {
        int i = bufferedimage.getHeight() / this.width;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                int j = ((Integer)iterator.next()).intValue();

                if (j >= i)
                {
                    throw new RuntimeException("invalid frameindex " + j);
                }

                this.allocateFrameTextureData(j);
                this.framesTextureData.set(j, getFrameTextureData(aint, this.width, this.width, j));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();

            for (int k = 0; k < i; ++k)
            {
                this.framesTextureData.add(getFrameTextureData(aint, this.width, this.width, k));
                list.add(new AnimationFrame(k, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(list, this.width, this.height, animationmetadatasection.getFrameTime(), animationmetadatasection.isInterpolate());
        }
    }
}
项目:RuneCraftery    文件:AnimationMetadataSectionSerializer.java   
public JsonElement serialize(Object p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) {
   return this.func_110491_a((AnimationMetadataSection)p_serialize_1_, p_serialize_2_, p_serialize_3_);
}
项目:RuneCraftery    文件:TextureAtlasSprite.java   
public void func_130100_a(Resource p_130100_1_) throws IOException {
   this.func_130102_n();
   InputStream var2 = p_130100_1_.func_110527_b();
   AnimationMetadataSection var3 = (AnimationMetadataSection)p_130100_1_.func_110526_a("animation");
   BufferedImage var4 = ImageIO.read(var2);
   this.field_130224_d = var4.getHeight();
   this.field_130223_c = var4.getWidth();
   int[] var5 = new int[this.field_130224_d * this.field_130223_c];
   var4.getRGB(0, 0, this.field_130223_c, this.field_130224_d, var5, 0, this.field_130223_c);
   if(var3 == null) {
      if(this.field_130224_d != this.field_130223_c) {
         throw new RuntimeException("broken aspect ratio and not an animation");
      }

      this.field_110976_a.add(var5);
   } else {
      int var6 = this.field_130224_d / this.field_130223_c;
      int var7 = this.field_130223_c;
      int var8 = this.field_130223_c;
      this.field_130224_d = this.field_130223_c;
      int var10;
      if(var3.func_110473_c() > 0) {
         Iterator var9 = var3.func_130073_e().iterator();

         while(var9.hasNext()) {
            var10 = ((Integer)var9.next()).intValue();
            if(var10 >= var6) {
               throw new RuntimeException("invalid frameindex " + var10);
            }

            this.func_130099_d(var10);
            this.field_110976_a.set(var10, func_130101_a(var5, var7, var8, var10));
         }

         this.field_110982_k = var3;
      } else {
         ArrayList var11 = Lists.newArrayList();

         for(var10 = 0; var10 < var6; ++var10) {
            this.field_110976_a.add(func_130101_a(var5, var7, var8, var10));
            var11.add(new AnimationFrame(var10, -1));
         }

         this.field_110982_k = new AnimationMetadataSection(var11, this.field_130223_c, this.field_130224_d, var3.func_110469_d());
      }
   }

}
项目:RuneCraftery    文件:TextureAtlasSprite.java   
public void loadSprite(Resource par1Resource) throws IOException
{
    this.resetSprite();
    InputStream inputstream = par1Resource.getInputStream();
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)par1Resource.getMetadata("animation");
    BufferedImage bufferedimage = ImageIO.read(inputstream);
    this.height = bufferedimage.getHeight();
    this.width = bufferedimage.getWidth();
    int[] aint = new int[this.height * this.width];
    bufferedimage.getRGB(0, 0, this.width, this.height, aint, 0, this.width);

    if (animationmetadatasection == null)
    {
        if (this.height != this.width)
        {
            throw new RuntimeException("broken aspect ratio and not an animation");
        }

        this.framesTextureData.add(aint);
    }
    else
    {
        int i = this.height / this.width;
        int j = this.width;
        int k = this.width;
        this.height = this.width;
        int l;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                l = ((Integer)iterator.next()).intValue();

                if (l >= i)
                {
                    throw new RuntimeException("invalid frameindex " + l);
                }

                this.allocateFrameTextureData(l);
                this.framesTextureData.set(l, getFrameTextureData(aint, j, k, l));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            ArrayList arraylist = Lists.newArrayList();

            for (l = 0; l < i; ++l)
            {
                this.framesTextureData.add(getFrameTextureData(aint, j, k, l));
                arraylist.add(new AnimationFrame(l, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(arraylist, this.width, this.height, animationmetadatasection.getFrameTime());
        }
    }
}
项目:BetterNutritionMod    文件:TextureAtlasSprite.java   
public void loadSprite(Resource par1Resource) throws IOException
{
    this.resetSprite();
    InputStream inputstream = par1Resource.getInputStream();
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)par1Resource.getMetadata("animation");
    BufferedImage bufferedimage = ImageIO.read(inputstream);
    this.height = bufferedimage.getHeight();
    this.width = bufferedimage.getWidth();
    int[] aint = new int[this.height * this.width];
    bufferedimage.getRGB(0, 0, this.width, this.height, aint, 0, this.width);

    if (animationmetadatasection == null)
    {
        if (this.height != this.width)
        {
            throw new RuntimeException("broken aspect ratio and not an animation");
        }

        this.framesTextureData.add(aint);
    }
    else
    {
        int i = this.height / this.width;
        int j = this.width;
        int k = this.width;
        this.height = this.width;
        int l;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                l = ((Integer)iterator.next()).intValue();

                if (l >= i)
                {
                    throw new RuntimeException("invalid frameindex " + l);
                }

                this.allocateFrameTextureData(l);
                this.framesTextureData.set(l, getFrameTextureData(aint, j, k, l));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            ArrayList arraylist = Lists.newArrayList();

            for (l = 0; l < i; ++l)
            {
                this.framesTextureData.add(getFrameTextureData(aint, j, k, l));
                arraylist.add(new AnimationFrame(l, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(arraylist, this.width, this.height, animationmetadatasection.getFrameTime());
        }
    }
}
项目:RefinedRelocation    文件:TextureSpecial.java   
@Override
public void loadSprite(BufferedImage[] images, AnimationMetadataSection animationMeta, boolean anisotropicFiltering) {
    rawWidth = images[0].getWidth();
    rawHeight = images[0].getHeight();
    super.loadSprite(images, animationMeta, anisotropicFiltering);
}
项目:ExtraUtilities    文件:TextureDerived.java   
public abstract BufferedImage processImage(final BufferedImage p0, final AnimationMetadataSection p1);