Java 类net.minecraft.client.resources.IResource 实例源码

项目:ObsidianSuite    文件:FileLoader.java   
/**
 * Load a model from a resource location.
 * Texture override is optional, it is used instead of the texture location generated from the modelResource.
 * Should be supplied in mods but not in the animator.
 * Null if not supplied
 */
public static <T extends ModelObj> T loadModelFromResources(String entityName, ResourceLocation modelResource, ResourceLocation textureOverride, Class<T> clazz)
{
    T model = null;

    try {
        IResource res = Minecraft.getMinecraft().getResourceManager().getResource(modelResource);

        File tmpFile = new File(entityName + ".obm");
        InputStream is = res.getInputStream();
        OutputStream os = new FileOutputStream(tmpFile);
        IOUtils.copy(is, os);
        is.close();
        os.close();
        model = FileLoader.fromFile(tmpFile, textureOverride, clazz);
        if(textureOverride != null) 
            model.setTexture(textureOverride);
        tmpFile.delete();
    } catch (IOException e) {
        System.out.println("Could not load " + entityName + " model from resource");
        e.printStackTrace();
    }

    return model;
}
项目:Novous    文件:TestResourceLinker.java   
/**
 * Checks if the test resource is registered, if not stop the game and throw a
 * {@link RuntimeException}.
 */
