Java Code Examples for net.minecraft.client.renderer.texture.TextureMap#getTextureExtry()
The following examples show how to use
net.minecraft.client.renderer.texture.TextureMap#getTextureExtry() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluidStackRenderer.java From YouTubeModdingTutorial with MIT License | 6 votes |
public static boolean renderFluidStack(FluidStack fluidStack, int x, int y) { Fluid fluid = fluidStack.getFluid(); if (fluid == null) { return false; } Minecraft mc = Minecraft.getMinecraft(); TextureMap textureMapBlocks = mc.getTextureMapBlocks(); ResourceLocation fluidStill = fluid.getStill(); TextureAtlasSprite fluidStillSprite = null; if (fluidStill != null) { fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString()); } if (fluidStillSprite == null) { fluidStillSprite = textureMapBlocks.getMissingSprite(); } int fluidColor = fluid.getColor(fluidStack); mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); setGLColorFromInt(fluidColor); drawFluidTexture(x, y, fluidStillSprite); return true; }
Example 2
Source File: QBImporter.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public TextureAtlasSprite getIcon(String key, TextureMap textureMap) { int img = map.get(key).img; String iconName = "QBModel" + hashCode() + "_img"; TextureAtlasSprite icon = textureMap.getTextureExtry(iconName); if (icon != null) { return icon; } return TextureUtils.getTextureSpecial(textureMap, iconName).addTexture(new TextureDataHolder(images.get(img))); }
Example 3
Source File: QBImporter.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public TextureAtlasSprite getIcon(String key, TextureMap textureMap) { int img = map.get(key).img; String iconName = "QBModel"+hashCode()+"_img"; TextureAtlasSprite icon = textureMap.getTextureExtry(iconName); if(icon != null) return icon; return TextureUtils.getTextureSpecial(textureMap, iconName).addTexture(new TextureDataHolder(images.get(img))); }
Example 4
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static TextureAtlasSprite getBlankIcon(int size, TextureMap textureMap) { String s = "blank_" + size; TextureAtlasSprite icon = textureMap.getTextureExtry(s); if (icon == null) textureMap.setTextureEntry(s, icon = new TextureSpecial(s).blank(size)); return icon; }
Example 5
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static TextureSpecial getTextureSpecial(TextureMap textureMap, String name) { if (textureMap.getTextureExtry(name) != null) throw new IllegalStateException("Texture: " + name + " is already registered"); TextureSpecial icon = new TextureSpecial(name); textureMap.setTextureEntry(name, icon); return icon; }
Example 6
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
/** * Uses an empty placeholder texture to tell if the map has been reloaded since the last call to refresh texture and the texture with name needs to be reacquired to be valid */ public static boolean refreshTexture(TextureMap map, String name) { if (map.getTextureExtry(name) == null) { map.setTextureEntry(name, new PlaceholderTexture(name)); return true; } return false; }
Example 7
Source File: RenderTank.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void render(TileEntity tile, double x, double y, double z, float f, int damage, float a) { IFluidHandler fluidTile = (IFluidHandler)tile; FluidStack fluid = fluidTile.getTankProperties()[0].getContents(); ResourceLocation fluidIcon = new ResourceLocation("advancedrocketry:textures/blocks/fluid/oxygen_flow.png"); if(fluid != null && fluid.getFluid() != null) { GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, (float)z); double minU = 0, maxU = 1, minV = 0, maxV = 1; TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite sprite = map.getTextureExtry(fluid.getFluid().getStill().toString()); if(sprite != null) { minU = sprite.getMinU(); maxU = sprite.getMaxU(); minV = sprite.getMinV(); maxV = sprite.getMaxV(); GlStateManager.bindTexture(map.getGlTextureId()); } else { int color = fluid.getFluid().getColor(); GL11.glColor4f(((color >>> 16) & 0xFF)/255f, ((color >>> 8) & 0xFF)/255f, ((color& 0xFF)/255f),1f); bindTexture(fluidIcon); } Block block = tile.getBlockType(); Tessellator tess = Tessellator.getInstance(); float amt = fluid.amount / (float)fluidTile.getTankProperties()[0].getCapacity(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); AxisAlignedBB bb = block.getDefaultState().getBoundingBox(tile.getWorld(), tile.getPos()); tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderCubeWithUV(tess.getBuffer(), bb.minX + 0.01, bb.minY + 0.01, bb.minZ + 0.01, bb.maxX - 0.01, bb.maxY*amt - 0.01, bb.maxZ - 0.01, minU, maxU, minV, maxV); tess.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glColor3f(1f, 1f, 1f); } }