78 lines
2.4 KiB
Java

package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.TileEntityTurretBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderTauTurret extends TileEntitySpecialRenderer {
public RenderTauTurret() { }
private ResourceLocation gadgetTexture = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(180, 0F, 1F, 0F);
double yaw = 0;
double pitch = 0;
if(tileEntity instanceof TileEntityTurretBase) {
yaw = ((TileEntityTurretBase)tileEntity).rotationYaw;
pitch = ((TileEntityTurretBase)tileEntity).rotationPitch;
}
this.bindTexture(gadgetTexture);
ResourceManager.turret_heavy_base.renderAll();
GL11.glPopMatrix();
renderTileEntityAt2(tileEntity, x, y, z, f, yaw, pitch);
}
public void renderTileEntityAt2(TileEntity tileEntity, double x, double y, double z, float f, double yaw, double pitch)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(180, 0F, 1F, 0F);
GL11.glRotated(yaw + 180, 0F, -1F, 0F);
this.bindTexture(gadgetTexture);
ResourceManager.turret_heavy_rotor.renderAll();
GL11.glPopMatrix();
renderTileEntityAt3(tileEntity, x, y, z, f, yaw, pitch);
}
public void renderTileEntityAt3(TileEntity tileEntity, double x, double y, double z, float f, double yaw, double pitch)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 1, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(180, 0F, 1F, 0F);
GL11.glRotated(yaw + 180, 0F, -1F, 0F);
GL11.glRotated(pitch, 1F, 0F, 0F);
this.bindTexture(gadgetTexture);
ResourceManager.turret_tau_gun.renderAll();
GL11.glPopMatrix();
}
}