public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = Shaders.getShaderPackResourceStream(this.texturePath); if (inputstream == null) { throw new FileNotFoundException("Shader texture not found: " + this.texturePath); } else { try { BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); TextureMetadataSection texturemetadatasection = this.loadTextureMetadataSection(); TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, texturemetadatasection.getTextureBlur(), texturemetadatasection.getTextureClamp()); } finally { IOUtils.closeQuietly(inputstream); } } }
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); }
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; }
public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); IResource iresource = null; try { iresource = resourceManager.getResource(this.textureLocation); BufferedImage bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { LOG.warn("Failed reading metadata of: {}", new Object[] {this.textureLocation, runtimeexception}); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { IOUtils.closeQuietly((Closeable)iresource); } }
public void func_110551_a(ResourceManager p_110551_1_) throws IOException { InputStream var2 = null; try { Resource var3 = p_110551_1_.func_110536_a(this.field_110568_b); var2 = var3.func_110527_b(); BufferedImage var4 = ImageIO.read(var2); boolean var5 = false; boolean var6 = false; if(var3.func_110528_c()) { try { TextureMetadataSection var7 = (TextureMetadataSection)var3.func_110526_a("texture"); if(var7 != null) { var5 = var7.func_110479_a(); var6 = var7.func_110480_b(); } } catch (RuntimeException var11) { Minecraft.func_71410_x().func_98033_al().func_98235_b("Failed reading metadata of: " + this.field_110568_b, var11); } } TextureUtil.func_110989_a(this.func_110552_b(), var4, var5, var6); } finally { if(var2 != null) { var2.close(); } } }
public void loadTexture(ResourceManager par1ResourceManager) throws IOException { InputStream inputstream = null; try { Resource resource = par1ResourceManager.getResource(this.textureLocation); inputstream = resource.getInputStream(); BufferedImage bufferedimage = ImageIO.read(inputstream); boolean flag = false; boolean flag1 = false; if (resource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)resource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { Minecraft.getMinecraft().getLogAgent().logWarningException("Failed reading metadata of: " + this.textureLocation, runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { if (inputstream != null) { inputstream.close(); } } }
public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = null; try { IResource iresource = resourceManager.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { logger.warn((String)("Failed reading metadata of: " + this.textureLocation), (Throwable)runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { if (inputstream != null) { inputstream.close(); } } }
public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = null; try { IResource iresource = resourceManager.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { logger.warn((String)("Failed reading metadata of: " + this.textureLocation), (Throwable)runtimeexception); } } if (Config.isShaders()) { ShadersTex.loadSimpleTexture(this.getGlTextureId(), bufferedimage, flag, flag1, resourceManager, this.textureLocation, this.getMultiTexID()); } else { TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } } finally { if (inputstream != null) { inputstream.close(); } } }
private TextureMetadataSection loadTextureMetadataSection() { String s = this.texturePath + ".mcmeta"; String s1 = "texture"; InputStream inputstream = Shaders.getShaderPackResourceStream(s); if (inputstream != null) { MetadataSerializer metadataserializer = METADATA_SERIALIZER; BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream)); TextureMetadataSection texturemetadatasection1; try { JsonObject jsonobject = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject(); TextureMetadataSection texturemetadatasection = (TextureMetadataSection)metadataserializer.parseMetadataSection(s1, jsonobject); if (texturemetadatasection == null) { return new TextureMetadataSection(false, false); } texturemetadatasection1 = texturemetadatasection; } catch (RuntimeException runtimeexception) { SMCLog.warning("Error reading metadata: " + s); SMCLog.warning("" + runtimeexception.getClass().getName() + ": " + runtimeexception.getMessage()); return new TextureMetadataSection(false, false); } finally { IOUtils.closeQuietly((Reader)bufferedreader); IOUtils.closeQuietly(inputstream); } return texturemetadatasection1; } else { return new TextureMetadataSection(false, false); } }
public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); IResource iresource = null; try { iresource = resourceManager.getResource(this.textureLocation); BufferedImage bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { LOG.warn("Failed reading metadata of: {}", new Object[] {this.textureLocation, runtimeexception}); } } if (Config.isShaders()) { ShadersTex.loadSimpleTexture(this.getGlTextureId(), bufferedimage, flag, flag1, resourceManager, this.textureLocation, this.getMultiTexID()); } else { TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } } finally { IOUtils.closeQuietly((Closeable)iresource); } }
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; }
public void loadTexture(IResourceManager par1ResourceManager) throws IOException { this.func_147631_c(); InputStream var2 = null; try { IResource var3 = par1ResourceManager.getResource(this.textureLocation); var2 = var3.getInputStream(); BufferedImage var4 = ImageIO.read(var2); boolean var5 = false; boolean var6 = false; if (var3.hasMetadata()) { try { TextureMetadataSection var7 = (TextureMetadataSection)var3.getMetadata("texture"); if (var7 != null) { var5 = var7.getTextureBlur(); var6 = var7.getTextureClamp(); } } catch (RuntimeException var11) { logger.warn("Failed reading metadata of: " + this.textureLocation, var11); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), var4, var5, var6); } finally { if (var2 != null) { var2.close(); } } }
@Override public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = null; try { IResource iresource = resourceManager.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = manipulateImage(resourceManager, ImageIO.read(inputstream)); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { LOGGER.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { if (inputstream != null) { inputstream.close(); } } }
public void loadTexture(IResourceManager p_110551_1_) throws IOException { this.deleteGlTexture(); InputStream inputstream = null; try { IResource iresource = p_110551_1_.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = ImageIO.read(inputstream); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { logger.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { if (inputstream != null) { inputstream.close(); } } }
public TextureMetadataSection func_110494_a(JsonElement p_110494_1_, Type p_110494_2_, JsonDeserializationContext p_110494_3_) { JsonObject var4 = p_110494_1_.getAsJsonObject(); boolean var5 = this.func_110484_a(var4.get("blur"), "blur", Boolean.valueOf(false)); boolean var6 = this.func_110484_a(var4.get("clamp"), "clamp", Boolean.valueOf(false)); return new TextureMetadataSection(var5, var6); }