Search in sources :

Example 1 with Explosion

use of icbm.classic.content.explosive.ex.Explosion in project ICBM-Classic by BuiltBrokenModding.

the class RenderMissile method renderItem.

@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    Explosives ex = Explosives.get(item.getItemDamage());
    if (ex.handler instanceof Explosion) {
        Explosion missile = (Explosion) ex.handler;
        float yaw = 0;
        float pitch = -90;
        float scale = missile.missileModelPath.contains("missiles") ? 0.00625f : 0.7f;
        switch(type) {
            case INVENTORY:
                scale = missile.missileModelPath.contains("missiles") ? 0.0035f : 0.5f;
                if (missile.getTier() == 2 || !missile.hasBlockForm()) {
                    scale = scale / 1.5f;
                    GL11.glTranslatef(-0.7f, 0f, 0f);
                } else if (missile.getTier() == 3) {
                    scale = scale / 1.7f;
                    GL11.glTranslatef(-0.65f, 0f, 0f);
                } else if (missile.getTier() == 4) {
                    scale = scale / 1.4f;
                    GL11.glTranslatef(-0.5f, 0f, 0f);
                } else {
                    GL11.glTranslatef(-0.5f, 0f, 0f);
                }
                break;
            case EQUIPPED:
                GL11.glTranslatef(1f, 0.3f, 0.5f);
                break;
            case EQUIPPED_FIRST_PERSON:
                GL11.glTranslatef(1.15f, -1f, 0.5f);
                break;
            case ENTITY:
                GL11.glTranslatef(-0.6f, 0f, 0f);
                break;
            default:
                break;
        }
        GL11.glRotatef(yaw, 0, 1f, 0f);
        GL11.glRotatef(pitch, 0, 0f, 1f);
        GL11.glScalef(scale, scale, scale);
        renderMissile(missile);
    }
}
Also used : Explosion(icbm.classic.content.explosive.ex.Explosion) Explosives(icbm.classic.content.explosive.Explosives)

Example 2 with Explosion

use of icbm.classic.content.explosive.ex.Explosion in project ICBM-Classic by BuiltBrokenModding.

the class TileLauncherBaseClient method renderDynamic.

@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Pos pos, float frame, int pass) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) pos.x() + 0.5F, (float) pos.y() + 1.5F, (float) pos.z() + 0.5F);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    if (getDirection() != ForgeDirection.NORTH && getDirection() != ForgeDirection.SOUTH) {
        GL11.glRotatef(90F, 0F, 180F, 1.0F);
    }
    // The missile launcher screen
    if (getTier() == 0) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_FILE_0);
        modelBase0.render(0.0625F);
        modelRail0.render(0.0625F);
    } else if (getTier() == 1) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_FILE_1);
        modelBase1.render(0.0625F);
        modelRail1.render(0.0625F);
        GL11.glRotatef(180F, 0F, 180F, 1.0F);
        modelRail1.render(0.0625F);
    } else if (getTier() == 2) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_FILE_2);
        modelBase2.render(0.0625F);
        modelRail2.render(0.0625F);
        GL11.glRotatef(180F, 0F, 180F, 1.0F);
        modelRail2.render(0.0625F);
    }
    GL11.glPopMatrix();
    if (cachedMissileStack != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) pos.x() + 0.5F, (float) pos.y() + 0.5F, (float) pos.z() + 0.5F);
        //GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
        Explosives e = Explosives.get(cachedMissileStack.getItemDamage());
        Explosion missile = e == null ? (Explosion) Explosives.CONDENSED.handler : (Explosion) e.handler;
        if (missile.missileModelPath.contains("missiles")) {
            GL11.glScalef(0.00625f, 0.00625f, 0.00625f);
        } else {
            GL11.glScalef(0.05f, 0.05f, 0.05f);
        }
        RenderMissile.renderMissile(missile);
        GL11.glPopMatrix();
    }
}
Also used : Explosion(icbm.classic.content.explosive.ex.Explosion) Explosives(icbm.classic.content.explosive.Explosives) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 3 with Explosion

use of icbm.classic.content.explosive.ex.Explosion in project ICBM-Classic by BuiltBrokenModding.

the class TileCruiseLauncher method getStatus.

/**
     * Gets the display status of the missile launcher
     *
     * @return The string to be displayed
     */
