use of net.minecraft.client.resources.IResourcePack in project CumServerPro by MCUmbrella.
the class FMLClientHandler method addModAsResource.
@Override
public void addModAsResource(ModContainer container) {
Class<?> resourcePackType = container.getCustomResourcePackClass();
if (resourcePackType != null) {
try {
IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container);
PackMetadataSection meta = (PackMetadataSection) pack.getPackMetadata(this.metaSerializer, "pack");
if (meta != null && meta.getPackFormat() == 2) {
pack = new LegacyV2Adapter(pack);
}
resourcePackList.add(pack);
resourcePackMap.put(container.getModId(), pack);
} catch (NoSuchMethodException e) {
FMLLog.log.error("The container {} (type {}) returned an invalid class for its resource pack.", container.getName(), container.getClass().getName());
} catch (Exception e) {
FormattedMessage message = new FormattedMessage("An unexpected exception occurred constructing the custom resource pack for {} ({})", container.getName(), container.getModId());
throw new RuntimeException(message.getFormattedMessage(), e);
}
}
}
use of net.minecraft.client.resources.IResourcePack in project WizClient-1.8.9-Version by WizClient.
the class CustomItems method update.
public static void update() {
itemProperties = (CustomItemProperties[][]) null;
enchantmentProperties = (CustomItemProperties[][]) null;
useGlint = true;
if (Config.isCustomItems()) {
readCitProperties("mcpatcher/cit.properties");
IResourcePack[] airesourcepack = Config.getResourcePacks();
for (int i = airesourcepack.length - 1; i >= 0; --i) {
IResourcePack iresourcepack = airesourcepack[i];
update(iresourcepack);
}
update(Config.getDefaultResourcePack());
if (itemProperties.length <= 0) {
itemProperties = (CustomItemProperties[][]) null;
}
if (enchantmentProperties.length <= 0) {
enchantmentProperties = (CustomItemProperties[][]) null;
}
}
}
use of net.minecraft.client.resources.IResourcePack in project WizClient-1.8.9-Version by WizClient.
the class Config method getDefiningResourcePack.
public static IResourcePack getDefiningResourcePack(ResourceLocation p_getDefiningResourcePack_0_) {
ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository();
IResourcePack iresourcepack = resourcepackrepository.getResourcePackInstance();
if (iresourcepack != null && iresourcepack.resourceExists(p_getDefiningResourcePack_0_)) {
return iresourcepack;
} else {
List<ResourcePackRepository.Entry> list = resourcepackrepository.repositoryEntries;
for (int i = list.size() - 1; i >= 0; --i) {
ResourcePackRepository.Entry resourcepackrepository$entry = (ResourcePackRepository.Entry) list.get(i);
IResourcePack iresourcepack1 = resourcepackrepository$entry.getResourcePack();
if (iresourcepack1.resourceExists(p_getDefiningResourcePack_0_)) {
return iresourcepack1;
}
}
if (getDefaultResourcePack().resourceExists(p_getDefiningResourcePack_0_)) {
return getDefaultResourcePack();
} else {
return null;
}
}
}
use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.
the class PFResourcePackDealer method findResourcePacks.
public List<IResourcePack> findResourcePacks() {
final List<ResourcePackRepository.Entry> repo = Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries();
final List<IResourcePack> foundEntries = new ArrayList<IResourcePack>();
foundEntries.add(new DefaultPack());
// a config file embedded.
for (final ModContainer mod : Loader.instance().getActiveModList()) foundEntries.add(new DefaultPack(mod.getModId()));
for (final ResourcePackRepository.Entry pack : repo) {
ModLog.debug("Resource Pack: %s", pack.getResourcePackName());
if (checkCompatible(pack)) {
ModLog.debug("Found Footsteps resource pack: %s", pack.getResourcePackName());
foundEntries.add(pack.getResourcePack());
}
}
return foundEntries;
}
use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.
the class Footsteps method reloadBlockMap.
private void reloadBlockMap(final List<IResourcePack> repo) {
final IBlockMap blockMap = new LegacyCapableBlockMap();
ForgeDictionary.initialize(blockMap);
for (final IResourcePack pack : repo) {
InputStream stream = null;
try {
stream = this.dealer.openBlockMap(pack);
if (stream != null)
Register.setup(ConfigProperty.fromStream(stream), blockMap);
} catch (final IOException e) {
ModLog.debug("Unable to load block map data from pack %s", pack.getPackName());
} finally {
if (stream != null)
try {
stream.close();
} catch (final IOException e) {
;
}
}
}
this.isolator.setBlockMap(blockMap);
}
Aggregations