コード例 #1
0
  public float drainEnergy(float amount, TileEntityAbstractEnergyInventory tile) {
    if (data.getEnergyLevel() >= EnergyChunkData.minSignificantEnergy)
      PacketPipeline.sendToAllAround(this, 64D, new C10ParticleEnergyTransfer(tile, this));

    float left = data.drainEnergy(amount);
    if (!MathUtil.floatEquals(left, amount)) synchronize();
    return left;
  }
コード例 #2
0
  public float addEnergy(float amount, TileEntityAbstractEnergyInventory tile) {
    if (data.getEnergyLevel() < data.getMaxEnergyLevel())
      PacketPipeline.sendToAllAround(this, 64D, new C10ParticleEnergyTransfer(tile, this));

    float left = data.addEnergy(amount);
    if (!MathUtil.floatEquals(left, amount)) synchronize();
    return left;
  }