package com.xcox123.tehfoodmod.renderer.tileentity;
import org.lwjgl.opengl.GL11;
import com.xcox123.tehfoodmod.tehfoodmod;
import com.xcox123.tehfoodmod.Block.BlockWindmill;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
/**
* Created by Adam on 20/08/2014.
*/
public class TileEntityRenderWindmill extends TileEntitySpecialRenderer {
private final ResourceLocation textureWindmill = new ResourceLocation("tehfoodmod", "textures/model/windmill.png");
private int textureWidth = 64;
private int textureHeight = 32;
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
Tessellator tess = Tessellator.instance;
this.bindTexture(textureWindmill);
IBlockAccess world = tileentity.getWorldObj();
tess.startDrawingQuads(); //Starts drawing
{
tess.addVertexWithUV(0, 0, 1, 1, 1);
tess.addVertexWithUV(1, 1, 1, 1, 0);
tess.addVertexWithUV(0, 1, 0, 0, 0);
tess.addVertexWithUV(0, 0, 0, 0, 1);
}
tess.draw(); //Draws
int brightness = tehfoodmod.blockWindmill.getMixedBrightnessForBlock(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
tess.setBrightness(brightness);
tess.setColorOpaque_F(1.0F, 1.0F, 1.0F);
/*
* Tried brightness code above outside of GL11.glPopMatrix() and same effect happens
*/
GL11.glPopMatrix();
}
}
Texture:
Just saying, ^^ is found at this path: C:\Users\Adam\Desktop\Modding\1.7\TehFoodMod\Source\src\main\resources\assets\tehfoodmod\textures\model