Search in sources :

Example 31 with TrainPacket

use of club.nsdn.nyasamarailway.network.TrainPacket in project NyaSamaRailway by NSDN.

the class NSC3AM method doEngine.

@Override
protected void doEngine() {
    tmpPacket = new TrainPacket(getEnginePower(), getEngineBrake(), getEngineDir());
    tmpPacket.highSpeed = isHighSpeed();
    tmpPacket.Velocity = this.Velocity;
    if (this.maxVelocity > 0) {
        if (this.Velocity > this.maxVelocity && tmpEngineBrake == -1) {
            tmpEngineBrake = getEngineBrake();
            setEngineBrake(1);
        } else if (this.Velocity > this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(1);
        } else if (this.Velocity <= this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(tmpEngineBrake);
            tmpEngineBrake = -1;
        }
    }
    TrainController.doMotionWithEuler(tmpPacket, this, getMaxCartSpeedOnRail());
    setEnginePrevVel(this.Velocity);
    setEngineVel(tmpPacket.Velocity);
}
Also used : TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Example 32 with TrainPacket

use of club.nsdn.nyasamarailway.network.TrainPacket in project NyaSamaRailway by NSDN.

the class NSPCT8J method doEngine.

@Override
protected void doEngine() {
    tmpPacket = new TrainPacket(getEnginePower(), getEngineBrake(), getEngineDir());
    tmpPacket.highSpeed = isHighSpeed();
    tmpPacket.Velocity = this.Velocity;
    if (this.maxVelocity > 0) {
        if (this.Velocity > this.maxVelocity && tmpEngineBrake == -1) {
            tmpEngineBrake = getEngineBrake();
            setEngineBrake(1);
        } else if (this.Velocity > this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(1);
        } else if (this.Velocity <= this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(tmpEngineBrake);
            tmpEngineBrake = -1;
        }
    }
    if (getHighSpeedMode())
        TrainController.doMotionWithAirHigh(tmpPacket, this);
    else {
        TrainController.doMotionWithAir(tmpPacket, this);
    }
    setEnginePrevVel(this.Velocity);
    setEngineVel(tmpPacket.Velocity);
}
Also used : TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Example 33 with TrainPacket

use of club.nsdn.nyasamarailway.network.TrainPacket in project NyaSamaRailway by NSDN.

the class NSPCT9M method doEngine.

@Override
protected void doEngine() {
    tmpPacket = new TrainPacket(getEnginePower(), getEngineBrake(), getEngineDir());
    tmpPacket.highSpeed = isHighSpeed();
    tmpPacket.Velocity = this.Velocity;
    if (this.maxVelocity > 0) {
        if (this.Velocity > this.maxVelocity && tmpEngineBrake == -1) {
            tmpEngineBrake = getEngineBrake();
            setEngineBrake(1);
        } else if (this.Velocity > this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(1);
        } else if (this.Velocity <= this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(tmpEngineBrake);
            tmpEngineBrake = -1;
        }
    }
    TrainController.doMotionWithAir(tmpPacket, this);
    setEnginePrevVel(this.Velocity);
    setEngineVel(tmpPacket.Velocity);
}
Also used : TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Example 34 with TrainPacket

use of club.nsdn.nyasamarailway.network.TrainPacket in project NyaSamaRailway by NSDN.

the class NSC2AM method doEngine.

@Override
protected void doEngine() {
    tmpPacket = new TrainPacket(getEnginePower(), getEngineBrake(), getEngineDir());
    tmpPacket.highSpeed = isHighSpeed();
    tmpPacket.Velocity = this.Velocity;
    if (this.maxVelocity > 0) {
        if (this.Velocity > this.maxVelocity && tmpEngineBrake == -1) {
            tmpEngineBrake = getEngineBrake();
            setEngineBrake(1);
        } else if (this.Velocity > this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(1);
        } else if (this.Velocity <= this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(tmpEngineBrake);
            tmpEngineBrake = -1;
        }
    }
    TrainController.doMotionWithEuler(tmpPacket, this, getMaxCartSpeedOnRail());
    setEnginePrevVel(this.Velocity);
    setEngineVel(tmpPacket.Velocity);
}
Also used : TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Example 35 with TrainPacket

use of club.nsdn.nyasamarailway.network.TrainPacket in project NyaSamaRailway by NSDN.

the class NSC3BM method doEngine.

@Override
protected void doEngine() {
    tmpPacket = new TrainPacket(getEnginePower(), getEngineBrake(), getEngineDir());
    tmpPacket.highSpeed = isHighSpeed();
    tmpPacket.Velocity = this.Velocity;
    if (this.maxVelocity > 0) {
        if (this.Velocity > this.maxVelocity && tmpEngineBrake == -1) {
            tmpEngineBrake = getEngineBrake();
            setEngineBrake(1);
        } else if (this.Velocity > this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(1);
        } else if (this.Velocity <= this.maxVelocity && tmpEngineBrake != -1) {
            setEngineBrake(tmpEngineBrake);
            tmpEngineBrake = -1;
        }
    }
    TrainController.doMotionWithEuler(tmpPacket, this, getMaxCartSpeedOnRail());
    setEnginePrevVel(this.Velocity);
    setEngineVel(tmpPacket.Velocity);
}
Also used : TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Aggregations

TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)38 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)5 LocoBase (club.nsdn.nyasamarailway.entity.LocoBase)3 EntityMinecart (net.minecraft.entity.item.EntityMinecart)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)3 IHighSpeedCart (club.nsdn.nyasamarailway.entity.IHighSpeedCart)1 ItemNTP32Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit)1 ItemNTP8Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 GuiChat (net.minecraft.client.gui.GuiChat)1 ItemStack (net.minecraft.item.ItemStack)1