use of net.minecraft.client.resources.IResource in project DynamicSurroundings by OreCruncher.
the class SpeechBubbleHandler method loadText.
private void loadText() {
final String[] langs;
if (Minecraft.getMinecraft().gameSettings.language.equals(Translations.DEFAULT_LANGUAGE))
langs = new String[] { Translations.DEFAULT_LANGUAGE };
else
langs = new String[] { Translations.DEFAULT_LANGUAGE, Minecraft.getMinecraft().gameSettings.language };
this.xlate.load("/assets/dsurround/data/chat/", langs);
this.xlate.transform(new Stripper());
try (final IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(SPLASH_TEXT)) {
@SuppressWarnings("deprecation") final BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(resource.getInputStream(), Charsets.UTF_8));
String s;
while ((s = bufferedreader.readLine()) != null) {
s = s.trim();
if (!s.isEmpty()) {
this.minecraftSplashText.add(s);
}
}
} catch (final Throwable t) {
;
}
}
use of net.minecraft.client.resources.IResource in project DynamicSurroundings by OreCruncher.
the class ProxyClient method preInit.
@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);
}
}
}
use of net.minecraft.client.resources.IResource in project EnderIO by SleepyTrousers.
the class DynaTextureProvider method getTexture.
protected BufferedImage getTexture(@Nonnull ResourceLocation blockResource) {
try {
IResource iResource = resourceManager.getResource(blockResource);
BufferedImage image = ImageIO.read(iResource.getInputStream());
iResource.close();
return image;
} catch (IOException e) {
Log.error("Failed to load " + blockResource + ": " + e);
}
return null;
}
use of net.minecraft.client.resources.IResource in project EnderIO by SleepyTrousers.
the class DynaTextureProvider method getTexture.
protected BufferedImage getTexture(@Nonnull ResourceLocation blockResource) {
try {
IResource iResource = resourceManager.getResource(blockResource);
BufferedImage image = ImageIO.read(iResource.getInputStream());
iResource.close();
return image;
} catch (IOException e) {
Log.error("Failed to load " + blockResource + ": " + e);
}
return null;
}
use of net.minecraft.client.resources.IResource in project ForestryMC by ForestryMC.
the class ModelUtil method getReaderForResource.
private static Reader getReaderForResource(ResourceLocation location) throws IOException {
ResourceLocation file = new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + ".json");
IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(file);
return new BufferedReader(new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8));
}
Aggregations