us.samcraft.thaumickeeper.client.render.RenderKeeper.java Source code

Java tutorial

Introduction

Here is the source code for us.samcraft.thaumickeeper.client.render.RenderKeeper.java

Source

/**
 * This class was created by Anthony Anderson(Lord Illyohs)
 * It is distributed as part of the ThaumicKeeper mod
 * Source Code: https://github.com/LordIllyohs/ThaumicKeeper
 *
 * ThaumicKeeper is Open Source and distributed under a
 * Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License
 * (http://creativecommons.org/licenses/by-nc-nd/4.0/)
 *
 * 
 * Class created on Jan 21, 2014
 * 
 */
package us.samcraft.thaumickeeper.client.render;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import cpw.mods.fml.client.FMLClientHandler;

import us.samcraft.thaumickeeper.client.model.ModelKeeper;
import us.samcraft.thaumickeeper.lib.LibRef;
import us.samcraft.thaumickeeper.tile.TileSpaceKeeper;

public class RenderKeeper extends TileEntitySpecialRenderer {

    private ModelKeeper model;

    public RenderKeeper() {
        model = new ModelKeeper();

    }

    private static final ResourceLocation TEXTURE = new ResourceLocation(LibRef.MOD_ID,
            "textures/models/keeper.png");

    @Override
    public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) {
        TileSpaceKeeper tKeeper = (TileSpaceKeeper) tileentity;

        GL11.glPushMatrix();

        GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 0.5);
        GL11.glScalef(1F, -1F, -1F);
        Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
        model.render(.0625F);
        GL11.glScalef(1F, -1F, -1F);
        GL11.glBlendFunc(0, 1);
        GL11.glClearColor(0.7f, 0.7f, 0.7f, 1.0f);

        GL11.glPopMatrix();
    }

}