Search in sources :

Example 11 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class RelativisticTurretRenderer method renderTileEntityAt.

@SuppressWarnings("ConstantConditions")
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int destroyStage) {
    TurretHead turretHead = (TurretHead) te;
    ResourceLocation textures = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/relativistic_turret.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    int rotation;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    if (te == null) {
        GL11.glScalef(0.7F, -0.7F, -0.7F);
        GL11.glTranslatef((float) x + 0.0F, (float) y + 0.4F, (float) z + 0.5F);
        GL11.glRotatef(45.0F, 2.5F, -4.5F, -1.0F);
        model.renderAll();
        GL11.glPopMatrix();
        return;
    }
    if (turretHead.shouldConceal) {
        GL11.glPopMatrix();
        return;
    }
    if (te.getWorld() != null) {
        rotation = te.getBlockMetadata();
        GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.0F, -1F, -1F);
        model.Base.rotateAngleX = turretHead.baseFitRotationX;
        model.Base.rotateAngleY = turretHead.baseFitRotationZ;
        model.Spike1.rotateAngleX = turretHead.baseFitRotationX;
        model.Spike1.rotateAngleY = turretHead.baseFitRotationZ;
        model.Spike2.rotateAngleX = turretHead.baseFitRotationX;
        model.Spike2.rotateAngleY = turretHead.baseFitRotationZ;
        model.Spike3.rotateAngleX = turretHead.baseFitRotationX;
        model.Spike3.rotateAngleY = turretHead.baseFitRotationZ;
        model.Spike4.rotateAngleX = turretHead.baseFitRotationX;
        model.Spike4.rotateAngleY = turretHead.baseFitRotationZ;
        model.Base2.rotateAngleX = turretHead.baseFitRotationX;
        model.Base2.rotateAngleY = turretHead.baseFitRotationZ;
        model.Crystal.rotateAngleX = turretHead.baseFitRotationX;
        model.Crystal.rotateAngleY = turretHead.baseFitRotationZ;
        model.Crystal.rotateAngleX = turretHead.rotationAnimation;
        model.Crystal.rotateAngleY = turretHead.rotationAnimation;
        model.Crystal.rotateAngleZ = turretHead.rotationAnimation;
        model.renderAll();
    }
    GL11.glPopMatrix();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 12 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class RocketTurretRenderer method renderTileEntityAt.

@SuppressWarnings("ConstantConditions")
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int destroyStage) {
    TurretHead turretHead = (TurretHead) te;
    int rotation;
    ResourceLocation textures = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/rocket_turret.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    if (te == null) {
        GL11.glScalef(0.7F, -0.7F, -0.7F);
        GL11.glTranslatef((float) x + 0.0F, (float) y + 0.4F, (float) z + 0.5F);
        GL11.glRotatef(45.0F, 2.5F, -4.5F, -1.0F);
        model.renderAll();
        GL11.glPopMatrix();
        return;
    }
    if (turretHead.shouldConceal) {
        GL11.glPopMatrix();
        return;
    }
    if (te.getWorld() != null) {
        rotation = te.getBlockMetadata();
        GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.0F, -1F, -1F);
        model.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
        model.Base.rotateAngleX = turretHead.baseFitRotationX;
        model.Base.rotateAngleY = turretHead.baseFitRotationZ;
        model.Pole.rotateAngleX = turretHead.baseFitRotationX;
        model.Pole.rotateAngleY = turretHead.baseFitRotationZ;
        model.BoxUnder.rotateAngleX = turretHead.baseFitRotationX;
        model.renderAll();
    }
    if (turretHead.getBase() != null) {
        if (TurretHeadUtil.hasSolarPanelAddon(turretHead.getBase())) {
            ResourceLocation texturesSolar = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_solar_panel.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesSolar);
            solar.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            solar.renderAll();
        }
        if (TurretHeadUtil.hasDamageAmpAddon(turretHead.getBase())) {
            ResourceLocation texturesAmp = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_damage_amp.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesAmp);
            amp.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            amp.renderAll();
        }
        if (TurretHeadUtil.hasRedstoneReactor(turretHead.getBase())) {
            ResourceLocation texturesReac = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_redstone_reactor.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesReac);
            reac.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            reac.renderAll();
        }
    }
    GL11.glPopMatrix();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 13 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class LaserTurretRenderer method renderTileEntityAt.

@SuppressWarnings("ConstantConditions")
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int destroyStage) {
    TurretHead turretHead = (TurretHead) te;
    int rotation;
    ResourceLocation textures = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/laser_turret.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    if (te == null) {
        GL11.glScalef(0.7F, -0.7F, -0.7F);
        GL11.glTranslatef((float) x + 0.0F, (float) y + 0.4F, (float) z + 0.5F);
        GL11.glRotatef(45.0F, 2.5F, -4.5F, -1.0F);
        model.renderAll();
        GL11.glPopMatrix();
        return;
    }
    if (turretHead.shouldConceal) {
        GL11.glPopMatrix();
        return;
    }
    if (te.getWorld() != null) {
        rotation = te.getBlockMetadata();
        GL11.glRotatef(rotation * 90, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.0F, -1F, -1F);
        model.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
        model.Base.rotateAngleX = turretHead.baseFitRotationX;
        model.Base.rotateAngleY = turretHead.baseFitRotationZ;
        model.Pole.rotateAngleX = turretHead.baseFitRotationX;
        model.Pole.rotateAngleY = turretHead.baseFitRotationZ;
        model.BoxUnder.rotateAngleX = turretHead.baseFitRotationX;
    }
    model.renderAll();
    if (turretHead.getBase() != null) {
        if (TurretHeadUtil.hasSolarPanelAddon(turretHead.getBase())) {
            ResourceLocation texturesSolar = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_solar_panel.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesSolar);
            solar.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            solar.renderAll();
        }
        if (TurretHeadUtil.hasDamageAmpAddon(turretHead.getBase())) {
            ResourceLocation texturesAmp = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_damage_amp.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesAmp);
            amp.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            amp.renderAll();
        }
        if (TurretHeadUtil.hasRedstoneReactor(turretHead.getBase())) {
            ResourceLocation texturesReac = (new ResourceLocation(Reference.MOD_ID + ":textures/blocks/addon_redstone_reactor.png"));
            Minecraft.getMinecraft().renderEngine.bindTexture(texturesReac);
            reac.setRotationForTarget(turretHead.rotationXY, turretHead.rotationXZ);
            reac.renderAll();
        }
    }
    GL11.glPopMatrix();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Aggregations

TurretHead (omtteam.openmodularturrets.tileentity.turrets.TurretHead)13 ResourceLocation (net.minecraft.util.ResourceLocation)7 TileEntity (net.minecraft.tileentity.TileEntity)6