use of crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateResponse 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;
}
}
use of crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateResponse in project EnderIO by SleepyTrousers.
the class CapBankNetwork method destroyNetwork.
@Override
public void destroyNetwork() {
ServerTickHandler.removeListener(this);
distributeEnergyToBanks();
TileCapBank cap = null;
for (TileCapBank cb : capBanks) {
cb.setNetwork(null);
if (cap == null) {
cap = cb;
}
}
capBanks.clear();
if (cap != null) {
PacketHandler.INSTANCE.sendToAll(new PacketNetworkStateResponse(this, true));
}
}
Aggregations