public static void checkTestSuccess() {
    try {
        IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(new
                ResourceLocation
                ("novous_test_linker:test_resource"));
        if (resource instanceof LinkedResourceManager.LinkedStreamResource) {
            InputStream stream = resource.getInputStream();
            String yesString = IOUtils.toString(stream);
            if (!yesString.equals("yes")) {
                throw new RuntimeException();
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException();
    }
}
项目:BaseClient    文件:ShadersTex.java   
public static void loadNSMap1(IResourceManager manager, ResourceLocation location, int width, int height, int[] aint, int offset, int defaultColor)
{
    boolean flag = false;

    try
    {
        IResource iresource = manager.getResource(location);
        BufferedImage bufferedimage = ImageIO.read(iresource.getInputStream());

        if (bufferedimage != null && bufferedimage.getWidth() == width && bufferedimage.getHeight() == height)
        {
            bufferedimage.getRGB(0, 0, width, height, aint, offset, width);
            flag = true;
        }
    }
    catch (IOException var10)
    {
        ;
    }

    if (!flag)
    {
        Arrays.fill(aint, offset, offset + width * height, defaultColor);
    }
}
项目:Backmemed    文件:ShadersTex.java   
public static void loadNSMap1(IResourceManager manager, ResourceLocation location, int width, int height, int[] aint, int offset, int defaultColor)
{
    boolean flag = false;

    try
    {
        IResource iresource = manager.getResource(location);
        BufferedImage bufferedimage = ImageIO.read(iresource.getInputStream());

        if (bufferedimage != null && bufferedimage.getWidth() == width && bufferedimage.getHeight() == height)
        {
            bufferedimage.getRGB(0, 0, width, height, aint, offset, width);
            flag = true;
        }
    }
    catch (IOException var10)
    {
        ;
    }

    if (!flag)
    {
        Arrays.fill(aint, offset, offset + width * height, defaultColor);
    }
}
项目:Backmemed    文件:ModelBakery.java   
private ModelBlockDefinition loadMultipartMBD(ResourceLocation location, ResourceLocation fileIn)
{
    List<ModelBlockDefinition> list = Lists.<ModelBlockDefinition>newArrayList();

    try
    {
        for (IResource iresource : this.resourceManager.getAllResources(fileIn))
        {
            list.add(this.loadModelBlockDefinition(location, iresource));
        }
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of model " + fileIn, ioexception);
    }

    return new ModelBlockDefinition(list);
}
项目:Backmemed    文件:ModelBakery.java   
private ModelBlockDefinition loadModelBlockDefinition(ResourceLocation location, IResource resource)
{
    InputStream inputstream = null;
    ModelBlockDefinition lvt_4_1_;

    try
    {
        inputstream = resource.getInputStream();
        lvt_4_1_ = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputstream, Charsets.UTF_8));
    }
    catch (Exception exception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of \'" + location + "\' from: \'" + resource.getResourceLocation() + "\' in resourcepack: \'" + resource.getResourcePackName() + "\'", exception);
    }
    finally
    {
        IOUtils.closeQuietly(inputstream);
    }

    return lvt_4_1_;
}
项目:Backmemed    文件:FontRenderer.java   
private void readGlyphSizes()
{
    IResource iresource = null;

    try
    {
        iresource = this.getResource(new ResourceLocation("font/glyph_sizes.bin"));
        iresource.getInputStream().read(this.glyphWidth);
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException(ioexception);
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }
}
项目:Backmemed    文件:GuiMainMenu.java   
public GuiMainMenu() {
    this.openGLWarning2 = MORE_INFO_TEXT;
    IResource iresource = null;

    this.splashText = "uhoh";

    this.splashText = Splashes.getSplashes()[new Random().nextInt(Splashes.getSplashes().length)];

    this.updateCounter = RANDOM.nextFloat();
    this.openGLWarning1 = "";

    if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) {
        this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]);
        this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]);
        this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
    }

    String s1 = System.getProperty("java.version");

    if (s1 != null && (s1.startsWith("1.6") || s1.startsWith("1.7"))) {
        this.openGLWarning1 = I18n.format("title.oldjava1", new Object[0]);
        this.openGLWarning2 = I18n.format("title.oldjava2", new Object[0]);
        this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/2636196?ref=game";
    }
}
项目:CustomWorldGen    文件:ModelBakery.java   
private ModelBlockDefinition loadMultipartMBD(ResourceLocation location, ResourceLocation fileIn)
{
    List<ModelBlockDefinition> list = Lists.<ModelBlockDefinition>newArrayList();

    try
    {
        for (IResource iresource : this.resourceManager.getAllResources(fileIn))
        {
            list.add(this.loadModelBlockDefinition(location, iresource));
        }
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of model " + fileIn, ioexception);
    }

    return new ModelBlockDefinition(list);
}
项目:CustomWorldGen    文件:ModelBakery.java   
private ModelBlockDefinition loadModelBlockDefinition(ResourceLocation location, IResource resource)
{
    InputStream inputstream = null;
    ModelBlockDefinition lvt_4_1_;

    try
    {
        inputstream = resource.getInputStream();
        lvt_4_1_ = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputstream, Charsets.UTF_8));
    }
    catch (Exception exception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of \'" + location + "\' from: \'" + resource.getResourceLocation() + "\' in resourcepack: \'" + resource.getResourcePackName() + "\'", exception);
    }
    finally
    {
        IOUtils.closeQuietly(inputstream);
    }

    return lvt_4_1_;
}
项目:CustomWorldGen    文件:TextureUtil.java   
public static int[] readImageData(IResourceManager resourceManager, ResourceLocation imageLocation) throws IOException
{
    IResource iresource = null;
    int[] aint1;

    try
    {
        iresource = resourceManager.getResource(imageLocation);
        BufferedImage bufferedimage = readBufferedImage(iresource.getInputStream());
        int i = bufferedimage.getWidth();
        int j = bufferedimage.getHeight();
        int[] aint = new int[i * j];
        bufferedimage.getRGB(0, 0, i, j, aint, 0, i);
        aint1 = aint;
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }

    return aint1;
}
项目:CustomWorldGen    文件:FontRenderer.java   
private void readGlyphSizes()
{
    IResource iresource = null;

    try
    {
        iresource = getResource(new ResourceLocation("font/glyph_sizes.bin"));
        iresource.getInputStream().read(this.glyphWidth);
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException(ioexception);
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }
}
项目: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;
}
项目:ExtraUtilities    文件:TextureMultiIcon.java   
public void altLoadSprite(final IResource par1Resource) throws IOException {
    this.setFramesTextureData((List)Lists.newArrayList());
    this.frameCounter = 0;
    this.tickCounter = 0;
    final InputStream inputstream = par1Resource.getInputStream();
    final BufferedImage bufferedimage = ImageIO.read(inputstream);
    this.height = bufferedimage.getHeight() / this.grid_h;
    this.width = bufferedimage.getWidth() / this.grid_w;
    if (this.height < this.grid_h || this.width < this.grid_w) {
        throw new RuntimeException("Texture too small, must be at least " + this.grid_w + " pixels wide and " + this.grid_h + " pixels tall");
    }
    if (this.grid_x < 0 || this.grid_x >= this.grid_w) {
        throw new RuntimeException("GridTextureIcon called with an invalid grid_x");
    }
    if (this.grid_y < 0 || this.grid_y >= this.grid_h) {
        throw new RuntimeException("GridTextureIcon called with an invalid grid_y");
    }
    final int[] aint = new int[this.height * this.width];
    bufferedimage.getRGB(this.grid_x * this.width, this.grid_y * this.height, this.width, this.height, aint, 0, this.width);
    if (this.height != this.width) {
        throw new RuntimeException("broken aspect ratio, must be in ratio: " + this.grid_w + ":" + this.grid_h);
    }
    this.framesTextureData.add(this.prepareAnisotropicFiltering(aint, this.width, this.height, Minecraft.getMinecraft().gameSettings.mipmapLevels, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f));
}
项目:DynamicSurroundings    文件:ProxyClient.java   
@Override
public void preInit(@Nonnull final FMLPreInitializationEvent event) {
    super.preInit(event);

    // Extract the preset config files present in the JAR
    final IResourceManager manager = Minecraft.getMinecraft().getResourceManager();

    for(final String preset : presetFiles) {
        final String name = preset + ".presets";
        try {
            final IResource r = manager.getResource(new ResourceLocation(Presets.MOD_ID, "data/" + name));
            try(final InputStream stream = r.getInputStream()) {
                Streams.copy(stream, new File(Presets.dataDirectory(), name));
            }
        } catch(final Throwable t) {
            Presets.log().error("Unable to extract preset file " + name, t);
        }
    }
}
项目:CodeChickenLib    文件:CCBlockStateLoader.java   
public ModelBlockDefinition loadMBD(ResourceLocation file) {
    List<ModelBlockDefinition> list = new ArrayList<>();

    try {
        for (IResource resource : modelLoader.resourceManager.getAllResources(file)) {
            list.add(load(resource.getInputStream()));
        }
    } catch (FileNotFoundException ignore) {
    } catch (IOException e) {
        throw new RuntimeException("Encountered an exception when loading model definition of model " + file, e);
    }
    if (list.isEmpty()) {
        return null;
    }
    return new ModelBlockDefinition(list);
}
项目:Guidebook    文件:TemplateLibrary.java   
public static TemplateLibrary get(String path)
{
    TemplateLibrary lib = LIBRARIES.get(path);
    if (lib == null)
    {
        try
        {
            lib = new TemplateLibrary();

            IResource res = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(path));
            InputStream stream = res.getInputStream();
            lib.parseLibrary(stream);

            LIBRARIES.put(path, lib);
        }
        catch (IOException | ParserConfigurationException | SAXException e)
        {
            // TODO: Fail
        }
    }

    return lib;
}
项目:Factorization    文件:ImgWord.java   
private void autosize() {
    Pair<Integer, Integer> cached = size_cache.get(resource);
    if (cached != null) {
        width = cached.getLeft();
        height = cached.getRight();
        return;
    }

    IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager();
    IResource iresource = null;
    InputStream is = null;
    try {
        iresource = resourceManager.getResource(resource);
        is = iresource.getInputStream();
        BufferedImage bufferedimage = ImageIO.read(is);
        this.width = bufferedimage.getWidth();
        this.height = bufferedimage.getHeight();
        size_cache.put(resource, Pair.of(width, height));
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        FzUtil.closeNoisily("reading size of image", is);
    }
}
项目:DynamicLib    文件:DynamicBlock.java   
@SideOnly(Side.CLIENT)
private IIcon getIconWithSub(IIconRegister registry, String name, IIcon substitute) {
    if (substitute != null) {
        try {
            ResourceLocation resLoc = new ResourceLocation(name);
            resLoc = new ResourceLocation(resLoc.getResourceDomain(), String.format("%s/%s%s", "textures/blocks", resLoc.getResourcePath(), ".png"));

            IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resLoc);
            if (res != null) return registry.registerIcon(name);
        } catch (IOException e) {
            return substitute;
        }
    }

    return registry.registerIcon(name);
}
项目:fontbox    文件:GLFont.java   
/**
 * Create a GLFont from a TTF file
 *
 * @param trace
 *            The debugging tracer object
 * @param px
 *            The font pixel size
 * @param ttf
 *            The TTF file
 * @return The GLFont result
 * @throws FontException
 *             Any exception which occurs when reading the TTF file, brewing
 *             the buffer or creating the final font.
 */
