Search in sources :

Example 1 with TileCapBank

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

the class CapBankNetwork method setMaxOutput.

@Override
public void setMaxOutput(int max) {
    if (DiagnosticsConfig.debugTraceCapLimitsExtremelyDetailed.get()) {
        StringBuilder sb = new StringBuilder("CapBankNetwork ").append(this).append(" output changed from ").append(this.maxOutput).append(" to ").append(max);
        for (StackTraceElement elem : new Exception("Stackstrace").getStackTrace()) {
            sb.append(" at ").append(elem);
        }
        Log.warn(sb);
    }
    if (max >= maxIO) {
        maxOutput = -1;
    } else if (max < 0) {
        maxOutput = 0;
    } else {
        maxOutput = max;
    }
    for (TileCapBank cb : capBanks) {
        cb.setMaxOutput(maxOutput);
    }
}
Also used : TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank)

Example 2 with TileCapBank

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

the class CapBankNetwork method distributeEnergyToBanks.

private void distributeEnergyToBanks() {
    if (capBanks.isEmpty()) {
        return;
    }
    int energyPerCapBank = (int) (energyStored / capBanks.size());
    int remaining = (int) (energyStored % capBanks.size());
    for (TileCapBank cb : capBanks) {
        cb.setEnergyStored(energyPerCapBank);
    }
    TileCapBank cb = capBanks.get(0);
    cb.setEnergyStored(cb.getEnergyStored() + remaining);
}
Also used : TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank)

Example 3 with TileCapBank

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

the class CapBankNetwork method init.

// --------- Network Management
public void init(TileCapBank cap, Collection<TileCapBank> neighbours, World world) {
    if (world.isRemote) {
        throw new UnsupportedOperationException();
    }
    type = cap.getType();
    inputControlMode = cap.getInputControlMode();
    outputControlMode = cap.getOutputControlMode();
    for (TileCapBank con : neighbours) {
        ICapBankNetwork network = con.getNetwork();
        if (network != null) {
            network.destroyNetwork();
        }
    }
    setNetwork(world, cap);
    // ensure energy level is within bounds
    addEnergy(0);
    ServerTickHandler.addListener(this);
}
Also used : TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank)

Example 4 with TileCapBank

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

the class CapBankNetwork method setInputControlMode.

@Override
public void setInputControlMode(@Nonnull RedstoneControlMode inputControlMode) {
    if (this.inputControlMode == inputControlMode) {
        return;
    }
    this.inputControlMode = inputControlMode;
    for (TileCapBank capBank : capBanks) {
        capBank.setInputControlMode(inputControlMode);
    }
    updateRedstoneConditions();
}
Also used : TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank)

Example 5 with TileCapBank

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

the class CapBankNetwork method setOutputControlMode.

@Override
public void setOutputControlMode(@Nonnull RedstoneControlMode outputControlMode) {
    if (this.outputControlMode == outputControlMode) {
        return;
    }
    this.outputControlMode = outputControlMode;
    for (TileCapBank capBank : capBanks) {
        capBank.setOutputControlMode(outputControlMode);
    }
    updateRedstoneConditions();
}
Also used : TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank)

Aggregations

TileCapBank (crazypants.enderio.powertools.machine.capbank.TileCapBank)13 TileEntity (net.minecraft.tileentity.TileEntity)3 BlockCapBank (crazypants.enderio.powertools.machine.capbank.BlockCapBank)2 IBlockState (net.minecraft.block.state.IBlockState)2 EnumFacing (net.minecraft.util.EnumFacing)2 IoMode (crazypants.enderio.base.machine.modes.IoMode)1 EnumIOMode (crazypants.enderio.base.render.property.IOMode.EnumIOMode)1 CapBankType (crazypants.enderio.powertools.machine.capbank.CapBankType)1 InfoDisplayType (crazypants.enderio.powertools.machine.capbank.InfoDisplayType)1 CapBankClientNetwork (crazypants.enderio.powertools.machine.capbank.network.CapBankClientNetwork)1 ICapBankNetwork (crazypants.enderio.powertools.machine.capbank.network.ICapBankNetwork)1 PacketNetworkStateResponse (crazypants.enderio.powertools.machine.capbank.packet.PacketNetworkStateResponse)1 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1