001/*
002 * The FML Forge Mod Loader suite.
003 * Copyright (C) 2012 cpw
004 *
005 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
006 * Software Foundation; either version 2.1 of the License, or any later version.
007 *
008 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
009 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
010 *
011 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
012 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
013 */
014
015package net.minecraft.src;
016
017import java.awt.Dimension;
018import java.util.List;
019import java.util.logging.Level;
020import java.util.logging.Logger;
021
022import net.minecraft.block.Block;
023import net.minecraft.client.renderer.RenderBlocks;
024import net.minecraft.client.renderer.RenderEngine;
025import net.minecraft.client.renderer.texturefx.TextureFX;
026import net.minecraft.client.texturepacks.ITexturePack;
027import net.minecraft.world.IBlockAccess;
028
029import cpw.mods.fml.client.TextureFXManager;
030import cpw.mods.fml.client.registry.RenderingRegistry;
031import cpw.mods.fml.common.FMLLog;
032
033/**
034 *
035 * A static hook library for optifine and other basemod editing code to access FML functions
036 *
037 * @author cpw
038 *
039 */
040public class FMLRenderAccessLibrary
041{
042    public static Logger getLogger()
043    {
044        Logger l = Logger.getLogger("FMLRenderAccessLibrary");
045        l.setParent(FMLLog.getLogger());
046        return l;
047    }
048
049    public static void log(Level level, String message)
050    {
051        FMLLog.log("FMLRenderAccessLibrary", level, message);
052    }
053
054    public static void log(Level level, String message, Throwable throwable)
055    {
056        FMLLog.log(level, throwable, message);
057    }
058
059    public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
060    {
061        TextureFXManager.instance().setTextureDimensions(textureId, width, height, textureFXList);
062    }
063
064    public static void preRegisterEffect(TextureFX textureFX)
065    {
066        TextureFXManager.instance().onPreRegisterEffect(textureFX);
067    }
068
069    public static boolean onUpdateTextureEffect(TextureFX textureFX)
070    {
071        return TextureFXManager.instance().onUpdateTextureEffect(textureFX);
072    }
073
074    public static Dimension getTextureDimensions(TextureFX textureFX)
075    {
076        return TextureFXManager.instance().getTextureDimensions(textureFX);
077    }
078
079    public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
080    {
081        TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
082    }
083
084    @SuppressWarnings("deprecation")
085    public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
086    {
087        return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelId);
088    }
089
090    @SuppressWarnings("deprecation")
091    public static void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
092    {
093        RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
094    }
095
096    @SuppressWarnings("deprecation")
097    public static boolean renderItemAsFull3DBlock(int modelId)
098    {
099        return RenderingRegistry.instance().renderItemAsFull3DBlock(modelId);
100    }
101}