    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
    015    package net.minecraft.src;
    016
    017    import java.awt.Dimension;
    018    import java.util.List;
    019    import java.util.logging.Level;
    020    import java.util.logging.Logger;
    021
    022    import net.minecraft.block.Block;
    023    import net.minecraft.client.renderer.RenderBlocks;
    024    import net.minecraft.client.renderer.RenderEngine;
    025    import net.minecraft.client.renderer.texturefx.TextureFX;
    026    import net.minecraft.client.texturepacks.ITexturePack;
    027    import net.minecraft.world.IBlockAccess;
    028
    029    import cpw.mods.fml.client.TextureFXManager;
    030    import cpw.mods.fml.client.registry.RenderingRegistry;
    031    import 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     */
    040    public class FMLRenderAccessLibrary
    041    {
    042        public static Logger getLogger()
    043        {
    044            return FMLLog.getLogger();
    045        }
    046
    047        public static void log(Level level, String message)
    048        {
    049            FMLLog.log(level, message);
    050        }
    051
    052        public static void log(Level level, String message, Throwable throwable)
    053        {
    054            FMLLog.log(level, throwable, message);
    055        }
    056
    057        public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
    058        {
    059            TextureFXManager.instance().setTextureDimensions(textureId, width, height, textureFXList);
    060        }
    061
    062        public static void preRegisterEffect(TextureFX textureFX)
    063        {
    064            TextureFXManager.instance().onPreRegisterEffect(textureFX);
    065        }
    066
    067        public static boolean onUpdateTextureEffect(TextureFX textureFX)
    068        {
    069            return TextureFXManager.instance().onUpdateTextureEffect(textureFX);
    070        }
    071
    072        public static Dimension getTextureDimensions(TextureFX textureFX)
    073        {
    074            return TextureFXManager.instance().getTextureDimensions(textureFX);
    075        }
    076
    077        public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
    078        {
    079            TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
    080        }
    081
    082        @SuppressWarnings("deprecation")
    083        public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
    084        {
    085            return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelId);
    086        }
    087
    088        @SuppressWarnings("deprecation")
    089        public static void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
    090        {
    091            RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
    092        }
    093
    094        @SuppressWarnings("deprecation")
    095        public static boolean renderItemAsFull3DBlock(int modelId)
    096        {
    097            return RenderingRegistry.instance().renderItemAsFull3DBlock(modelId);
    098        }
    099    }