Search in sources :

Example 1 with EntityProgrammableController

use of me.desht.pneumaticcraft.common.entity.EntityProgrammableController in project pnc-repressurized by TeamPneumatic.

the class TileEntityProgrammableController method update.

@Override
public void update() {
    super.update();
    double speed = getSpeed();
    if (PneumaticCraftUtils.distBetweenSq(getPos(), targetX, targetY, targetZ) <= speed * speed) {
        curX = targetX;
        curY = targetY;
        curZ = targetZ;
    } else if (PneumaticCraftUtils.distBetweenSq(curX, curY, curZ, targetX, targetY, targetZ) > 0.25) {
        // dist-between check here avoids drone "jitter" when it's very near its target
        Vec3d vec = new Vec3d(targetX - curX, targetY - curY, targetZ - curZ).normalize().scale(speed);
        curX += vec.x;
        curY += vec.y;
        curZ += vec.z;
    }
    if (!getWorld().isRemote) {
        getAIManager();
        for (int i = 0; i < 4; i++) {
            getFakePlayer().interactionManager.updateBlockRemoving();
        }
        if (getPressure() >= getMinWorkingPressure()) {
            if (!aiManager.isIdling())
                addAir(-10);
            aiManager.onUpdateTasks();
        }
    } else {
        if (drone == null || drone.isDead) {
            drone = new EntityProgrammableController(getWorld(), this);
            drone.posX = curX;
            drone.posY = curY;
            drone.posZ = curZ;
            getWorld().spawnEntity(drone);
        }
        drone.setPosition(curX, curY, curZ);
    }
}
Also used : EntityProgrammableController(me.desht.pneumaticcraft.common.entity.EntityProgrammableController) Vec3d(net.minecraft.util.math.Vec3d)

Example 2 with EntityProgrammableController

use of me.desht.pneumaticcraft.common.entity.EntityProgrammableController in project pnc-repressurized by TeamPneumatic.

the class ModelDrone method render.

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    if (entity instanceof EntityProgrammableController)
        f5 /= 2F;
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    if (entity != null)
        RenderUtils.glColorHex(0xFF000000 + ((EntityDroneBase) entity).getDroneColor());
    Base2.render(f5);
    Base3.render(f5);
    Base4.render(f5);
    Base5.render(f5);
    GL11.glColor4d(1, 1, 1, 1);
    Base.render(f5);
    Prop1Part1.render(f5);
    Prop1Part2.render(f5);
    Prop1Part3.render(f5);
    Prop2Part1.render(f5);
    Prop2Part2.render(f5);
    Prop2Part3.render(f5);
    Prop3Part1.render(f5);
    Prop3Part2.render(f5);
    Prop3Part3.render(f5);
    Prop4Part1.render(f5);
    Prop4Part2.render(f5);
    Prop4Part3.render(f5);
    Frame1.render(f5);
    Frame2.render(f5);
    LandingStand1.render(f5);
    LandingStand2.render(f5);
    LandingStand3.render(f5);
    LandingStand4.render(f5);
    LaserArm.render(f5);
    LaserSource.render(f5);
    if (entity instanceof EntityDrone && ((EntityDrone) entity).hasMinigun())
        minigun.render(entity, f, f1, f2, f3, f4, f5);
    if (isLogisticsDrone) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        RenderUtils.glColorHex(0xFFFF0000);
        double s = 3 / 16D;
        double y = 17 / 16D;
        SemiBlockRendererLogistics.renderFrame(new AxisAlignedBB(-s, y - s, -s, s, y + s, s), 1 / 32D);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityProgrammableController(me.desht.pneumaticcraft.common.entity.EntityProgrammableController) EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone)

Aggregations

EntityProgrammableController (me.desht.pneumaticcraft.common.entity.EntityProgrammableController)2 EntityDrone (me.desht.pneumaticcraft.common.entity.living.EntityDrone)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1