@Override public void drawScreen(int mouseX, int mouseY, float par3) { int x = (this.width - this.backgroundWidth) / 2; int y = (this.height - this.backgroundHeight) / 2 - this.closeButton.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png")); this.drawTexturedModalRect(x, y, 0, 0, this.backgroundWidth, this.backgroundHeight); super.drawScreen(mouseX, mouseY, par3); }
public void renderKamuiBlack() { // Modified copy of RenderItem.renderItem(stack, transformtype) Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(renderStack); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.pushMatrix(); model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false); renderModel(model, renderStack, 0xFF00004C); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
private void drawCrest(){ GlStateManager.color(1, 1, 1, 1); Minecraft.getMinecraft().renderEngine.bindTexture(HeraldryCrestItemRenderer.map_overlay); drawTexturedModalRect((width-400)/2, 50, 128, 128, 0, 0, 1, 1); if(crestDirty){ currentCrest.refreshWith(currentData, true); crestDirty = false; } GlStateManager.color(1F, 1F, 1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); currentCrest.updateDynamicTexture(); ResourceLocation rl = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("gui_crest", currentCrest); Minecraft.getMinecraft().getTextureManager().bindTexture(rl); drawTexturedModalRect((width-400)/2 + 16, 50+16, 96, 96, 0, 0, 1, 1); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); }
private void doInventoryRendering(ItemStack item, HeraldryData heraldryData, IHeraldryItem heraldryItem) { Minecraft.getMinecraft().getTextureManager().bindTexture(map_overlay); BattlegearRenderHelper.renderTexturedQuad(0, 0, itemRenderer.zLevel, 16, 16); //IIcon icon = heraldryItem.getBaseIcon(item); itemRenderer.zLevel += 100; glPushMatrix(); RefreshableTexture currentCrest = new RefreshableTexture(32, 32); currentCrest.refreshWith(heraldryData, false); ResourceLocation crestLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("gui_crest", currentCrest); ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(crestLocation); if(texture == null){ texture = new HeraldryTextureSmall(heraldryData); Minecraft.getMinecraft().getTextureManager().loadTexture(crestLocation, texture); } Minecraft.getMinecraft().getTextureManager().bindTexture(crestLocation); BattlegearRenderHelper.renderTexturedQuad(2, 2, itemRenderer.zLevel, 12, 12); glPopMatrix(); itemRenderer.zLevel -=100; } }
private static boolean textureLoaded(ResourceLocation loc) { //noinspection ConstantConditions - getTexture isn't marked as nullable but can return null return Minecraft.getMinecraft().getTextureManager().getTexture(loc) != null; }
/** * Attempts to download a resource from the web and load it into the game. If the resource * can not be downloaded successfully. * * @param url The URL to download the resource from. This should be the raw/source url. * @param outputResource The ResourceLocation to use for the newly downloaded resource. * @param defaultResource The default texture to use, on the chance that it fails to * download a texture. This must be a valid texture, or else you will get a missing * texture. * @param buffer A special buffer to use when downloading the image. It is okay to pass * null for this if you don't want anything fancy. * @return The downloaded image data. */ public static ThreadDownloadImageData downloadResource (String url, ResourceLocation outputResource, ResourceLocation defaultResource, IImageBuffer buffer) { final TextureManager manager = Minecraft.getMinecraft().getTextureManager(); ThreadDownloadImageData imageData = (ThreadDownloadImageData) manager.getTexture(outputResource); if (imageData == null) { imageData = new ThreadDownloadImageData(null, url, defaultResource, buffer); manager.loadTexture(outputResource, imageData); } return imageData; }
public ResourceLocation register(TextureManager manager, String prefix) { ResourceLocation location = new ResourceLocation(String.format("dynamic_o/%s_%d", prefix, textureCounter)); textureCounter++; manager.loadTexture(location, this); return location; }
String name = "quark:" + f.getName(); resources[i] = mc.getTextureManager().getDynamicTextureLocation(name, tex); } catch (IOException e) { e.printStackTrace();
BufferedImage icon = updateContainer.getIcon(); if (icon != null) { this.cachedLogo.put(idx, ClientProxy.MINECRAFT.getTextureManager().getDynamicTextureLocation("mod_icon", new DynamicTexture(icon))); this.cachedLogoDimensions.put(idx, new Vector2f(icon.getWidth(), icon.getHeight())); ClientProxy.MINECRAFT.renderEngine.bindTexture(this.cachedLogo.get(idx)); float scaleX = this.cachedLogoDimensions.get(idx).getX() / 32.0F; float scaleY = this.cachedLogoDimensions.get(idx).getY() / 32.0F;
Minecraft.getMinecraft().getTextureManager().bindTexture(map_overlay); tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); tess.getBuffer().pos(-8, 136, -.01).tex(0, 1).endVertex(); ResourceLocation crestLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("gui_crest", currentCrest); ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(crestLocation); if(texture == null){ texture = new HeraldryTextureSmall(heraldryData); Minecraft.getMinecraft().getTextureManager().loadTexture(crestLocation, texture); Minecraft.getMinecraft().getTextureManager().bindTexture(crestLocation);
private void renderOverlay(OverlayType type, DinosaurEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float age, float yaw, float pitch, float scale) { ResourceLocation texture = this.renderer.dinosaur.getOverlayTextures(type, entity); if (texture != null) { ITextureObject textureObject = Minecraft.getMinecraft().getTextureManager().getTexture(texture); if (textureObject != TextureUtil.MISSING_TEXTURE) { this.renderer.bindTexture(texture); this.renderer.getMainModel().render(entity, limbSwing, limbSwingAmount, age, yaw, pitch, scale); } } } }
public TextureImageRenderer(final ResourceLocation location) { this.location = location; final TextureManager manager = Minecraft.getMinecraft().getTextureManager(); final ITextureObject image = manager.getTexture(location); if (image instanceof ImageTexture) { this.texture = (ImageTexture) image; } else { if (image != null && image.getGlTextureId() != -1) { TextureUtil.deleteTexture(image.getGlTextureId()); } this.texture = new ImageTexture(location); manager.loadTexture(location, texture); } }
private static boolean loadTexture(ResourceLocation loc, File file) { try { BufferedImage image = ImageIO.read(file); Minecraft.getMinecraft().renderEngine.loadTexture(loc, new TextureImageBased(loc, image)); return true; } catch (IOException e) { //noop } return false; }
public DynaTextureProvider(int textureSize, @Nonnull ResourceLocation fallBackTexture) { this.textureManager = Minecraft.getMinecraft().getTextureManager(); this.resourceManager = Minecraft.getMinecraft().getResourceManager(); this.fallBackTexture = fallBackTexture; this.dynamicTexture = new DynamicTexture(textureSize, textureSize); this.imageData = this.dynamicTexture.getTextureData(); this.resourceLocation = textureManager.getDynamicTextureLocation(EnderIO.DOMAIN, this.dynamicTexture); for (int i = 0; i < this.imageData.length; ++i) { this.imageData[i] = 0; } instances.add(this); }
public void bindTexture( final String file ) { final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file ); this.mc.getTextureManager().bindTexture( loc ); }
@Override public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partialTicks) { this.mc.fontRenderer.drawString(this.preset.getLocalizedName(), x + 32 + 3, y + 1, 0xFFFFFF); String description = TextFormatting.DARK_GRAY + this.preset.getLocalizedDescription(); this.mc.fontRenderer.drawString(description, x + 32 + 3, y + this.mc.fontRenderer.FONT_HEIGHT + 3, 0xFFFFFF); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); TextureManager textureManager = this.mc.getTextureManager(); textureManager.bindTexture(this.icon); if (textureManager.getTexture(this.icon) == TextureUtil.MISSING_TEXTURE) { textureManager.bindTexture(FALLBACK_ICON); } Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 32.0F, 32.0F); if (this.mc.gameSettings.touchscreen || isSelected) { Gui.drawRect(x, y, x + 32, y + 32, 0xA0909090); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); textureManager.bindTexture(ICON_OVERLAY); Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, mouseX - x < 32 ? 32.0F : 0.0F, 32, 32, 256.0F, 256.0F); } }
@Override protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) { if(dirtyTextures){ HeraldryData heraldryData = parent.getCurrentData().clone(); for(int i = 0; i < dynamicTextures.length; i++){ heraldryData.setPattern(i); dynamicTextures[i].refreshWith(heraldryData, true); } dirtyTextures = false; } GlStateManager.color(1F, 1F, 1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); dynamicTextures[var1].updateDynamicTexture(); ResourceLocation rl = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("gui_dynamic_pattern_"+var1, dynamicTextures[var1]); Minecraft.getMinecraft().getTextureManager().bindTexture(rl); drawTexturedModalRect(var5, var2-listWidth/2-8, var3, 16, 16, 0); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); }
private static void finishBreaking() { GlStateManager.disableAlpha(); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.enableAlpha(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
@Override public CachedImage load(Image image) { ITextureObject textureObj = Minecraft.getMinecraft().getTextureManager().getTexture(resource); if(textureObj != null) { return new CachedImage(textureObj.getGlTextureId(), 0, 0, false); } else { AbstractTexture texture = new SimpleTexture(resource); if(Minecraft.getMinecraft().getTextureManager().loadTexture(resource, texture)) { return new CachedImage(texture.getGlTextureId(), 0, 0, false); } return new CachedImage(TextureUtil.MISSING_TEXTURE.getGlTextureId(), 0, 0, false); } } }
public Panorama(String id, String suffix, int zoom) { this.id = id; this.textureLocation = new ResourceLocation(TerrariumEarth.MODID, "panorama_" + id.hashCode() + "_" + suffix); this.zoom = zoom; this.stitchedWidth = (1 << this.zoom) * BASE_PANORAMA_WIDTH; this.stitchedHeight = this.stitchedWidth / 2; this.texture = new DynamicTexture(this.stitchedWidth, this.stitchedHeight); MC.getTextureManager().loadTexture(this.textureLocation, this.texture); Thread thread = new Thread(this::loadTiles); thread.setName("Panorama Load Thread"); thread.setDaemon(true); thread.start(); }