@Override
public String getStatus() {
    String color = "§4";
    String status;
    if (!this.checkExtract()) {
        status = LanguageUtility.getLocal("gui.launcherCruise.statusNoPower");
    } else if (this.getStackInSlot(0) == null) {
        status = LanguageUtility.getLocal("gui.launcherCruise.statusEmpty");
    } else if (this.getStackInSlot(0).getItem() != ICBMClassic.itemMissile) {
        status = LanguageUtility.getLocal("gui.launcherCruise.invalidMissile");
    } else {
        final Explosion missile = (Explosion) Explosives.get(this.getStackInSlot(0).getItemDamage()).handler;
        if (missile == null) {
            status = LanguageUtility.getLocal("gui.launcherCruise.invalidMissile");
        } else if (!missile.isCruise()) {
            status = LanguageUtility.getLocal("gui.launcherCruise.notCruiseMissile");
        } else if (missile.getTier() > 3) {
            status = LanguageUtility.getLocal("gui.launcherCruise.invalidMissileTier");
        } else if (this.getTarget() == null || getTarget().isZero()) {
            status = LanguageUtility.getLocal("gui.launcherCruise.statusInvalid");
        } else if (this.isTooClose(getTarget())) {
            status = LanguageUtility.getLocal("gui.launcherCruise.targetToClose");
        } else if (!canSpawnMissileWithNoCollision()) {
            status = LanguageUtility.getLocal("gui.launcherCruise.noRoom");
        } else {
            color = "§2";
            status = LanguageUtility.getLocal("gui.launcherCruise.statusReady");
        }
    }
    return color + status;
}
Also used : Explosion(icbm.classic.content.explosive.ex.Explosion)

Example 4 with Explosion

use of icbm.classic.content.explosive.ex.Explosion in project ICBM-Classic by BuiltBrokenModding.

the class TileCruiseLauncherClient method renderDynamic.

@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Pos pos, float frame, int pass) {
    float yaw = (float) currentAim.yaw();
    float pitch = (float) currentAim.pitch();
    GL11.glPushMatrix();
    GL11.glTranslatef((float) pos.x() + 0.5F, (float) pos.y() + 1.5F, (float) pos.z() + 0.5F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_FILE);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    MODEL0.render(0.0625F);
    GL11.glRotatef(-yaw, 0F, 1F, 0F);
    GL11.glRotatef(-pitch, 1F, 0F, 0F);
    MODEL1.render(0.0625F);
    GL11.glPopMatrix();
    if (cachedMissileStack != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) pos.x() + 0.5F, (float) pos.y() + 1, (float) pos.z() + 0.5f);
        GL11.glRotatef(yaw, 0F, 1F, 0F);
        GL11.glRotatef(pitch - 90, 1F, 0F, 0F);
        Explosives e = Explosives.get(cachedMissileStack.getItemDamage());
        Explosion missile = e == null ? (Explosion) Explosives.CONDENSED.handler : (Explosion) e.handler;
        if (missile.missileModelPath.contains("missiles")) {
            GL11.glScalef(0.00625f, 0.00625f, 0.00625f);
        } else {
            GL11.glScalef(0.05f, 0.05f, 0.05f);
        }
        RenderMissile.renderMissile(missile);
        GL11.glPopMatrix();
    }
}
Also used : Explosion(icbm.classic.content.explosive.ex.Explosion) Explosives(icbm.classic.content.explosive.Explosives) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with Explosion

use of icbm.classic.content.explosive.ex.Explosion in project ICBM-Classic by BuiltBrokenModding.

the class RenderMissile method doRender.

@Override
public void doRender(Entity entity, double x, double y, double z, float f, float f1) {
    EntityMissile entityMissile = (EntityMissile) entity;
    Explosive e = entityMissile.getExplosiveType();
    Explosion missile = e == null ? (Explosion) Explosives.CONDENSED.handler : (Explosion) e;
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(entityMissile.prevRotationYaw + (entityMissile.rotationYaw - entityMissile.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
    float pitch = entityMissile.prevRotationPitch + (entityMissile.rotationPitch - entityMissile.prevRotationPitch) * f1 - 90;
    GL11.glRotatef(pitch, 0.0F, 0.0F, 1.0F);
    if (missile.missileModelPath.contains("missiles")) {
        GL11.glScalef(0.00625f, 0.00625f, 0.00625f);
    } else {
        GL11.glScalef(0.07f, 0.07f, 0.07f);
    }
    renderMissile(missile);
    GL11.glPopMatrix();
}
Also used : Explosive(icbm.classic.content.explosive.Explosive) Explosion(icbm.classic.content.explosive.ex.Explosion) EntityMissile(icbm.classic.content.entity.EntityMissile)

Aggregations

Explosion (icbm.classic.content.explosive.ex.Explosion)6 Explosives (icbm.classic.content.explosive.Explosives)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 EntityMissile (icbm.classic.content.entity.EntityMissile)2 Explosive (icbm.classic.content.explosive.Explosive)1 ItemStack (net.minecraft.item.ItemStack)1 ChatComponentText (net.minecraft.util.ChatComponentText)1 ExplosivePreDetonationEvent (resonant.api.explosion.ExplosionEvent.ExplosivePreDetonationEvent)1