public static GLFont fromTTF(ITracer trace, float px, ResourceLocation ttf) throws FontException {
    if (trace == null)
        throw new IllegalArgumentException("trace may not be null");
    if (ttf == null)
        throw new IllegalArgumentException("ttf may not be null");
    try {
        IResource metricResource = Minecraft.getMinecraft().getResourceManager().getResource(ttf);
        InputStream stream = metricResource.getInputStream();
        if (stream == null)
            throw new IOException("Could not open TTF file.");
        Font sysfont = Font.createFont(Font.TRUETYPE_FONT, stream);
        if (trace != null)
            trace.trace("GLFont.fromTTF", sysfont.getName());
        return fromFont(trace, sysfont.deriveFont(px));
    } catch (IOException ioex) {
        trace.trace("GLFont.fromTTF", ioex);
        throw new FontException("Can't perform I/O operation!", ioex);
    } catch (FontFormatException ffe) {
        trace.trace("GLFont.fromTTF", ffe);
        throw new FontException("Invalid TTF file!", ffe);
    }
}
项目:ExpandedRailsMod    文件:ModelBakery.java   
private ModelBlockDefinition loadMultipartMBD(ResourceLocation location, ResourceLocation fileIn)
{
    List<ModelBlockDefinition> list = Lists.<ModelBlockDefinition>newArrayList();

    try
    {
        for (IResource iresource : this.resourceManager.getAllResources(fileIn))
        {
            list.add(this.loadModelBlockDefinition(location, iresource));
        }
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of model " + fileIn, ioexception);
    }

    return new ModelBlockDefinition(list);
}
项目:ExpandedRailsMod    文件:ModelBakery.java   
private ModelBlockDefinition loadModelBlockDefinition(ResourceLocation p_188636_1_, IResource p_188636_2_)
{
    InputStream inputstream = null;
    ModelBlockDefinition lvt_4_1_;

    try
    {
        inputstream = p_188636_2_.getInputStream();
        lvt_4_1_ = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputstream, Charsets.UTF_8));
    }
    catch (Exception exception)
    {
        throw new RuntimeException("Encountered an exception when loading model definition of \'" + p_188636_1_ + "\' from: \'" + p_188636_2_.getResourceLocation() + "\' in resourcepack: \'" + p_188636_2_.getResourcePackName() + "\'", exception);
    }
    finally
    {
        IOUtils.closeQuietly(inputstream);
    }

    return lvt_4_1_;
}
项目:ExpandedRailsMod    文件:TextureUtil.java   
public static int[] readImageData(IResourceManager resourceManager, ResourceLocation imageLocation) throws IOException
{
    IResource iresource = null;
    int[] aint1;

    try
    {
        iresource = resourceManager.getResource(imageLocation);
        BufferedImage bufferedimage = readBufferedImage(iresource.getInputStream());
        int i = bufferedimage.getWidth();
        int j = bufferedimage.getHeight();
        int[] aint = new int[i * j];
        bufferedimage.getRGB(0, 0, i, j, aint, 0, i);
        aint1 = aint;
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }

    return aint1;
}
项目:ExpandedRailsMod    文件:FontRenderer.java   
private void readGlyphSizes()
{
    IResource iresource = null;

    try
    {
        iresource = getResource(new ResourceLocation("font/glyph_sizes.bin"));
        iresource.getInputStream().read(this.glyphWidth);
    }
    catch (IOException ioexception)
    {
        throw new RuntimeException(ioexception);
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }
}
项目:SchematicMetaBlocks    文件:SchematicLoader.java   
public void loadSchematic(ResourceLocation schematicLocation)
{
    try
    {
        if (loadedSchematics.containsKey(schematicLocation))
        {
            return;
        }
        _logger.info(String.format("%s - Loading schematic %s", System.currentTimeMillis(), schematicLocation));

        final IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(schematicLocation);
        SchematicWorld schematic = readFromFile(resource.getInputStream());
        if (schematic == null)
        {
            return;
        }

        loadedSchematics.put(schematicLocation, schematic);
        _logger.info(String.format("%s - Loaded %s [w:%d,h:%d,l:%d]", System.currentTimeMillis(), schematicLocation, schematic.getWidth(), schematic.getHeight(), schematic.getLength()));
    } catch (IOException exception)
    {
        _logger.error(String.format("Unable to load %s", schematicLocation), exception);
    }
}
项目:OpenBlocks    文件:ChangelogBuilder.java   
public static List<Changelog> readChangeLogs() {
    try {
        IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(CHANGELOG);
        InputStream resourceStream = resource.getInputStream();
        try {
            Reader reader = new InputStreamReader(resourceStream);
            Gson gson = new Gson();
            return gson.fromJson(reader, LIST_TYPE);
        } finally {
            resourceStream.close();
        }
    } catch (Exception e) {
        Log.severe(e, "Failed to read changelog");
    }
    return ImmutableList.of();
}
项目:OpenModsLib    文件:HitboxManager.java   
private List<Hitbox> load(ResourceLocation location) {
    final List<Hitbox> result = Lists.newArrayList();
    if (resourceManager != null) {
        try {
            IResource resource = resourceManager.getResource(location);

            Closer closer = Closer.create();
            try {
                final InputStream is = closer.register(resource.getInputStream());
                final Reader reader = closer.register(new InputStreamReader(is, Charsets.UTF_8));
                final HitboxList list = GSON.fromJson(reader, HitboxList.class);
                result.addAll(list);
            } catch (Throwable t) {
                throw closer.rethrow(t);
            } finally {
                closer.close();
            }
        } catch (IOException e) {
            Log.warn(e, "Failed to find hitbox %s", location);
        }
    }

    return result;
}
项目:IGW-mod    文件:LocatedTexture.java   
public LocatedTexture(ResourceLocation texture, int x, int y, double scale){
    this(texture, x, y, 0, 0);
    try {
        BufferedImage bufferedimage;
        if(texture.getResourcePath().startsWith("server")) {
            bufferedimage = ImageIO.read(new FileInputStream(new File(IGWMod.proxy.getSaveLocation() + File.separator + "igwmod" + File.separator + texture.getResourcePath().substring(7))));
        } else {
            IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(texture);
            InputStream inputstream = iresource.getInputStream();
            bufferedimage = ImageIO.read(inputstream);
        }
        width = (int)(bufferedimage.getWidth() * scale);
        height = (int)(bufferedimage.getHeight() * scale);
    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:pnc-repressurized    文件:TintedOBJModel.java   
public Parser(IResource from, IResourceManager manager) throws IOException
{
    this.manager = manager;
    this.objFrom = from.getResourceLocation();
    this.objStream = new InputStreamReader(from.getInputStream(), StandardCharsets.UTF_8);
    this.objReader = new BufferedReader(objStream);
}
项目:ObsidianSuite    文件:WavefrontObject.java   
public WavefrontObject(ResourceLocation resource) throws ModelFormatException
{
    this.fileName = resource.toString();

    try
    {
        IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
        loadObjModel(res.getInputStream());
    }
    catch (IOException e)
    {
        throw new ModelFormatException("IO Exception reading model format", e);
    }
}
项目:j6502    文件:ClientProxy.java   
@Override
public void postInit(FMLPostInitializationEvent event) {
    byte[] defaultBIOSImage = null;
    IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
    try {
        IResource res = rm.getResource(new ResourceLocation("ocmos", "ocmosbios.cabe"));
        InputStream stream = res.getInputStream();
        byte[] buf = new byte[4096];
        int len = stream.read(buf);
        if(len <= 6)
            MainClass.logger.error("ocmosbios.cabe is too small to possibly be valid");
        else {
            defaultBIOSImage = Arrays.copyOf(buf, len);
            MainClass.logger.info("Found ocmosbios.cabe");
        }
    }
    catch(IOException e) {
        MainClass.logger.error("IOException while loading ocmosbios.cabe", e);
    }
    if(defaultBIOSImage != null) {
        MainClass.setDefaultBIOSImage(defaultBIOSImage);
        Items.registerEEPROM("EEPROM (OCMOS BIOS)", defaultBIOSImage, null, false);
        // TODO: Get this to work some day, behind a config option
        /*
        ItemStack stack = new ItemStack(Items.get("eeprom").item());
        NBTTagCompound compound = new NBTTagCompound();
        compound.setByteArray("oc:eeprom", defaultBIOSImage);
        compound.setString("oc:label", "EEPROM (OCMOS BIOS)");
        stack.setTagCompound(compound);
        GameRegistry.addShapelessRecipe(stack, Items.get("eeprom").item(), net.minecraft.init.Items.feather);
        */
    }
}
项目:Novous    文件:LinkedResourceManager.java   
@Override
public IResource getResource(ResourceLocation location) throws IOException {
    final IResource[] resource = {null};
    linkers.forEach((resourceLinker) -> {
        if (resourceLinker.exists(fromNative(location))) {
              resource[0] = new LinkedStreamResource(fromNative(location), resourceLinker);
        }
    });
    if (resource[0] == null) {
        throw new IOException();
    }
    return resource[0];
}
项目:DecompiledMinecraft    文件:SoundHandler.java   
public void onResourceManagerReload(IResourceManager resourceManager)
{
    this.sndManager.reloadSoundSystem();
    this.sndRegistry.clearMap();

    for (String s : resourceManager.getResourceDomains())
    {
        try
        {
            for (IResource iresource : resourceManager.getAllResources(new ResourceLocation(s, "sounds.json")))
            {
                try
                {
                    Map<String, SoundList> map = this.getSoundMap(iresource.getInputStream());

                    for (Entry<String, SoundList> entry : map.entrySet())
                    {
                        this.loadSoundResource(new ResourceLocation(s, (String)entry.getKey()), (SoundList)entry.getValue());
                    }
                }
                catch (RuntimeException runtimeexception)
                {
                    logger.warn((String)"Invalid sounds.json", (Throwable)runtimeexception);
                }
            }
        }
        catch (IOException var11)
        {
            ;
        }
    }
}
项目:BaseClient    文件:ShadersTex.java   
public static BufferedImage readImage(ResourceLocation resLoc)
{
    try
    {
        IResource iresource = resManager.getResource(resLoc);

        if (iresource == null)
        {
            return null;
        }
        else
        {
            InputStream inputstream = iresource.getInputStream();

            if (inputstream == null)
            {
                return null;
            }
            else
            {
                BufferedImage bufferedimage = ImageIO.read(inputstream);
                inputstream.close();
                return bufferedimage;
            }
        }
    }
    catch (IOException var4)
    {
        return null;
    }
}
项目:BaseClient    文件:Config.java   
public static boolean hasResource(ResourceLocation p_hasResource_0_)
{
    try
    {
        IResource iresource = getResource(p_hasResource_0_);
        return iresource != null;
    }
    catch (IOException var2)
    {
        return false;
    }
}
项目:BaseClient    文件:Config.java   
public static boolean hasResource(IResourceManager p_hasResource_0_, ResourceLocation p_hasResource_1_)
{
    try
    {
        IResource iresource = p_hasResource_0_.getResource(p_hasResource_1_);
        return iresource != null;
    }
    catch (IOException var3)
    {
        return false;
    }
}
项目:BaseClient    文件:SoundHandler.java   
public void onResourceManagerReload(IResourceManager resourceManager)
{
    this.sndManager.reloadSoundSystem();
    this.sndRegistry.clearMap();

    for (String s : resourceManager.getResourceDomains())
    {
        try
        {
            for (IResource iresource : resourceManager.getAllResources(new ResourceLocation(s, "sounds.json")))
            {
                try
                {
                    Map<String, SoundList> map = this.getSoundMap(iresource.getInputStream());

                    for (Entry<String, SoundList> entry : map.entrySet())
                    {
                        this.loadSoundResource(new ResourceLocation(s, (String)entry.getKey()), (SoundList)entry.getValue());
                    }
                }
                catch (RuntimeException runtimeexception)
                {
                    logger.warn((String)"Invalid sounds.json", (Throwable)runtimeexception);
                }
            }
        }
        catch (IOException var11)
        {
            ;
        }
    }
}
项目:BaseClient    文件:Config.java   
public static boolean hasResource(ResourceLocation p_hasResource_0_)
{
    try
    {
        IResource iresource = getResource(p_hasResource_0_);
        return iresource != null;
    }
    catch (IOException var2)
    {
        return false;
    }
}
项目:BaseClient    文件:Config.java   
public static boolean hasResource(IResourceManager p_hasResource_0_, ResourceLocation p_hasResource_1_)
{
    try
    {
        IResource iresource = p_hasResource_0_.getResource(p_hasResource_1_);
        return iresource != null;
    }
    catch (IOException var3)
    {
        return false;
    }
}
项目:BaseClient    文件:SoundHandler.java   
public void onResourceManagerReload(IResourceManager resourceManager)
{
    this.sndManager.reloadSoundSystem();
    this.sndRegistry.clearMap();

    for (String s : resourceManager.getResourceDomains())
    {
        try
        {
            for (IResource iresource : resourceManager.getAllResources(new ResourceLocation(s, "sounds.json")))
            {
                try
                {
                    Map<String, SoundList> map = this.getSoundMap(iresource.getInputStream());

                    for (Entry<String, SoundList> entry : map.entrySet())
                    {
                        this.loadSoundResource(new ResourceLocation(s, (String)entry.getKey()), (SoundList)entry.getValue());
                    }
                }
                catch (RuntimeException runtimeexception)
                {
                    logger.warn((String)"Invalid sounds.json", (Throwable)runtimeexception);
                }
            }
        }
        catch (IOException var11)
        {
            ;
        }
    }
}