Search in sources :

Example 1 with RenderProgressingLine

use of pneumaticCraft.client.render.RenderProgressingLine in project PneumaticCraft by MineMaarten.

the class EntityDrone method moveEntityWithHeading.

/**
     * Moves the entity based on the specified heading.  Args: strafe, forward
     */
@Override
public void moveEntityWithHeading(float par1, float par2) {
    if (worldObj.isRemote) {
        EntityLivingBase targetEntity = getAttackTarget();
        if (targetEntity != null) {
            if (targetLine == null)
                targetLine = new RenderProgressingLine(0, -height / 2, 0, 0, 0, 0);
            if (oldTargetLine == null)
                oldTargetLine = new RenderProgressingLine(0, -height / 2, 0, 0, 0, 0);
            targetLine.endX = targetEntity.posX - posX;
            targetLine.endY = targetEntity.posY + targetEntity.height / 2 - posY;
            targetLine.endZ = targetEntity.posZ - posZ;
            oldTargetLine.endX = targetEntity.prevPosX - prevPosX;
            oldTargetLine.endY = targetEntity.prevPosY + targetEntity.height / 2 - prevPosY;
            oldTargetLine.endZ = targetEntity.prevPosZ - prevPosZ;
            oldTargetLine.setProgress(targetLine.getProgress());
            targetLine.incProgressByDistance(0.3D);
            //don't stop rendering the drone when it goes out of the camera frustrum, as we need to render the target lines as well.
            ignoreFrustumCheck = true;
        } else {
            //don't stop rendering the drone when it goes out of the camera frustrum, as we need to render the target lines as well.
            ignoreFrustumCheck = false;
        }
    }
    if (ridingEntity == null && isAccelerating()) {
        double d3 = motionY;
        super.moveEntityWithHeading(par1, par2);
        motionY = d3 * 0.60D;
    } else {
        super.moveEntityWithHeading(par1, par2);
    }
    //set onGround to true so AI pathfinding will keep updating.
    onGround = true;
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine)

Example 2 with RenderProgressingLine

use of pneumaticCraft.client.render.RenderProgressingLine in project PneumaticCraft by MineMaarten.

the class NetworkConnectionHandler method removeConnection.

protected void removeConnection(int firstSlot, int secondSlot) {
    double startX = baseX + firstSlot % 5 * nodeSpacing;
    double startY = baseY + firstSlot / 5 * nodeSpacing;
    double endX = baseX + secondSlot % 5 * nodeSpacing;
    double endY = baseY + secondSlot / 5 * nodeSpacing;
    for (RenderProgressingLine line : lineList) {
        if (line.hasLineSameProperties(startX, startY, 0, endX, endY, 0)) {
            lineList.remove(line);
            return;
        }
    }
}
Also used : RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine)

Example 3 with RenderProgressingLine

use of pneumaticCraft.client.render.RenderProgressingLine in project PneumaticCraft by MineMaarten.

the class NetworkConnectionHandler method render.

public void render() {
    float f = (color >> 24 & 255) / 255.0F;
    float f1 = (color >> 16 & 255) / 255.0F;
    float f2 = (color >> 8 & 255) / 255.0F;
    float f3 = (color & 255) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(f1, f2, f3, f);
    for (RenderProgressingLine line : lineList) {
        line.render();
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}
Also used : RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine)

Example 4 with RenderProgressingLine

use of pneumaticCraft.client.render.RenderProgressingLine in project PneumaticCraft by MineMaarten.

the class NetworkConnectionHandler method addConnection.

protected void addConnection(int firstSlot, int secondSlot) {
    double startX = baseX + firstSlot % 5 * nodeSpacing;
    double startY = baseY + firstSlot / 5 * nodeSpacing;
    double endX = baseX + secondSlot % 5 * nodeSpacing;
    double endY = baseY + secondSlot / 5 * nodeSpacing;
    for (RenderProgressingLine line : lineList) {
        if (line.hasLineSameProperties(startX, startY, 0, endX, endY, 0))
            return;
    }
    lineList.add(new RenderProgressingLine(startX, startY, endX, endY));
}
Also used : RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine)

Example 5 with RenderProgressingLine

use of pneumaticCraft.client.render.RenderProgressingLine in project PneumaticCraft by MineMaarten.

the class NetworkConnectionPlayerHandler method mouseClicked.

public void mouseClicked(int x, int y, int mouseButton, Slot slot) {
    if (slot != null) {
        if (mouseButton == 0)
            tryToHackSlot(slot.slotNumber);
        if (mouseButton == 1 && slotHacked[slot.slotNumber]) {
            boolean alreadyFortifying = false;
            for (GuiStatBalloon balloon : balloons) {
                if (balloon.slotNumber == slot.slotNumber) {
                    alreadyFortifying = true;
                    break;
                }
            }
            if (!alreadyFortifying) {
                balloons.add(new GuiStatBalloon(slot.xDisplayPosition + gui.getGuiLeft() + 8, slot.yDisplayPosition + gui.getGuiTop() - 5, slot.slotNumber));
            }
        }
        if (mouseButton == 2 && !slotHacked[slot.slotNumber] && ((GuiSecurityStationHacking) gui).hasNukeViruses()) {
            int linesBefore = lineList.size();
            if (tryToHackSlot(slot.slotNumber)) {
                EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
                NetworkHandler.sendToServer(new PacketUseItem(Itemss.nukeVirus, 1));
                player.inventory.consumeInventoryItem(Itemss.nukeVirus);
                for (int i = linesBefore; i < lineList.size(); i++) {
                    RenderProgressingLine line = lineList.get(i);
                    line.setProgress(1);
                    slotHacked[slot.slotNumber] = true;
                    onSlotHack(slot.slotNumber, true);
                }
            }
        }
    }
}
Also used : RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine) EntityPlayer(net.minecraft.entity.player.EntityPlayer) PacketUseItem(pneumaticCraft.common.network.PacketUseItem)

Aggregations

RenderProgressingLine (pneumaticCraft.client.render.RenderProgressingLine)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 PacketUseItem (pneumaticCraft.common.network.PacketUseItem)1