private static void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack) { boolean flag = color == -1 && !stack.isEmpty(); int i = 0; for (int j = quads.size(); i < j; ++i) { BakedQuad bakedquad = (BakedQuad) quads.get(i); int k = color; if (flag && bakedquad.hasTintIndex()) { k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) { k = TextureUtil.anaglyphColor(k); } k = k | -16777216; } net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); } }
public static void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color, ItemStack stack) { boolean flag = (color == -1) && (!stack.isEmpty()); int i = 0; for (int j = quads.size(); i < j; i++) { BakedQuad bakedquad = quads.get(i); int k = color; if ((flag) && (bakedquad.hasTintIndex())) { ItemColors itemColors = Minecraft.getMinecraft().getItemColors(); k = itemColors.getColorFromItemstack(stack, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) { k = TextureUtil.anaglyphColor(k); } k |= 0xFF000000; } LightUtil.renderQuadColor(renderer, bakedquad, k); } }
private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color, ItemStack stack) { boolean flag = color == -1 && stack != null; int i = 0; for (int j = quads.size(); i < j; ++i) { BakedQuad bakedquad = (BakedQuad)quads.get(i); int k = color; if (flag && bakedquad.hasTintIndex()) { k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) { k = TextureUtil.anaglyphColor(k); } k = k | -16777216; } this.renderQuad(renderer, bakedquad, k); } }
public void renderModelBrightness(IBakedModel p_178266_1_, IBlockState p_178266_2_, float p_178266_3_, boolean p_178266_4_) { Block block = p_178266_2_.getBlock(); block.setBlockBoundsForItemRender(); GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); int i = block.getRenderColor(block.getStateForEntityRender(p_178266_2_)); if (EntityRenderer.anaglyphEnable) { i = TextureUtil.anaglyphColor(i); } float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; if (!p_178266_4_) { GlStateManager.color(p_178266_3_, p_178266_3_, p_178266_3_, 1.0F); } this.renderModelBrightnessColor(p_178266_1_, p_178266_3_, f, f1, f2); }
private void checkTextureUploaded() { if (!this.textureUploaded) { if (this.bufferedImage != null) { if (this.textureLocation != null) { this.deleteGlTexture(); } TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage); this.textureUploaded = true; } } }
public void drawString(final String text, double x, double y, final Color color, final boolean shadow) { x *= 2; y = y * 2 - 2; glPushMatrix(); // glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); glScaled(0.25D, 0.25D, 0.25D); // glColor4f(1.0F, 1.0F, 1.0F, 1.0F); TextureUtil.bindTexture(texID); glColor(shadow ? new Color(0.05F, 0.05F, 0.05F, color.getAlpha() / 255F) : color); final int size = text.length(); for(int indexInString = 0; indexInString < size; indexInString++) { final char character = text.charAt(indexInString); if(character < chars.length && character >= 0) { drawChar(character, (float)x, (float)y); x += chars[character].width - charOffset; } } glPopMatrix(); }
public static void initDynamicTexture(int texID, int width, int height, DynamicTexture tex) { MultiTexID multitexid = tex.getMultiTexID(); int[] aint = tex.getTextureData(); int i = width * height; Arrays.fill(aint, i, i * 2, -8421377); Arrays.fill((int[])aint, i * 2, i * 3, (int)0); TextureUtil.allocateTexture(multitexid.base, width, height); TextureUtil.setTextureBlurMipmap(false, false); TextureUtil.setTextureClamped(false); TextureUtil.allocateTexture(multitexid.norm, width, height); TextureUtil.setTextureBlurMipmap(false, false); TextureUtil.setTextureClamped(false); TextureUtil.allocateTexture(multitexid.spec, width, height); TextureUtil.setTextureBlurMipmap(false, false); TextureUtil.setTextureClamped(false); GlStateManager.bindTexture(multitexid.base); }
public static void allocateTextureMap(int texID, int mipmapLevels, int width, int height, Stitcher stitcher, TextureMap tex) { SMCLog.info("allocateTextureMap " + mipmapLevels + " " + width + " " + height + " "); updatingTextureMap = tex; tex.atlasWidth = width; tex.atlasHeight = height; MultiTexID multitexid = getMultiTexID(tex); updatingTex = multitexid; TextureUtil.allocateTextureImpl(multitexid.base, mipmapLevels, width, height); if (Shaders.configNormalMap) { TextureUtil.allocateTextureImpl(multitexid.norm, mipmapLevels, width, height); } if (Shaders.configSpecularMap) { TextureUtil.allocateTextureImpl(multitexid.spec, mipmapLevels, width, height); } GlStateManager.bindTexture(texID); }
public static void uploadTexSubForLoadAtlas(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) { TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp); boolean flag = false; if (Shaders.configNormalMap) { int[][] aint = readImageAndMipmaps(iconName + "_n", width, height, data.length, flag, -8421377); GlStateManager.bindTexture(updatingTex.norm); TextureUtil.uploadTextureMipmap(aint, width, height, xoffset, yoffset, linear, clamp); } if (Shaders.configSpecularMap) { int[][] aint1 = readImageAndMipmaps(iconName + "_s", width, height, data.length, flag, 0); GlStateManager.bindTexture(updatingTex.spec); TextureUtil.uploadTextureMipmap(aint1, width, height, xoffset, yoffset, linear, clamp); } GlStateManager.bindTexture(updatingTex.base); }
public static void uploadTexSub(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) { TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp); if (Shaders.configNormalMap || Shaders.configSpecularMap) { if (Shaders.configNormalMap) { GlStateManager.bindTexture(updatingTex.norm); uploadTexSub1(data, width, height, xoffset, yoffset, 1); } if (Shaders.configSpecularMap) { GlStateManager.bindTexture(updatingTex.spec); uploadTexSub1(data, width, height, xoffset, yoffset, 2); } GlStateManager.bindTexture(updatingTex.base); } }
public void drawString(final String text, double x, double y, final Color color, final boolean shadow) { x *= 2; y = y * 2 - 2; glPushMatrix(); // glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); glScaled(0.25D, 0.25D, 0.25D); // glColor4f(1.0F, 1.0F, 1.0F, 1.0F); TextureUtil.bindTexture(texID); glColor(shadow ? new Color(0.05F, 0.05F, 0.05F, color.getAlpha() / 255F) : color); final int size = text.length(); for (int indexInString = 0; indexInString < size; indexInString++) { final char character = text.charAt(indexInString); if (character < chars.length && character >= 0) { drawChar(character, (float) x, (float) y); x += chars[character].width - charOffset; } } glPopMatrix(); }
public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = Shaders.getShaderPackResourceStream(this.texturePath); if (inputstream == null) { throw new FileNotFoundException("Shader texture not found: " + this.texturePath); } else { try { BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); TextureMetadataSection texturemetadatasection = this.loadTextureMetadataSection(); TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, texturemetadatasection.getTextureBlur(), texturemetadatasection.getTextureClamp()); } finally { IOUtils.closeQuietly(inputstream); } } }
public void drawString(final String text, double x, double y, final Color color, final boolean shadow) { x *= 2; y = y * 2 - 2; glPushMatrix(); glScaled(0.25D, 0.25D, 0.25D); TextureUtil.bindTexture(texID); glColor(shadow ? new Color(0.05F, 0.05F, 0.05F, color.getAlpha() / 255F) : color); final int size = text.length(); for(int indexInString = 0; indexInString < size; indexInString++) { final char character = text.charAt(indexInString); if(character < chars.length && character >= 0) { drawChar(character, (float)x, (float)y); x += chars[character].width - charOffset; } } glPopMatrix(); }
public void renderModelBrightness(IBakedModel model, IBlockState state, float brightness, boolean p_178266_4_) { Block block = state.getBlock(); GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); int i = this.blockColors.colorMultiplier(state, (IBlockAccess)null, (BlockPos)null, 0); if (EntityRenderer.anaglyphEnable) { i = TextureUtil.anaglyphColor(i); } float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; if (!p_178266_4_) { GlStateManager.color(brightness, brightness, brightness, 1.0F); } this.renderModelBrightnessColor(state, model, brightness, f, f1, f2); }
private void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color, @Nullable ItemStack stack) { boolean flag = color == -1 && stack != null; int i = 0; for (int j = quads.size(); i < j; ++i) { BakedQuad bakedquad = (BakedQuad)quads.get(i); int k = color; if (flag && bakedquad.hasTintIndex()) { k = this.itemColors.getColorFromItemstack(stack, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) { k = TextureUtil.anaglyphColor(k); } k = k | -16777216; } net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); } }
public FriendEntry(String username, String status, String rank) { this.username = username; this.status = status; this.rank = rank; this.headLocation = new ResourceLocation("rewimod/" + username + "/head"); try { URL obj = new URL("https://minotar.net/helm/" + username + "/32.png"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); //add request header con.setRequestProperty("User-Agent", "Minecraft"); InputStream stream = con.getInputStream(); this.headImage = TextureUtil.readBufferedImage(stream); } catch (Exception ex) { } }
private void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack) { boolean flag = color == -1 && !stack.isEmpty(); int i = 0; for (int j = quads.size(); i < j; ++i) { BakedQuad bakedquad = quads.get(i); int k = color; if (flag && bakedquad.hasTintIndex()) { k = this.mc.getItemColors().getColorFromItemstack(stack, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) k = TextureUtil.anaglyphColor(k); k = k | -16777216; } LightUtil.renderQuadColor(renderer, bakedquad, k); } }
@Override public @Nonnull DynamicImageTexture loadDirect() { final int[][] mipdata = this.mipdata; if (mipdata!=null&&mipdata.length>=1) { final int id = getId(); if (this.miplevel>=1) { TextureUtil.allocateTextureImpl(id, this.miplevel, this.width, this.height, Client.mc.gameSettings.anisotropicFiltering); TextureUtil.uploadTextureMipmap(mipdata, this.width, this.height, 0, 0, false, false); } else { TextureUtil.allocateTexture(id, this.width, this.height); TextureUtil.uploadTexture(id, mipdata[0], this.width, this.height); } this.mipdata = null; } return this; }
public static void convertTextureToGrayScale() throws IOException { IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); try { BufferedImage vanillaCreeperTextureData = TextureUtil.readBufferedImage(resourceManager.getResource(vanillaCreeperTexture).getInputStream()); // Do the conversion to grayscale BufferedImage creeperTextureData = new BufferedImage(vanillaCreeperTextureData.getWidth(), vanillaCreeperTextureData.getHeight(), BufferedImage.TYPE_USHORT_GRAY); Graphics g = creeperTextureData.getGraphics(); g.drawImage(vanillaCreeperTextureData, 0, 0, null); g.dispose(); DynamicTexture dynamicGrayscaleCreeperTexture = new DynamicTexture(creeperTextureData); grayscaleCreeperTexture = new ResourceLocation(ChameleonCreepersMod.MODID, "textures/entity/creeper/chameleoncreeper.png"); Minecraft.getMinecraft().getTextureManager().loadTexture(grayscaleCreeperTexture, dynamicGrayscaleCreeperTexture); } catch (IOException e) { e.printStackTrace(); } }
@Override public ResourceLocation getLogoTexture() { if (logoTexture == null) { if (logoBytes != null || logo != null) { try { InputStream in; if (logoBytes == null) { in = new URL(getModFile().toURI().toURL().toString() + '/' + logo).openStream(); } else { in = new ByteArrayInputStream(logoBytes); } BufferedImage image = TextureUtil.readBufferedImage(in); DynamicTexture texture = new DynamicTexture(image); this.logoTexture = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("mods/" + getModID(), texture); in.close(); logoBytes = null; } catch (IOException e) { throw new RuntimeException(e); } } else { logoTexture = new ResourceLocation("textures/misc/unknown_server.png"); } } return logoTexture; }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { TextureManager manager = Minecraft.getMinecraft().renderEngine; Map<ResourceLocation, ITextureObject> map = getTextures(manager); if (map != null) { Iterator<Map.Entry<ResourceLocation, ITextureObject>> it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry<ResourceLocation, ITextureObject> entry = it.next(); if (entry.getKey().getResourceDomain().equals("blockbuster.actors") && entry.getValue() instanceof DynamicTexture) { TextureUtil.deleteTexture(entry.getValue().getGlTextureId()); it.remove(); } } } }
private void RenderHelper_a(BufferBuilder p_175032_1_, List p_175032_2_, int p_175032_3_, ItemStack p_175032_4_) { boolean flag = p_175032_3_ == -1 && p_175032_4_ != null; BakedQuad bakedquad; int j; for (Iterator iterator = p_175032_2_.iterator(); iterator.hasNext(); this.RenderHelper_B(p_175032_1_, bakedquad, j)) { bakedquad = (BakedQuad) iterator.next(); j = p_175032_3_; if (flag && bakedquad.hasTintIndex()) { // j = p_175032_4_.getItem().getColorFromItemStack(p_175032_4_, bakedquad.getTintIndex()); if (EntityRenderer.anaglyphEnable) { j = TextureUtil.anaglyphColor(j); } j |= -16777216; } } }
public void replaceTextureData(int[] pixels, int mipmapLevels) throws Exception { BetterBarrels.debug("37p1 - entering texture replacement with " + mipmapLevels + " mipmap levels."); int[][] aint = new int[1 + mipmapLevels][]; aint[0] = pixels; fixPixels.invoke(this, new Object[] { aint }); boolean useAnisotropic = useAnisotropic.getBoolean(this); aint = (int[][])setupAnisotropic.invoke(this, new Object[] { aint, Integer.valueOf(useAnisotropic ? this.field_130223_c - 16 : this.field_130223_c), Integer.valueOf(useAnisotropic ? this.field_130224_d - 16 : this.field_130224_d) }); aint = TextureUtil.func_147949_a(mipmapLevels, this.field_130223_c, aint); BetterBarrels.debug("37 - Attempting to replace texture for [" + func_94215_i() + "] with an array of [" + (aint != null ? Integer.valueOf(aint[0].length) : "(null)") + "] pixels, current texture dims are [" + this.field_130223_c + "x" + this.field_130224_d + "] for a total size of " + this.field_130223_c * this.field_130224_d); BetterBarrels.debug(toString()); if (aint[0].length != this.field_130224_d * this.field_130223_c) { throw new Exception("Attempting to replace texture image data with " + (aint[0].length > this.field_130224_d * this.field_130223_c ? "too much" : "too little") + " data."); } BetterBarrels.debug("38 - Calling Minecraft Texture upload utility method"); TextureUtil.func_147955_a(aint, this.field_130223_c, this.field_130224_d, this.field_110975_c, this.field_110974_d, false, false); func_130103_l(); }
private static int[] getPixelsForTexture(boolean item, ResourceLocation resourcelocation) { BetterBarrels.debug("09 - Entering texture load method for texture : " + resourcelocation.toString()); ResourceLocation resourcelocation1 = new ResourceLocation(resourcelocation.func_110624_b(), String.format("%s/%s%s", new Object[] { item ? "textures/items" : "textures/blocks", resourcelocation.func_110623_a(), ".png" })); BetterBarrels.debug("11 - Modified resource path : " + resourcelocation1.toString()); int[] pixels = null; try { pixels = TextureUtil.func_110986_a(Minecraft.func_71410_x().func_110442_L(), resourcelocation1); } catch (Throwable t) { BetterBarrels.log.warn("JABBA-Debug Problem loading texture: " + resourcelocation); } BetterBarrels.debug("12 - read texture data of length : " + (pixels != null ? Integer.valueOf(pixels.length) : "(null)")); return pixels; }