2015-08-29 14:33:25 +02:00
|
|
|
|
/*
|
|
|
|
|
* This file ("RenderTileEntity.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
|
*
|
|
|
|
|
* <EFBFBD> 2015 Ellpeck
|
|
|
|
|
*/
|
|
|
|
|
|
2015-03-07 12:51:28 +01:00
|
|
|
|
package ellpeck.actuallyadditions.blocks.render;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
2015-03-29 15:29:05 +02:00
|
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
|
|
public class RenderTileEntity extends TileEntitySpecialRenderer{
|
|
|
|
|
|
2015-06-12 19:12:06 +02:00
|
|
|
|
public ModelBaseAA theModel;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
protected ResourceLocation resLoc;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
2015-03-07 12:51:28 +01:00
|
|
|
|
public RenderTileEntity(ModelBaseAA model){
|
2015-03-07 02:23:31 +01:00
|
|
|
|
this.theModel = model;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
this.resLoc = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/"+this.theModel.getName()+".png");
|
2015-03-07 02:23:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
|
|
|
|
GL11.glPushMatrix();
|
2015-08-23 23:41:46 +02:00
|
|
|
|
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
2015-03-07 02:23:31 +01:00
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
|
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
2015-07-09 18:10:32 +02:00
|
|
|
|
this.bindTexture(resLoc);
|
2015-04-24 19:22:03 +02:00
|
|
|
|
|
2015-06-12 19:12:06 +02:00
|
|
|
|
if(theModel.doesRotate()){
|
|
|
|
|
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
|
|
|
|
if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F);
|
|
|
|
|
if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F);
|
|
|
|
|
if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
theModel.render(0.0625F);
|
|
|
|
|
theModel.renderExtra(0.0625F, tile);
|
2015-04-24 19:22:03 +02:00
|
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|