com.minestellar.core.render.tile.TileEntityRenderSolarPanel.java Source code

Java tutorial

Introduction

Here is the source code for com.minestellar.core.render.tile.TileEntityRenderSolarPanel.java

Source

/**
 * Copyright (c) 22/Feb/2015 Davide Cossu & Matthew Albrecht.
 *
 * This program 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
 * Software Foundation; either version 3 of the License, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see <http://www.gnu.org/licenses>.
 */

package com.minestellar.core.render.tile;

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

import org.lwjgl.opengl.GL11;

import com.minestellar.core.MinestellarCore;
import com.minestellar.core.model.ModelSolarPanel;

public class TileEntityRenderSolarPanel extends TileEntitySpecialRenderer {
    private ResourceLocation texture;
    public static ModelSolarPanel model;

    public TileEntityRenderSolarPanel() {
        model = new ModelSolarPanel();
    }

    @Override
    public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ,
            float f) {
        texture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/solarPanel.png");
        this.bindTexture(texture);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F);
        GL11.glScalef(1.0F, -1F, -1F);
        GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
        model.render(null, 0.04F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0625F);
        GL11.glPopMatrix();
    }
}