resonant-induction/archive/java/resonantinduction/electrical/battery/RenderBattery.java
2014-01-11 17:44:07 +08:00

40 lines
1.4 KiB
Java

/**
*
*/
package resonantinduction.electrical.battery;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import resonantinduction.core.Reference;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* @author Calclavia
*
*/
@SideOnly(Side.CLIENT)
public class RenderBattery extends TileEntitySpecialRenderer
{
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "battery.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "battery.obj");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
{
glPushMatrix();
glTranslatef((float) x + 0.5F, (float) y + 0.1f, (float) z + 0.5F);
glScalef(0.46f, 0.46f, 0.46f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.renderAll();
glPopMatrix();
}
}