Search in sources :

Example 1 with PacketNetworkStateRequest

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

the class GuiCapBank method updateState.

private boolean updateState() {
    if (!initState) {
        return false;
    }
    if (capBank.getNetwork() == null) {
        network = NULL_NETWORK;
        return true;
    }
    if (network == NULL_NETWORK) {
        network = NullHelper.first((CapBankClientNetwork) capBank.getNetwork(), NULL_NETWORK);
        initialStateCount = network.getStateUpdateCount();
        PacketHandler.INSTANCE.sendToServer(new PacketNetworkStateRequest(capBank));
        return true;
    }
    if (network.getStateUpdateCount() == initialStateCount) {
        PacketHandler.INSTANCE.sendToServer(new PacketNetworkStateRequest(capBank));
        return true;
    }
    if (network.getStateUpdateCount() > initialStateCount) {
        updateFieldsFromState();
        initState = false;
        return true;
    }
    return false;
}
Also used : CapBankClientNetwork(crazypants.enderio.powertools.machine.capbank.network.CapBankClientNetwork) PacketNetworkStateRequest(crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateRequest)

Aggregations

CapBankClientNetwork (crazypants.enderio.powertools.machine.capbank.network.CapBankClientNetwork)1 PacketNetworkStateRequest (crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateRequest)1