本文整理匯總了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;
}
}