Search in sources :

Example 11 with EntityMissile

use of icbm.classic.content.entity.EntityMissile 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)

Example 12 with EntityMissile

use of icbm.classic.content.entity.EntityMissile in project ICBM-Classic by BuiltBrokenModding.

the class TileLauncherBase method launchMissile.

/**
     * Launches the missile
     *
     * @param target - The target in which the missile will land in
     */
public boolean launchMissile(Pos target, int gaoDu) {
    final ItemStack stack = getMissileStack();
    if (stack != null && stack.getItem() == ICBMClassic.itemMissile) {
        Explosive ex = Explosives.get(stack.getItemDamage()).handler;
        if (ex.hasMissileForm()) {
            // Apply inaccuracy
            int inaccuracy = 30;
            //Get value from support frame
            if (this.supportFrame != null) {
                inaccuracy = this.supportFrame.getInaccuracy();
            }
            //Randomize distance
            inaccuracy = world().rand.nextInt(inaccuracy);
            //Randomize radius drop
            angle.setYaw(world().rand.nextFloat() * 360);
            //Update target
            target = target.add(angle.x() * inaccuracy, 0, angle.z() * inaccuracy);
            if (isServer()) {
                EntityMissile missile = new EntityMissile(world());
                missile.explosiveID = Explosives.get(stack.getItemDamage());
                missile.launcherPos = new Pos((TileEntity) this);
                missile.setPosition(xi(), yi() + 3, zi());
                missile.launch(target, gaoDu);
                world().spawnEntityInWorld(missile);
                this.decrStackSize(0, 1);
            }
            return true;
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Explosive(icbm.classic.content.explosive.Explosive) Pos(com.builtbroken.mc.imp.transform.vector.Pos) ItemStack(net.minecraft.item.ItemStack) EntityMissile(icbm.classic.content.entity.EntityMissile)

Example 13 with EntityMissile

use of icbm.classic.content.entity.EntityMissile in project ICBM-Classic by BuiltBrokenModding.

the class GuiRadarStation method drawGuiContainerBackgroundLayer.

/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.containerPosX = (this.width - this.xSize) / 2;
    this.containerPosY = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(containerPosX, containerPosY, 0, 0, this.xSize, this.ySize);
    this.radarCenter = new Point(this.containerPosX + this.xSize / 3 - 10, this.containerPosY + this.ySize / 2 + 4);
    this.radarMapRadius = TileRadarStation.MAX_DETECTION_RANGE / 71f;
    this.info = "";
    this.info2 = "";
    if (this.tileEntity.hasPower()) {
        int range = 4;
        for (Entity entity : this.tileEntity.detectedEntities) {
            Point position = new Point(radarCenter.x() + (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius, radarCenter.y() - (entity.posZ - this.tileEntity.zCoord) / this.radarMapRadius);
            if (entity instanceof EntityMissile) {
                if (this.tileEntity.isMissileGoingToHit((EntityMissile) entity)) {
                    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_RED_DOT);
                } else {
                    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_YELLOW_DOT);
                }
            } else {
                FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_YELLOW_DOT);
            }
            this.drawTexturedModalRect(position.xi(), position.yi(), 0, 0, 2, 2);
            // Hover Detection
            Point minPosition = position.clone();
            minPosition.add(-range);
            Point maxPosition = position.clone();
            maxPosition.add(range);
            if (new Rectangle(minPosition, maxPosition).isWithin(this.mousePosition)) {
                this.info = entity.getCommandSenderName();
                if (entity instanceof EntityPlayer) {
                    this.info = "ยง1" + this.info;
                }
                if (entity instanceof EntityMissile) {
                    if (((EntityMissile) entity).targetVector != null) {
                        this.info2 = "(" + ((EntityMissile) entity).targetVector.xi() + ", " + ((EntityMissile) entity).targetVector.zi() + ")";
                    }
                }
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) Rectangle(com.builtbroken.mc.imp.transform.region.Rectangle) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Point(com.builtbroken.mc.imp.transform.vector.Point) Point(com.builtbroken.mc.imp.transform.vector.Point) EntityMissile(icbm.classic.content.entity.EntityMissile)

Aggregations

EntityMissile (icbm.classic.content.entity.EntityMissile)13 Pos (com.builtbroken.mc.imp.transform.vector.Pos)6 Entity (net.minecraft.entity.Entity)6 Point (com.builtbroken.mc.imp.transform.vector.Point)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ItemStack (net.minecraft.item.ItemStack)3 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)3 EntityFlyingBlock (icbm.classic.content.entity.EntityFlyingBlock)2 Explosive (icbm.classic.content.explosive.Explosive)2 Explosion (icbm.classic.content.explosive.ex.Explosion)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ChatComponentText (net.minecraft.util.ChatComponentText)2 IItemFrequency (com.builtbroken.mc.api.items.hz.IItemFrequency)1 Rectangle (com.builtbroken.mc.imp.transform.region.Rectangle)1 Location (com.builtbroken.mc.imp.transform.vector.Location)1 EntityExplosion (icbm.classic.content.entity.EntityExplosion)1 Explosives (icbm.classic.content.explosive.Explosives)1 BlastEMP (icbm.classic.content.explosive.blast.BlastEMP)1 Iterator (java.util.Iterator)1 List (java.util.List)1