ModelAltar model = new ModelAltar();
RenderItem renderItem = new RenderItem();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
TileAltar altar = (TileAltar) tileentity;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : texture);
GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
GL11.glScalef(1F, -1F, -1F);
model.render();
GL11.glScalef(1F, -1F, -1F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
if(altar.hasWater) {
GL11.glPushMatrix();
float s = 1F / 256F * 10F;
float v = 1F / 8F;
float w = -v * 2.5F;
int petals = 0;
for(int i = 0; i < altar.getSizeInventory(); i++)
if(altar.getStackInSlot(i) != null)
petals++;
else break;
if(petals > 0) {
final float modifier = 6F;
final float rotationModifier = 0.25F;
final float radiusBase = 1.2F;
final float radiusMod = 0.1F;
double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5;
float offsetPerPetal = 360 / petals;
GL11.glPushMatrix();
GL11.glTranslatef(-0.05F, -0.5F, 0F);
GL11.glScalef(v, v, v);
for(int i = 0; i < petals; i++) {
float offset = offsetPerPetal * i;
float deg = (int) (ticks / rotationModifier % 360F + offset);
float rad = deg * (float) Math.PI / 180F;
float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier));
float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier));
float x = (float) (radiusX * Math.cos(rad));
float z = (float) (radiusZ * Math.sin(rad));
float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F;
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F;
float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F);
float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;
v /= 2F;
GL11.glTranslatef(v, v, v);
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
GL11.glTranslatef(-v, -v, -v);
v *= 2F;
GL11.glColor4f(1F, 1F, 1F, 1F);
ItemStack stack = altar.getStackInSlot(i);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
IIcon icon = stack.getItem().getIcon(stack, 0);
if(icon != null) {
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());