Search in sources :

Example 1 with KineticNetwork

use of com.simibubi.create.content.contraptions.KineticNetwork in project Create_Aeronautics by Eriksonnaren.

the class TorsionSpringTileEntity method updateGeneratedRotation.

public void updateGeneratedRotation() {
    float speed = this.getGeneratedSpeed();
    float prevSpeed = this.speed;
    if (!this.level.isClientSide) {
        if (prevSpeed != speed) {
            if (!this.hasSource()) {
                IRotate.SpeedLevel levelBefore = IRotate.SpeedLevel.of(this.speed);
                IRotate.SpeedLevel levelafter = IRotate.SpeedLevel.of(speed);
                if (levelBefore != levelafter) {
                    this.effects.queueRotationIndicators();
                }
            }
            this.applyNewSpeed(prevSpeed, speed);
        }
        if (this.hasNetwork() && speed != 0.0F) {
            KineticNetwork network = this.getOrCreateNetwork();
            this.notifyStressCapacityChange(this.calculateAddedStressCapacity());
            this.getOrCreateNetwork().updateStressFor(this, this.calculateStressApplied());
            network.updateStress();
        }
        // this.onSpeedChanged(prevSpeed);
        this.sendData();
    }
}
Also used : IRotate(com.simibubi.create.content.contraptions.base.IRotate) KineticNetwork(com.simibubi.create.content.contraptions.KineticNetwork)

Example 2 with KineticNetwork

use of com.simibubi.create.content.contraptions.KineticNetwork in project Create by Creators-of-Create.

the class KineticTileEntity method initialize.

@Override
public void initialize() {
    if (hasNetwork() && !level.isClientSide) {
        KineticNetwork network = getOrCreateNetwork();
        if (!network.initialized)
            network.initFromTE(capacity, stress, networkSize);
        network.addSilently(this, lastCapacityProvided, lastStressApplied);
    }
    super.initialize();
}
Also used : KineticNetwork(com.simibubi.create.content.contraptions.KineticNetwork)

Example 3 with KineticNetwork

use of com.simibubi.create.content.contraptions.KineticNetwork in project Create by Creators-of-Create.

the class KineticTileEntity method setNetwork.

public void setNetwork(@Nullable Long networkIn) {
    if (network == networkIn)
        return;
    if (network != null)
        getOrCreateNetwork().remove(this);
    network = networkIn;
    setChanged();
    if (networkIn == null)
        return;
    network = networkIn;
    KineticNetwork network = getOrCreateNetwork();
    network.initialized = true;
    network.add(this);
}
Also used : KineticNetwork(com.simibubi.create.content.contraptions.KineticNetwork)

Example 4 with KineticNetwork

use of com.simibubi.create.content.contraptions.KineticNetwork in project Create by Creators-of-Create.

the class GeneratingKineticTileEntity method updateGeneratedRotation.

public void updateGeneratedRotation() {
    float speed = getGeneratedSpeed();
    float prevSpeed = this.speed;
    if (level.isClientSide)
        return;
    if (prevSpeed != speed) {
        if (!hasSource()) {
            SpeedLevel levelBefore = SpeedLevel.of(this.speed);
            SpeedLevel levelafter = SpeedLevel.of(speed);
            if (levelBefore != levelafter)
                effects.queueRotationIndicators();
        }
        applyNewSpeed(prevSpeed, speed);
    }
    if (hasNetwork() && speed != 0) {
        KineticNetwork network = getOrCreateNetwork();
        notifyStressCapacityChange(calculateAddedStressCapacity());
        getOrCreateNetwork().updateStressFor(this, calculateStressApplied());
        network.updateStress();
    }
    onSpeedChanged(prevSpeed);
    sendData();
}
Also used : SpeedLevel(com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel) KineticNetwork(com.simibubi.create.content.contraptions.KineticNetwork)

Example 5 with KineticNetwork

use of com.simibubi.create.content.contraptions.KineticNetwork in project Multiblocked by Low-Drag-MC.

the class CreateKineticSourceTileEntity method updateGeneratedRotation.

public void updateGeneratedRotation() {
    if (!definition.isOutput)
        return;
    float speed = this.getGeneratedSpeed();
    float prevSpeed = this.speed;
    if (!this.level.isClientSide) {
        if (prevSpeed != speed) {
            if (!this.hasSource()) {
                IRotate.SpeedLevel levelBefore = IRotate.SpeedLevel.of(this.speed);
                IRotate.SpeedLevel levelafter = IRotate.SpeedLevel.of(speed);
                if (levelBefore != levelafter) {
                    this.effects.queueRotationIndicators();
                }
            }
            this.applyNewSpeed(prevSpeed, speed);
        }
        if (this.hasNetwork() && speed != 0.0F) {
            KineticNetwork network = this.getOrCreateNetwork();
            this.notifyStressCapacityChange(this.calculateAddedStressCapacity());
            this.getOrCreateNetwork().updateStressFor(this, this.calculateStressApplied());
            network.updateStress();
        }
        this.onSpeedChanged(prevSpeed);
        this.sendData();
    }
}
Also used : IRotate(com.simibubi.create.content.contraptions.base.IRotate) KineticNetwork(com.simibubi.create.content.contraptions.KineticNetwork)

Aggregations

KineticNetwork (com.simibubi.create.content.contraptions.KineticNetwork)5 IRotate (com.simibubi.create.content.contraptions.base.IRotate)2 SpeedLevel (com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel)1