本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureUtil.readImageData方法的典型用法代码示例。如果您正苦于以下问题:Java TextureUtil.readImageData方法的具体用法?Java TextureUtil.readImageData怎么用?Java TextureUtil.readImageData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.texture.TextureUtil
的用法示例。
在下文中一共展示了TextureUtil.readImageData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadGrassColors
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void loadGrassColors(IResourceManager resourceManager) {
try {
grassBuffer = TextureUtil.readImageData(resourceManager, grassColormap);
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: loadTextures
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void loadTextures(IResourceManager resourceManager) {
try {
grassBuffer = TextureUtil.readImageData(resourceManager, grassColormap);
BufferedImage bufferedimage = TextureUtil.readBufferedImage(resourceManager.getResource(cloudResourceLocation).getInputStream());
cloudTextureWidth = bufferedimage.getWidth();
cloudTextureHeight = bufferedimage.getHeight();
int[] cloudPixels = new int[256 * 256];
bufferedimage.getRGB(0, 0, cloudTextureWidth, cloudTextureHeight, cloudPixels, 0, cloudTextureWidth);
// For low or high res clouds
float scale = cloudTextureWidth / 256;
for (int x = 0; x < 256; x++) {
for (int y = 0; y < 256; y++) {
cloudBuffer[x + 256 * y] = ((cloudPixels[(int) (x * scale + 256 * y * scale)] >> 24) & 0xff) > 0;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: getCustomColors
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
private static int[] getCustomColors(String p_getCustomColors_0_, int p_getCustomColors_1_)
{
try
{
ResourceLocation resourcelocation = new ResourceLocation(p_getCustomColors_0_);
InputStream inputstream = Config.getResourceStream(resourcelocation);
if (inputstream == null)
{
return null;
}
else
{
int[] aint = TextureUtil.readImageData(Config.getResourceManager(), resourcelocation);
if (aint == null)
{
return null;
}
else if (p_getCustomColors_1_ > 0 && aint.length != p_getCustomColors_1_)
{
Config.log("Invalid custom colors length: " + aint.length + ", path: " + p_getCustomColors_0_);
return null;
}
else
{
Config.log("Loading custom colors: " + p_getCustomColors_0_);
return aint;
}
}
}
catch (FileNotFoundException var5)
{
return null;
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
return null;
}
}
示例4: getCustomColors
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
private static int[] getCustomColors(String path, int length)
{
try
{
ResourceLocation e = new ResourceLocation(path);
InputStream in = Config.getResourceStream(e);
if (in == null)
{
return null;
}
else
{
int[] colors = TextureUtil.readImageData(Config.getResourceManager(), e);
if (colors == null)
{
return null;
}
else if (length > 0 && colors.length != length)
{
Config.log("Invalid custom colors length: " + colors.length + ", path: " + path);
return null;
}
else
{
Config.log("Loading custom colors: " + path);
return colors;
}
}
}
catch (FileNotFoundException var5)
{
return null;
}
catch (IOException var6)
{
var6.printStackTrace();
return null;
}
}