Package extracells.render.model

Source Code of extracells.render.model.ModelLevelEmitterFluid

package extracells.render.model;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;

import org.lwjgl.opengl.GL11;

import extracells.tileentity.TileEntityLevelEmitterFluid;

public class ModelLevelEmitterFluid extends ModelBase
{
  ModelRenderer Shape1;
  ModelRenderer Shape2;

  public ModelLevelEmitterFluid()
  {
    textureWidth = 64;
    textureHeight = 32;

    Shape1 = new ModelRenderer(this, 0, 0);
    Shape1.addBox(0F, 0F, 0F, 6, 6, 6);
    Shape1.setRotationPoint(-3F, 13F, -3F);
    Shape1.setTextureSize(64, 32);
    Shape1.mirror = true;
    setRotation(Shape1, 0F, 0F, 0F);
    Shape2 = new ModelRenderer(this, 32, 0);
    Shape2.addBox(0F, 0F, 0F, 2, 6, 2);
    Shape2.setRotationPoint(-1F, 17.25F, -1F);
    Shape2.setTextureSize(64, 32);
    Shape2.mirror = true;
    setRotation(Shape2, 0F, 0F, 0F);
  }

  public void render(float f5)
  {
    Shape1.render(f5);
    Shape2.render(f5);
  }

  public void render(TileEntity tileEntity, double x, double y, double z)
  {
    if (((TileEntityLevelEmitterFluid) tileEntity).getRedstonePowerBySide(ForgeDirection.getOrientation(tileEntity.getBlockMetadata()).getOpposite()) > 0)
    {
      Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_level_emitter_on.png"));
    } else
    {
      Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_level_emitter_off.png"));
    }

    GL11.glPushMatrix();

    switch (ForgeDirection.getOrientation(tileEntity.getBlockMetadata()))
    {
    case UP:
      GL11.glTranslatef((float) x + 0.5F, (float) y + -0.5F, (float) z + 0.5F);
      GL11.glRotatef(180F, 1F, 0F, 0F);
      break;
    case DOWN:
      GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
      GL11.glRotatef(0F, 0F, 0F, 0F);
      break;

    case SOUTH:
      GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + -0.5F);
      GL11.glRotatef(90F, 1F, 0F, 0F);
      GL11.glRotatef(180F, 0F, 0F, 1F);
      break;
    case NORTH:
      GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 1.5F);
      GL11.glRotatef(90F, 1F, 0F, 0F);
      GL11.glRotatef(0F, 0F, 0F, 1F);
      break;
    case WEST:
      GL11.glTranslatef((float) x + 1.5F, (float) y + 0.5F, (float) z + 0.5F);
      GL11.glRotatef(90F, 1F, 0F, 0F);
      GL11.glRotatef(-90F, 0F, 0F, 1F);
      break;
    case EAST:
      GL11.glTranslatef((float) x + -0.5F, (float) y + 0.5F, (float) z + 0.5F);
      GL11.glRotatef(90F, 1F, 0F, 0F);
      GL11.glRotatef(90F, 0F, 0F, 1F);
      break;
    case UNKNOWN:
      break;
    default:
      break;
    }

    GL11.glScalef(0.88F, -1F, -0.88F);
    this.render(0.0625f);
    GL11.glPopMatrix();
  }

  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }

  @Override
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}
TOP

Related Classes of extracells.render.model.ModelLevelEmitterFluid

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.