use of net.minecraft.client.renderer.texture.TextureManager in project Bookshelf by Darkhax-Minecraft.
the class RenderUtils method downloadResource.
/**
* 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;
}
use of net.minecraft.client.renderer.texture.TextureManager in project Railcraft by Railcraft.
the class LiquidFilter method draw.
@Override
public void draw(Renderer renderer, int x, int y) {
if (liquid != null) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Fluid fluid = liquid.getFluid();
TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getStill(liquid).toString());
if (icon != null) {
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
double u = icon.getInterpolatedU(3.0);
double u2 = icon.getInterpolatedU(13.0);
double v = icon.getInterpolatedV(1.0);
double v2 = icon.getInterpolatedV(15.0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(u, v);
GL11.glVertex2i(x + 3, y + 1);
GL11.glTexCoord2d(u, v2);
GL11.glVertex2i(x + 3, y + 15);
GL11.glTexCoord2d(u2, v2);
GL11.glVertex2i(x + 13, y + 15);
GL11.glTexCoord2d(u2, v);
GL11.glVertex2i(x + 13, y + 1);
GL11.glEnd();
}
}
renderer.renderRect(x - 1, y - 1, 18, 18, containerTexture);
}
use of net.minecraft.client.renderer.texture.TextureManager in project Engine by VoltzEngine-Project.
the class RenderItemOverlayUtility method renderIcon3D.
public static void renderIcon3D(IIcon iicon, int sheet) {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
if (iicon == null)
return;
texturemanager.bindTexture(texturemanager.getResourceLocation(sheet));
TextureUtil.func_152777_a(false, false, 1.0F);
//TODO add color handling for icon
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
ItemRenderer.renderItemIn2D(Tessellator.instance, iicon.getMaxU(), iicon.getMinV(), iicon.getMinU(), iicon.getMaxV(), iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
texturemanager.bindTexture(texturemanager.getResourceLocation(sheet));
TextureUtil.func_147945_b();
}
use of net.minecraft.client.renderer.texture.TextureManager in project Engine by VoltzEngine-Project.
the class RenderItemOverlayUtility method renderItemOnSide.
@SuppressWarnings("incomplete-switch")
protected static void renderItemOnSide(TileEntity tile, ItemStack itemStack, ForgeDirection direction, double x, double y, double z, String renderText, String amount) {
if (itemStack != null) {
GL11.glPushMatrix();
switch(direction) {
case NORTH:
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
break;
case SOUTH:
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
GL11.glRotatef(180, 0, 1, 0);
break;
case WEST:
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
GL11.glRotatef(90, 0, 1, 0);
break;
case EAST:
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
GL11.glRotatef(-90, 0, 1, 0);
break;
case UP:
//TODO fix rotation
GL11.glTranslated(x + 0.65, y + 1.01, z + 0.9);
GL11.glRotatef(90, 1, 0, 0);
break;
case DOWN:
//TODO Fix rotation
GL11.glTranslated(x + 0.65, y - 0.01, z - 0.01);
GL11.glRotatef(-90, 1, 0, 0);
break;
}
float scale = 0.03125F;
GL11.glScalef(0.6f * scale, 0.6f * scale, -0.00001f);
GL11.glRotatef(180, 0, 0, 1);
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
setupLight(tile, direction.offsetX, direction.offsetZ);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GL11.glDisable(2896);
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F)) {
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, renderEngine, itemStack, 0, 0);
}
GL11.glEnable(2896);
GL11.glPopMatrix();
}
}
Aggregations