當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureUtil.readImageData方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:tyronx,項目名稱:vintagetg,代碼行數:9,代碼來源:VCraftWorld.java

示例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();
	}
}
 
開發者ID:tyronx,項目名稱:vintagecraft,代碼行數:28,代碼來源:VCraftWorld.java

示例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;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:42,代碼來源:CustomColorizer.java

示例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;
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:42,代碼來源:CustomColorizer.java


注:本文中的net.minecraft.client.renderer.texture.TextureUtil.readImageData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。