Search in sources :

Example 1 with PacketNetworkEnergyResponse

use of crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkEnergyResponse in project EnderIO by SleepyTrousers.

the class CapBankNetwork method tickEnd.

// --------- Tick Handling
@Override
public void tickEnd(TickEvent.ServerTickEvent evt, @Nullable Profiler profiler) {
    Prof.start(profiler, "EnergyTransmitting");
    transmitEnergy();
    if (energyStored != prevEnergyStored) {
        Prof.next(profiler, "EnergyBalancing");
        distributeEnergyToBanks();
    }
    Prof.next(profiler, "EnergyTracking");
    powerTrackerIn.tick(energyReceived);
    powerTrackerOut.tick(energySend);
    prevEnergyStored = energyStored;
    energyReceived = 0;
    energySend = 0;
    Prof.stop(profiler);
    if (firstUpate) {
        if (!capBanks.isEmpty()) {
            PacketHandler.sendToAllAround(new PacketNetworkStateResponse(this), capBanks.get(0));
            PacketHandler.sendToAllAround(new PacketNetworkEnergyResponse(this), capBanks.get(0));
        }
        firstUpate = false;
    }
}
Also used : PacketNetworkEnergyResponse(crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkEnergyResponse) PacketNetworkStateResponse(crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateResponse)

Aggregations

PacketNetworkEnergyResponse (crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkEnergyResponse)1 PacketNetworkStateResponse (crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateResponse)1