Search in sources :

Example 36 with IResourcePack

use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.

the class Footsteps method reloadVariator.

private void reloadVariator(final List<IResourcePack> repo) {
    final IVariator var = new NormalVariator();
    for (final IResourcePack pack : repo) {
        InputStream stream = null;
        try {
            stream = this.dealer.openVariator(pack);
            if (stream != null)
                var.loadConfig(ConfigProperty.fromStream(stream));
        } catch (final Exception e) {
            ModLog.debug("Unable to load variator data from pack %s", pack.getPackName());
        } finally {
            if (stream != null)
                try {
                    stream.close();
                } catch (final IOException e) {
                    ;
                }
        }
    }
    this.isolator.setVariator(var);
}
Also used : IVariator(org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IVariator) InputStream(java.io.InputStream) IOException(java.io.IOException) IResourcePack(net.minecraft.client.resources.IResourcePack) NormalVariator(org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem.NormalVariator) IOException(java.io.IOException)

Example 37 with IResourcePack

use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.

the class Footsteps method reloadPrimitiveMap.

private void reloadPrimitiveMap(final List<IResourcePack> repo) {
    final IPrimitiveMap primitiveMap = new BasicPrimitiveMap();
    for (final IResourcePack pack : repo) {
        InputStream stream = null;
        try {
            stream = this.dealer.openPrimitiveMap(pack);
            if (stream != null)
                Register.setup(ConfigProperty.fromStream(stream), primitiveMap);
        } catch (final IOException e) {
            ModLog.debug("Unable to load primitive map data from pack %s", pack.getPackName());
        } finally {
            if (stream != null)
                try {
                    stream.close();
                } catch (final IOException e) {
                    ;
                }
        }
    }
    this.isolator.setPrimitiveMap(primitiveMap);
}
Also used : InputStream(java.io.InputStream) BasicPrimitiveMap(org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem.BasicPrimitiveMap) IOException(java.io.IOException) IPrimitiveMap(org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IPrimitiveMap) IResourcePack(net.minecraft.client.resources.IResourcePack)

Aggregations

IResourcePack (net.minecraft.client.resources.IResourcePack)36 IOException (java.io.IOException)13 File (java.io.File)12 InputStream (java.io.InputStream)10 List (java.util.List)10 ArrayList (java.util.ArrayList)8 ResourceLocation (net.minecraft.util.ResourceLocation)7 ResourcePackRepository (net.minecraft.client.resources.ResourcePackRepository)6 Field (java.lang.reflect.Field)5 AbstractResourcePack (net.minecraft.client.resources.AbstractResourcePack)4 IResourceManager (net.minecraft.client.resources.IResourceManager)4 LegacyV2Adapter (net.minecraft.client.resources.LegacyV2Adapter)4 FileNotFoundException (java.io.FileNotFoundException)3 Set (java.util.Set)3 FallbackResourceManager (net.minecraft.client.resources.FallbackResourceManager)3 FMLClientHandler (net.minecraftforge.fml.client.FMLClientHandler)3 Dimension (java.awt.Dimension)2 BufferedImage (java.awt.image.BufferedImage)2 FileInputStream (java.io.FileInputStream)2 Map (java.util.Map)2