Search in sources :

Example 16 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project BuildCraft by BuildCraft.

the class BCEnergySprites method onTextureStitchPre.

@SubscribeEvent
public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
    TextureMap map = event.getMap();
    ResourceLocation[][] fromSprites = new ResourceLocation[3][2];
    for (int h = 0; h < 3; h++) {
        fromSprites[h][0] = new ResourceLocation("buildcraftenergy:blocks/fluids/heat_" + h + "_still");
        fromSprites[h][1] = new ResourceLocation("buildcraftenergy:blocks/fluids/heat_" + h + "_flow");
    }
    for (BCFluid f : BCEnergyFluids.allFluids) {
        AtlasSpriteFluid spriteStill = new AtlasSpriteFluid(f.getStill().toString(), fromSprites[f.getHeatValue()][0], f);
        AtlasSpriteFluid spriteFlow = new AtlasSpriteFluid(f.getFlowing().toString(), fromSprites[f.getHeatValue()][1], f);
        map.setTextureEntry(spriteStill);
        map.setTextureEntry(spriteFlow);
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) BCFluid(buildcraft.lib.fluid.BCFluid) AtlasSpriteFluid(buildcraft.energy.client.sprite.AtlasSpriteFluid) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 17 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project GregTech by GregTechCE.

the class MetaTileEntityRenderer method renderBlock.

@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
    MetaTileEntity metaTileEntity = BlockMachine.getMetaTileEntity(world, pos);
    if (metaTileEntity == null) {
        return false;
    }
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.bind(buffer);
    Matrix4 translation = new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ());
    BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
    if (metaTileEntity.canRenderInLayer(renderLayer)) {
        renderState.lightMatrix.locate(world, pos);
        IVertexOperation[] pipeline = new IVertexOperation[] { renderState.lightMatrix };
        metaTileEntity.renderMetaTileEntity(renderState, translation.copy(), pipeline);
    }
    Matrix4 coverTranslation = new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ());
    metaTileEntity.renderCovers(renderState, coverTranslation, renderLayer);
    if (metaTileEntity.isFragile() && renderLayer == BlockRenderLayer.CUTOUT) {
        TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
        Random posRand = new Random(MathHelper.getPositionRandom(pos));
        int destroyStage = posRand.nextInt(10);
        TextureAtlasSprite atlasSprite = textureMap.getAtlasSprite("minecraft:blocks/destroy_stage_" + destroyStage);
        for (EnumFacing face : EnumFacing.VALUES) {
            Textures.renderFace(renderState, translation, new IVertexOperation[0], face, Cuboid6.full, atlasSprite);
        }
    }
    return true;
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureMap(net.minecraft.client.renderer.texture.TextureMap) Random(java.util.Random) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing) IRenderMetaTileEntity(gregtech.api.metatileentity.IRenderMetaTileEntity) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) IFastRenderMetaTileEntity(gregtech.api.metatileentity.IFastRenderMetaTileEntity) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) CCRenderState(codechicken.lib.render.CCRenderState) Matrix4(codechicken.lib.vec.Matrix4)

Example 18 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project GregTech by GregTechCE.

the class ToolRenderHandler method updateDestroyBlockIcons.

private void updateDestroyBlockIcons() {
    Minecraft mc = Minecraft.getMinecraft();
    TextureMap texturemap = mc.getTextureMapBlocks();
    for (int i = 0; i < destroyBlockIcons.length; ++i) {
        this.destroyBlockIcons[i] = texturemap.getAtlasSprite("minecraft:blocks/destroy_stage_" + i);
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) Minecraft(net.minecraft.client.Minecraft)

Example 19 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project Gaia-Dimension by Andromander.

the class ClientEvents method textureStitch.

@SubscribeEvent
public static void textureStitch(TextureStitchEvent.Pre e) {
    TextureMap map = e.getMap();
    map.registerSprite(new ResourceLocation(GaiaDimension.MODID, "particle/yellow_fire"));
    map.registerSprite(new ResourceLocation(GaiaDimension.MODID, "particle/green_fire"));
    map.registerSprite(new ResourceLocation(GaiaDimension.MODID, "particle/portal_sparkle"));
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 20 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project ForestryMC by ForestryMC.

the class ItemHabitatLocator method registerIcons.

/* TEXTURES */
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister register) {
    if (register instanceof TextureMap) {
        TextureAtlasSprite texture = new TextureHabitatLocator(iconName);
        ((TextureMap) register).setTextureEntry(iconName, texture);
        itemIcon = texture;
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) TextureHabitatLocator(forestry.apiculture.render.TextureHabitatLocator) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

TextureMap (net.minecraft.client.renderer.texture.TextureMap)82 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)42 ResourceLocation (net.minecraft.util.ResourceLocation)39 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)19 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)19 BlockPos (net.minecraft.util.math.BlockPos)13 Fluid (net.minecraftforge.fluids.Fluid)10 FluidStack (net.minecraftforge.fluids.FluidStack)9 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)6 ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)6 ITreeGenome (forestry.api.arboriculture.ITreeGenome)6 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)5 EnumFacing (net.minecraft.util.EnumFacing)5 World (net.minecraft.world.World)5 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)4 Map (java.util.Map)4 IBlockState (net.minecraft.block.state.IBlockState)4 Tessellator (net.minecraft.client.renderer.Tessellator)4 FluidTank (net.minecraftforge.fluids.FluidTank)4