Search in sources :

Example 41 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.

the class FluidRenderer method setupFluidTexture.

@Nullable
public static ResourceLocation setupFluidTexture(@Nullable FluidStack fluidStack, FlowState flowState, CubeRenderer.RenderInfo renderInfo) {
    if (fluidStack == null)
        return null;
    TextureAtlasSprite capTex = getFluidTexture(fluidStack, FlowState.STILL);
    TextureAtlasSprite sideTex = getFluidTexture(fluidStack, flowState);
    renderInfo.setTexture(EnumFacing.UP, capTex);
    renderInfo.setTexture(EnumFacing.DOWN, capTex);
    for (EnumFacing side : EnumFacing.HORIZONTALS) {
        renderInfo.setTexture(side, sideTex);
    }
    return getFluidSheet(fluidStack);
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing) Nullable(javax.annotation.Nullable)

Example 42 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.

the class TextureAtlasSheet method unstitchIcons.

public static ResourceLocation[] unstitchIcons(TextureMap textureMap, ResourceLocation textureResource, Tuple<Integer, Integer> textureDimensions, String textureFolder) {
    int columns = textureDimensions.getFirst();
    int rows = textureDimensions.getSecond();
    if (columns <= 1 && rows <= 1)
        return new ResourceLocation[] { new ResourceLocation(textureResource.getResourceDomain(), textureFolder + textureResource.getResourcePath()) };
    if (Game.DEVELOPMENT_ENVIRONMENT)
        Game.log(Level.INFO, "Unstitching texture sheet: {0} {1}x{2}", textureResource, columns, rows);
    int numIcons = rows * columns;
    ResourceLocation[] locations = new ResourceLocation[numIcons];
    String domain = textureResource.getResourceDomain();
    String name = textureResource.getResourcePath();
    Map<String, TextureAtlasSprite> mapRegisteredSprites = ObfuscationReflectionHelper.getPrivateValue(TextureMap.class, textureMap, 5);
    for (int i = 0; i < numIcons; i++) {
        String texName = domain + ":" + textureFolder + name;
        TextureAtlasSheet texture = new TextureAtlasSheet(texName, i, rows, columns);
        mapRegisteredSprites.put(texture.getIconName(), texture);
        locations[i] = new ResourceLocation(texture.getIconName());
    }
    return locations;
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 43 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Railcraft by Railcraft.

the class TESRSignalLamp method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileSignalBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
    EnumFacing side = tile.getFacing();
    SignalAspect aspect = tile.getSignalAspect().getDisplayAspect();
    TextureAtlasSprite texture = RenderTools.getTexture(BlockMachineSignalBox.lampTextures[aspect.getTextureIndex()]);
    lampInfo.setTexture(side, texture);
    lampInfo.lightSource = aspect.getTextureBrightness();
    doRenderAspect(x, y, z);
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing)

Example 44 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite 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);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Fluid(net.minecraftforge.fluids.Fluid)

Example 45 with TextureAtlasSprite

use of net.minecraft.client.renderer.texture.TextureAtlasSprite in project Witchworks by Um-Mitternacht.

the class TileRenderKettle method renderWater.

private void renderWater(ResourceLocation loc) {
    final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(loc.toString());
    final Tessellator tessellator = Tessellator.getInstance();
    tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.getBuffer().pos(0, 16, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
    tessellator.getBuffer().pos(16, 16, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
    tessellator.getBuffer().pos(16, 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
    tessellator.getBuffer().pos(0, 0, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

Aggregations

TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)51 ResourceLocation (net.minecraft.util.ResourceLocation)9 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)8 EnumFacing (net.minecraft.util.EnumFacing)8 Tessellator (net.minecraft.client.renderer.Tessellator)6 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 Matrix4 (blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)5 IBlockState (net.minecraft.block.state.IBlockState)5 TileEntity (net.minecraft.tileentity.TileEntity)5 UnpackedBakedQuad (net.minecraftforge.client.model.pipeline.UnpackedBakedQuad)5 Minecraft (net.minecraft.client.Minecraft)4 TRSRTransformation (net.minecraftforge.common.model.TRSRTransformation)4 FluidStack (net.minecraftforge.fluids.FluidStack)4 Vector3f (org.lwjgl.util.vector.Vector3f)4 ImmutableList (com.google.common.collect.ImmutableList)3 HashMap (java.util.HashMap)3 TransformType (net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType)3 TextureManager (net.minecraft.client.renderer.texture.TextureManager)3 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)3