rheel.ac.client.renderer.TileEntityRendererResearchTable.java Source code

Java tutorial

Introduction

Here is the source code for rheel.ac.client.renderer.TileEntityRendererResearchTable.java

Source

/*
 * This class belongs to the source code of Advanced Chemistry.
 * It might depend on other Advanced Chemistry classes to work
 * properly.
 * 
 * For the full license, please see the licence.txt in the source
 * directory.
 */
package rheel.ac.client.renderer;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import rheel.ac.client.renderer.model.ModelResearchTable;
import rheel.ac.common.util.TextureLoader;

/**
 * @Author Rheel
 */
public class TileEntityRendererResearchTable extends TileEntitySpecialRenderer implements IInventoryRenderer {
    private static final ModelResearchTable model = new ModelResearchTable();

    @Override
    public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + 0.75, z + 0.5);
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glRotatef(90 * tileentity.getBlockMetadata(), 0, 1, 0);
        ResourceLocation rl = TextureLoader.getModelTexture("ResearchTable.png");
        this.bindTexture(rl);
        TileEntityRendererResearchTable.model.render();
        GL11.glPopMatrix();
    }

    @Override
    public void renderInInventory(ItemStack item) {
        GL11.glPushMatrix();
        GL11.glTranslated(0, 0, 0);
        GL11.glRotatef(180, 1, 0, 0);
        ResourceLocation rl = TextureLoader.getModelTexture("ResearchTable.png");
        this.bindTexture(rl);
        TileEntityRendererResearchTable.model.render();
        GL11.glPopMatrix();
    }
}