use of net.minecraft.client.resources.IResourcePack in project MinecraftForge by MinecraftForge.
the class FMLClientHandler method logMissingTextureErrors.
public void logMissingTextureErrors() {
if (missingTextures.isEmpty() && brokenTextures.isEmpty()) {
return;
}
Logger logger = LogManager.getLogger("TEXTURE ERRORS");
logger.error(Strings.repeat("+=", 25));
logger.error("The following texture errors were found.");
Map<String, FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548" + "_a");
for (String resourceDomain : badTextureDomains) {
Set<ResourceLocation> missing = missingTextures.get(resourceDomain);
logger.error(Strings.repeat("=", 50));
logger.error(" DOMAIN {}", resourceDomain);
logger.error(Strings.repeat("-", 50));
logger.error(" domain {} is missing {} texture{}", resourceDomain, missing.size(), missing.size() != 1 ? "s" : "");
FallbackResourceManager fallbackResourceManager = resManagers.get(resourceDomain);
if (fallbackResourceManager == null) {
logger.error(" domain {} is missing a resource manager - it is probably a side-effect of automatic texture processing", resourceDomain);
} else {
List<IResourcePack> resPacks = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, fallbackResourceManager, "resourcePacks", "field_110540" + "_a");
logger.error(" domain {} has {} location{}:", resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" : "");
for (IResourcePack resPack : resPacks) {
if (resPack instanceof FMLContainerHolder) {
FMLContainerHolder containerHolder = (FMLContainerHolder) resPack;
ModContainer fmlContainer = containerHolder.getFMLContainer();
logger.error(" mod {} resources at {}", fmlContainer.getModId(), fmlContainer.getSource().getPath());
} else if (resPack instanceof AbstractResourcePack) {
AbstractResourcePack resourcePack = (AbstractResourcePack) resPack;
File resPath = ObfuscationReflectionHelper.getPrivateValue(AbstractResourcePack.class, resourcePack, "resourcePackFile", "field_110597" + "_b");
logger.error(" resource pack at path {}", resPath.getPath());
} else {
logger.error(" unknown resourcepack type {} : {}", resPack.getClass().getName(), resPack.getPackName());
}
}
}
logger.error(Strings.repeat("-", 25));
if (missingTextures.containsKey(resourceDomain)) {
logger.error(" The missing resources for domain {} are:", resourceDomain);
for (ResourceLocation rl : missing) {
logger.error(" {}", rl.getResourcePath());
}
logger.error(Strings.repeat("-", 25));
}
if (!brokenTextures.containsRow(resourceDomain)) {
logger.error(" No other errors exist for domain {}", resourceDomain);
} else {
logger.error(" The following other errors were reported for domain {}:", resourceDomain);
Map<String, Set<ResourceLocation>> resourceErrs = brokenTextures.row(resourceDomain);
for (String error : resourceErrs.keySet()) {
logger.error(Strings.repeat("-", 25));
logger.error(" Problem: {}", error);
for (ResourceLocation rl : resourceErrs.get(error)) {
logger.error(" {}", rl.getResourcePath());
}
}
}
logger.error(Strings.repeat("=", 50));
}
logger.error(Strings.repeat("+=", 25));
}
use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.
the class Footsteps method reloadAcoustics.
private void reloadAcoustics(final List<IResourcePack> repo) {
AcousticsManager acoustics = new AcousticsManager(this.isolator);
Scanner scanner = null;
InputStream stream = null;
for (final IResourcePack pack : repo) {
try {
stream = this.dealer.openAcoustics(pack);
if (stream != null) {
scanner = new Scanner(stream);
final String jasonString = scanner.useDelimiter("\\Z").next();
new AcousticsJsonReader("").parseJSON(jasonString, acoustics);
}
} catch (final IOException e) {
ModLog.debug("Unable to load acoustic data from pack %s", pack.getPackName());
} finally {
try {
if (scanner != null)
scanner.close();
if (stream != null)
stream.close();
} catch (final IOException e) {
;
}
}
}
this.isolator.setAcoustics(acoustics);
this.isolator.setSoundPlayer(new UserConfigSoundPlayerWrapper(acoustics));
this.isolator.setDefaultStepPlayer(acoustics);
}
use of net.minecraft.client.resources.IResourcePack in project BetterRain by OreCruncher.
the class Footsteps method reloadEverything.
public void reloadEverything() {
this.isolator = new PFIsolator();
final List<IResourcePack> repo = this.dealer.findResourcePacks();
reloadBlockMap(repo);
reloadPrimitiveMap(repo);
reloadAcoustics(repo);
this.isolator.setSolver(new PFSolver(this.isolator));
reloadVariator(repo);
this.isolator.setGenerator(new PFReaderH(this.isolator));
/*
* this.isolator.setGenerator(getConfig().getInteger("custom.stance") ==
* 0 ? new PFReaderH(this.isolator) : new PFReaderQP(this.isolator));
*/
}
use of net.minecraft.client.resources.IResourcePack in project MinecraftForge by MinecraftForge.
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(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return;
} catch (Exception e) {
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
throw Throwables.propagate(e);
}
}
}
use of net.minecraft.client.resources.IResourcePack in project MinecraftForge by MinecraftForge.
the class GuiModList method updateCache.
private void updateCache() {
configModButton.visible = false;
disableModButton.visible = false;
modInfo = null;
if (selectedMod == null)
return;
ResourceLocation logoPath = null;
Dimension logoDims = new Dimension(0, 0);
List<String> lines = new ArrayList<String>();
CheckResult vercheck = ForgeVersion.getResult(selectedMod);
String logoFile = selectedMod.getMetadata().logoFile;
if (!logoFile.isEmpty()) {
TextureManager tm = mc.getTextureManager();
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
try {
BufferedImage logo = null;
if (pack != null) {
logo = pack.getPackImage();
} else {
InputStream logoResource = getClass().getResourceAsStream(logoFile);
if (logoResource != null)
logo = ImageIO.read(logoResource);
}
if (logo != null) {
logoPath = tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo));
logoDims = new Dimension(logo.getWidth(), logo.getHeight());
}
} catch (IOException e) {
}
}
if (!selectedMod.getMetadata().autogenerated) {
disableModButton.visible = true;
disableModButton.enabled = true;
disableModButton.packedFGColour = 0;
Disableable disableable = selectedMod.canBeDisabled();
if (disableable == Disableable.RESTART) {
disableModButton.packedFGColour = 0xFF3377;
} else if (disableable != Disableable.YES) {
disableModButton.enabled = false;
}
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
configModButton.visible = true;
configModButton.enabled = guiFactory != null && guiFactory.mainConfigGuiClass() != null;
lines.add(selectedMod.getMetadata().name);
lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)));
if (!selectedMod.getMetadata().credits.isEmpty()) {
lines.add("Credits: " + selectedMod.getMetadata().credits);
}
lines.add("Authors: " + selectedMod.getMetadata().getAuthorList());
lines.add("URL: " + selectedMod.getMetadata().url);
if (selectedMod.getMetadata().childMods.isEmpty())
lines.add("No child mods for this mod");
else
lines.add("Child mods: " + selectedMod.getMetadata().getChildModList());
if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(null);
lines.add(selectedMod.getMetadata().description);
} else {
lines.add(WHITE + selectedMod.getName());
lines.add(WHITE + "Version: " + selectedMod.getVersion());
lines.add(WHITE + "Mod State: " + Loader.instance().getModState(selectedMod));
if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(null);
lines.add(RED + "No mod information found");
lines.add(RED + "Ask your mod author to provide a mod mcmod.info file");
}
if ((vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED) && vercheck.changes.size() > 0) {
lines.add(null);
lines.add("Changes:");
for (Entry<ComparableVersion, String> entry : vercheck.changes.entrySet()) {
lines.add(" " + entry.getKey() + ":");
lines.add(entry.getValue());
lines.add(null);
}
}
modInfo = new Info(this.width - this.listWidth - 30, lines, logoPath, logoDims);
}
Aggregations