Search in sources :

Example 21 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project Bewitchment by Um-Mitternacht.

the class GuiBarrel method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    this.drawDefaultBackground();
    if (te != null) {
        FluidStack fstack = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(1000, false);
        Minecraft.getMinecraft().renderEngine.bindTexture(texture);
        drawTexturedModalRect(guiLeft + 62, guiTop + 17, 176, 32, 52, 16);
        if (fstack == null) {
            drawTexturedModalRect(guiLeft + 80, guiTop + 17, xSize, 0, 16, 16);
        } else {
            TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
            TextureAtlasSprite sprite = map.getTextureExtry(fstack.getFluid().getStill().toString());
            Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            for (int i = 0; i < 4; i++) drawTexturedModalRect(guiLeft + 62 + (16 * i), guiTop + 17, sprite, 16, 16);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    if (te != null) {
        int[] data = ((ContainerBarrel) inventorySlots).data_a;
        if (data[2] > 0) {
            double progress = (double) data[0] / (double) data[2];
            if (progress > 1)
                progress = 1;
            int dy = (int) Math.ceil(31 * progress);
            drawTexturedModalRect(guiLeft + 29, guiTop + 27 + 31 - dy, 0, ySize + 31 - dy, 11, dy);
        }
        float absorption = 1;
        if (data[3] > 0)
            absorption = (float) data[1] / (float) data[3];
        GlStateManager.pushMatrix();
        {
            GlStateManager.color(2 * (1f - absorption), 2 * absorption, 0f);
            drawTexturedModalRect(guiLeft + 134, guiTop + 20, xSize, 16, 16, 16);
            GlStateManager.color(1f, 1f, 1f);
        }
        GlStateManager.popMatrix();
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) FluidStack(net.minecraftforge.fluids.FluidStack) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ContainerBarrel(com.bewitchment.client.gui.container.ContainerBarrel)

Example 22 with TextureMap

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

the class ClientProxy method registerSprites.

@SubscribeEvent
public static void registerSprites(TextureStitchEvent event) {
    TextureMap map = event.getMap();
    ResourceLibrary.ATLAS_SET.forEach(map::registerSprite);
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 23 with TextureMap

use of net.minecraft.client.renderer.texture.TextureMap in project Random-Things by lumien231.

the class ModelFluidDisplay method getQuads.

@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
    if (state == null) {
        return defaultModel.getQuads(state, side, rand);
    }
    IExtendedBlockState extendedState = (IExtendedBlockState) state;
    IBakedModel model = defaultModel;
    FluidStack fluidStack = extendedState.getValue(BlockFluidDisplay.FLUID);
    if (fluidStack != null) {
        boolean flowing = extendedState.getValue(BlockFluidDisplay.FLOWING);
        Rotation rotation = extendedState.getValue(BlockFluidDisplay.ROTATION);
        CacheEntry entry = new CacheEntry(fluidStack, rotation);
        HashMap<CacheEntry, ModelCubeAll> cache = flowing ? modelCacheFlowing : modelCache;
        if (cache.containsKey(entry)) {
            model = cache.get(entry);
        } else {
            Fluid fluid = fluidStack.getFluid();
            if (fluid != null) {
                TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
                cache.put(new CacheEntry(fluidStack, rotation), new ModelCubeAll(flowing ? textureMap.getAtlasSprite(fluid.getFlowing().toString()) : textureMap.getAtlasSprite(fluid.getStill().toString()), true, rotation));
                model = cache.get(entry);
            }
        }
    }
    return model.getQuads(extendedState, side, rand);
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) Rotation(net.minecraft.util.Rotation)

Example 24 with TextureMap

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

the class ClientProxy method stitchTextures.

@SubscribeEvent
public static void stitchTextures(TextureStitchEvent event) {
    BakerLibrary.stitchTextureModels();
    TextureMap map = event.getMap();
    ResourceLibrary.ATLAS_SET.forEach(map::registerSprite);
    map.registerSprite(ResourceLibrary.GLOW_PARTICLE);
    map.registerSprite(ResourceLibrary.SQUARE_PARTICLE);
    map.registerSprite(ResourceLibrary.DULL_PARTICLE);
    map.registerSprite(ResourceLibrary.VOLT_PARTICLE);
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 25 with TextureMap

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

the class BuildCraftBuilders method loadTextures.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre evt) {
    if (evt.map.getTextureType() == 0) {
        TextureMap terrainTextures = evt.map;
        BuilderProxyClient.drillTexture = terrainTextures.registerIcon("buildcraftbuilders:machineBlock/drill");
        BuilderProxyClient.drillSideTexture = terrainTextures.registerIcon("buildcraftbuilders:machineBlock/drill_xz");
        BuilderProxyClient.drillHeadTexture = terrainTextures.registerIcon("buildcraftbuilders:machineBlock/drill_head");
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

TextureMap (net.minecraft.client.renderer.texture.TextureMap)102 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)52 ResourceLocation (net.minecraft.util.ResourceLocation)46 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 Tessellator (net.minecraft.client.renderer.Tessellator)7 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)6 ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)6 ITreeGenome (forestry.api.arboriculture.ITreeGenome)6 EnumFacing (net.minecraft.util.EnumFacing)6 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)5 TextureManager (net.minecraft.client.renderer.texture.TextureManager)5 World (net.minecraft.world.World)5 SideOnly (cpw.mods.fml.relauncher.SideOnly)4 IBlockState (net.minecraft.block.state.IBlockState)4 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)4 File (java.io.File)3